MybatisPlus配置分页插件

从3.4版本开始,分页插件推荐用PaginationInnerInterceptor

package org.example.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;

public class MyBatisPlusConfig {
    /**
     * 分页插件
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.ORACLE_12C);
        // 设置最大页面条数,防止出现性能问题
        paginationInnerInterceptor.setMaxLimit(100L);
        return interceptor;
    }
}

你可能感兴趣的:(Spring学习笔记,mybatis,java,spring)