MyBatis Plus 分页 total 为0问题解决方案
1、问题:total为0
在使用MyBatis Plus分页查询时,返回的total总是为0?
这是比较怪异的问题。
2、解决方法:
添加分页配置,如下:
@Configuration public class MybatisPlusConfig { @Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { // MyBatis Plus分页插件 MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL)); return interceptor; } }
写的真好