【MP插件】- mybatis-plus分页无效、total、pages为0的问题

【问题】:引用 mybatis-plus分页工具无效,IPage返回的结果中total、pages为0。

【解决】:1、第一步:添加分页拦截器

package com.ymdd.channel.feedback.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;


@EnableTransactionManagement
@Configuration
@MapperScan("com.ymdd.channel.feedback.mapper")
public class MybatisPlusConfig {

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        paginationInterceptor.setLimit(500);
        return paginationInterceptor;
    }
}

添加完后再试,如还不行,进行下一步;

2、第二步:去掉pom中pagehelper的相关依赖


    com.github.pagehelper
    pagehelper-spring-boot-starter

用心编写程序,用智慧照亮人生!Come On!!!

你可能感兴趣的:(有问题的一天)