一只兔子

pagehadler分页使用

引入JAR包

<pagehelper.version>5.1.0</pagehelper.version>
<pagehelper-spring-boot-starter.version>1.2.12</pagehelper-spring-boot-starter.version>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>${pagehelper.version}</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper-spring-boot-starter}</version>
</dependency>
 
***********案例
@GetMapping
@ApiOperation(value = "逛商圈分类管理查询", notes = "逛商圈分类管理查询")
public ResponseDTO<PageInfo<ShopGoodsCatsVO>> getShopGoodsCats(ShopGoodsCatsBO shopGoodsCatsBO, PageDTO pageDTO) {
Page<TbShopGoodsCat> page = PageHelper.startPage(pageDTO.getPageNum(), pageDTO.getPageSize());
List<TbShopGoodsCat> list = shopGoodsCatService.getList(shopGoodsCatsBO);
List<ShopGoodsCatsVO> shopGoodsCatsVOS = list.stream().map(ShopGoodsCatsVO::toVo).collect(Collectors.toList());
PageInfo<ShopGoodsCatsVO> pageInfo = new PageInfo<>(shopGoodsCatsVOS);
pageInfo.setTotal(page.getTotal());
return ResponseDTO.ok(pageInfo);
}

 

posted on 2023-04-26 14:30  安之于情  阅读(13)  评论(0编辑  收藏  举报

导航