MyBatis-plus中的Page分页出现返回total和pages为0的问题

在使用MyBatis-plus进行分页的过程中,发现可以获取到数据,但是返回total和pages为0!!!

解决方案:
1、添加配置文件

@EnableTransactionManagement
@Configuration
@MapperScan("com.*.*.mapper") //扫描自己的mapper包
public class MybatisPlusConfig {
    
    

    @Bean
    public PaginationInterceptor paginationInterceptor() {
    
    
        return new PaginationInterceptor();
    }

}

2、去掉pom.xml中的pagehelper插件

<dependency>
    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper-spring-boot-starter</artifactId>
    <version>1.2.9</version>
</dependency>

猜你喜欢

转载自blog.csdn.net/weixin_44412272/article/details/114365079