1. 使用@select注解的方式。返回值如常用则创建VO,如不常用可直接使用map接收
@Select("SELECT a.*, b.* FROM a left join b on a.x = b.x ${ew.customSqlSegment}")
IPage<Map> selectPage(Page<Map> page , @Param(Constants.WRAPPER) QueryWrapper wrapper);
调用方:
前端传入分页字段
Page<Map> page = new Page<>(i, ps);
QueryWrapper queryWrapper = new QueryWrapper<>();
queryWrapper.eq("a.xx2", "xx2");
xxMapper.selectPage(page, queryWrapper);
2.使用xml的方式
<select id="selectPage" resultType="java.util.Map">
SELECT a.*,b.*
FROM a
LEFT JOIN b ON a.x=b.x
//重点是这里会插入wrapper的搜索语句
${ew.customSqlSegment}
</select>