mybatis plus 版本:2.3
<dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>2.3</version> </dependency>
Controller:
@ResponseBody @RequestMapping("/queryPage") public Map queryPage(Integer page, Integer rows) { Page<PhoEntitiesList> page1 = new Page<>(page, rows); Page<List<PhoEntitiesList>> wp = phoEntitiesListService.queryPage(page1); HashMap<String, Object> map = new HashMap<>(); map.put("total", wp.getTotal()); map.put("rows", wp.getRecords()); return map; }
service:
Page<List<PhoEntitiesList>> queryPage(Page<PhoEntitiesList> page1);
serviceImpl:
@Override public Page<List<PhoEntitiesList>> queryPage(Page<PhoEntitiesList> page1){ return page1.setRecords(this.baseMapper.queryPage(page1, Condition.EMPTY)); // 分页 这里重点 Condition.EMPTY无查询条件的时候 使用;有的时候直接传EntityWrapper }
dao:
List<PhoEntitiesList> queryPage(RowBounds page1, @Param("ew") Wrapper<PhoEntitiesList> var2);
mapper:
<select id="queryPage" resultType="com.slecc.digitaldelivery.ssm.bean.PhoEntitiesList"> select pel.* from PHO_ENTITIES_LIST pel </select>
注意:serviceImpl;注意:serviceImpl;注意:serviceImpl;
看不懂的留言,我看见会回复你;