MyBatis-plus中的IPage返回值有数据的,但没有分页,total返回0
1.添加如下配置文件
在使用MyBatis-plus进行分页的过程中,有数据的,但没有分页,total返回0!可以尝试如下解决方案:
@Configuration
public class MybatisPlusConfig {
/**
* mybatis-plus分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor page = new PaginationInterceptor();
page.setDialectType("mysql");
return page;
}
}
2.去掉pom.xml中的pagehelper插件
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.9</version>
</dependency>