Mybatis Plus分页只显示一页数据(已解决)
报错时环境
SpringBoot版本:2.2.5
Mybatis Plus版本:2.1.4
根据需求要写后台分页,展示数据只有一页,不显示数据总条数、上一页和下一页无法点击
走debug时发现total始终为0
解决方法
添加如下配置文件
@EnableTransactionManagement
@Configuration
public class MybatisPlusConfig {
/**
* 分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
到此问题解决
另外
在解决过程中在网上发现其他可能存在的问题及解决方案
原因:pom还引入了其它的分页插件
pagehelper-spring-boot-starter
方法:
去掉pom.xml中的pagehelper依赖就可以