网站必备功能,桂林网站建,互联网保险中介平台,佛山网页网站设计Page分页records有数据#xff0c;但是total0#xff0c;解决办法 问题#xff1a;程序运行起来后#xff0c;后端接收前端传来的搜索请求信息正常#xff0c;但无法在前端正确反馈信息#xff0c;通过在后端排查发现total一直等于零#xff0c;但数据库中有数据#x…Page分页records有数据但是total0解决办法 问题程序运行起来后后端接收前端传来的搜索请求信息正常但无法在前端正确反馈信息通过在后端排查发现total一直等于零但数据库中有数据排查发现是Page有问题。 程序截图 解决方法 1先查看引用的mybatis-plus的版本低于3.4.0的可先升级版本到3.4.0 2配置分页拦截器
Configuration
public class MybatisPlusConfig {// 旧版Beanpublic PaginationInterceptor paginationInterceptor() {PaginationInterceptor paginationInterceptor new PaginationInterceptor();return paginationInterceptor;}// 最新版Beanpublic MybatisPlusInterceptor mybatisPlusInterceptor() {MybatisPlusInterceptor interceptor new MybatisPlusInterceptor();interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));return interceptor;}}主要是用最新的分页拦截器即可