Controller
@GetMapping(value = "/list")public Result<?> queryPageList(ReconsiderPerson reconsiderPerson,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {// 构建分页对象Page<ReconsiderPerson> page = new Page<>(pageNo, pageSize);// 调用Service层IPage<ReconsiderPerson> pageList = reconsiderPersonService.queryPageList(page, reconsiderPerson, req.getParameterMap());return Result.OK(pageList);}
Service
IPage<ReconsiderPerson> queryPageList(Page<ReconsiderPerson> page, ReconsiderPerson reconsiderPerson, Map<String, String[]> parameterMap);
ServiceImpl
@Autowiredprivate ReconsiderPersonMapper reconsiderPersonMapper;@Overridepublic IPage<ReconsiderPerson> queryPageList(Page<ReconsiderPerson> page, ReconsiderPerson reconsiderPerson, Map<String, String[]> parameterMap) {return reconsiderPersonMapper.queryPageList(page, reconsiderPerson);}
Mapper
IPage<ReconsiderPerson> queryPageList(@Param("page") Page<ReconsiderPerson> page, @Param("entity") ReconsiderPerson reconsiderPerson);
Mapper.xml
<select id="queryPageList" resultType="org.whye.modules.xzfy.reconsiderPerson.entity.ReconsiderPerson">SELECTA.user_name as userName,from sys_user Aleft join reconsider_person B on A.id = B.user_idleft join sys_depart C on A.org_code = C.org_code<where><if test="entity.userName != null and entity.userName != ''">AND A.user_name LIKE CONCAT('%', #{entity.userName}, '%')</if></where></select>