Featured image of post Mybatis-plus 3.5.9 版本 PaginationInnerInterceptor 插件更新

Mybatis-plus 3.5.9 版本 PaginationInnerInterceptor 插件更新

最新的 mybatis-plus v3.5.9 版本更新了分页插件 PaginationInnerInterceptor 的配置,需要引入新的依赖包

于 v3.5.9 起,PaginationInnerInterceptor 已分离出来。如需使用,则需单独引入 mybatis-plus-jsqlparser 依赖

最新的 3.5.9 版本,在配置分页插件的时候,会提示原本的 PaginationInnerInterceptor 找不到这个类,需要导入新的依赖包

1
2
3
4
5
<dependency>
	<groupId>com.baomidou</groupId>
	<artifactId>mybatis-plus-jsqlparser</artifactId>
	 <version>3.5.9</version>
</dependency>

分页插件配置如下:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
@Configuration
public class MybatisPlusConfig {

    /**
     * 添加分页插件
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); // 如果配置多个插件, 切记分页最后添加
        // 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
        return interceptor;
    }
}
本博客所有内容无特殊标注均为大卷学长原创内容,复制请保留原文出处。
Built with Hugo
Theme Stack designed by Jimmy