Skip to content

视图(Mapper)

视图遵循 mybatisplus 的书写规范,在对应系统或插件的 mapper 目录下

文件位置

目录原则

保持与 Entity 层的目录结构一致,这样调用的时候方便查找

接口定义规范

mapper 类在继承 baseMapper 的时候可以继承 mybatisplus 的 BaseMapper,也可以继承 mybatisplusjoin 的 MPJBaseMapper,建议通体继承 MPJBaseMapper,这样方便后期连表查询

自动注入

mapper 类在系统启动后自动注入

mapper的书写实例

java
package com.niu.core.mapper.addon;

import com.github.yulichang.base.MPJBaseMapper;
import com.niu.core.entity.addon.Addon;
import org.apache.ibatis.annotations.Mapper;

/**
 * 插件 Mapper
 */
@Mapper
public interface AddonMapper extends MPJBaseMapper<Addon> {
}

基于 MIT 协议发布