现象:使用分页查时都是全量数据,没有limit,count
原因1:如果你是是引用以下依赖:
com.github.pagehelper
pagehelper
5.1.8
更替为
com.github.pagehelper
pagehelper-spring-boot-starter
1.2.10
yml添加:
#pagehelper分页插件配置 pagehelper: helperDialect: mysql reasonable: true supportMethodsArguments: true params: count=countSql
然后可能还是报错。
原因2:依赖冲突
所以排除相关包,即:
com.github.pagehelper pagehelper-spring-boot-starter 1.2.10 org.mybatis mybatis org.mybatis mybatis-spring org.apache.logging.log4j log4j-slf4j-impl slf4j-api org.slf4j logback-classic ch.qos.logback log4j-over-slf4j org.slf4j jul-to-slf4j org.slf4j spring-boot-starter-logging org.springframework.boot
@GetMapping("findByAllwithPage")
public PageInfofindByAllwithPage(int page, int pageSize, xx xx) {
PageHelper.startPage(page, pageSize);
return new PageInfo<>(xx.findByAll(xx));
}