SpringBoot集成MybatisPlus使用PageHelper分页失效

本文介绍了SpringBoot集成MybatisPlus时,使用PageHelper进行分页操作遇到的问题及解决方案。主要原因是Jar包冲突,解决办法是在pom.xml中排除mybatis的依赖,并在配置类中正确设置PageHelper的属性。同时,引入了PaginationInterceptor和PerformanceInterceptor以增强性能。
摘要由CSDN通过智能技术生成

很多同志不想用MybatisPlus自带的分页希望用PageHelper结果失效了

原因解决方案

1.可能是Jar冲突了,pom.xml文件只需要引入以下

<!--pagehelper 在version 下面添加 exclusions依赖(排除) 因为mybatisPlus中包含了-->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.3</version>
            <exclusions>
             <exclusion>
             <groupId>org.mybatis</groupId>
             <artifactId>mybatis</artifactId>
             </exclusion>
            </exclusions>
        </dependency>

 

2.引入的包是这两个

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

 

3.MybatisPlus配置类

package com.lifan.config;

impo

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值