- pom依赖
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
</dependency>
2.yml文件配置
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
pageSizeZero: false
params: count=countSql
3.程序使用
@PostMapping("/getWaitSpiderList")
public PageInfo getWaitSpiderList(@RequestBody SpiderCarSeries spiderCarSeries) {
PageHelper.startPage(spiderCarSeries.getPageNum() != null ? spiderCarSeries.getPageNum() : 1,
spiderCarSeries.getPageSize() != null ? spiderCarSeries.getPageSize() : 10);
return new PageInfo<>(spiderCarSeriesService.getWaitSpiderList(SpiderCarSeries.builder().build()));
}