mybatis plus

文章目录

  • 查询聚合函数
  • mapper 层 选装件

查询聚合函数

		//查询
	   QueryWrapper<[tableObj]> Wrapper = new QueryWrapper<>();
        Wrapper.select("min([field])","max([field])");
        List> maps = Mapper.selectMapsfWrapper);
        
		//返回json
		[{min(wfId)=-3, max(wfId)=-1}]
		
		//获取
		(int) maps.get(0).get("min(wfId)");

mapper 层 选装件

CustomInjector

@Configuration
public class CustomInjector extends DefaultSqlInjector {

    @Override
    public List getMethodList(Class mapperClass, TableInfo tableInfo) {
        List methodList = super.getMethodList(mapperClass, tableInfo);
        //加入选装件
        methodList.add(new InsertBatchSomeColumn());
        return methodList;
    }
}

mapper加入方法

@Repository
public interface []Mapper extends BaseMapper<[tableObj]> {

    int insertBatchSomeColumn(List<[tableObj] > entityList);

}

你可能感兴趣的:(java)