一: 需要自定义的QueryWrapper查询工具类,定义查询规则
public static final String SQL_RULES_COLUMN = "SQL_RULES_COLUMN"; private static final String BEGIN = "_begin"; // 字段范围查询开始标识 private static final String END = "_end"; private static final String STAR = "*"; // 模糊查询标识 private static final String COMMA = ","; private static final String NOT_EQUAL = "!";
二: 正常的QueryWrapper查询,在mapper文件中使用 @Param(Constants.WRAPPER)
List<Emdj> listAll(IPage<Emdj> page, @Param(Constants.WRAPPER) QueryWrapper<Emdj> queryWrapper);
xml文件中使用ew.customSqlSegment,<where>标签可以不加
<select id="listAll" resultType="net.zazn.modules.discipline.entity.Emdj">
select id,lffh,xm,jsh,szrq,emlx,spzt,gjmj,flag,jlzt
from emdj
<where>${ew.customSqlSegment}</where>
</select>