package com.huimv.cattle.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; import org.springframework.context.annotation.Configuration; /** * @Project : huimv.shiwan * @Package : com.huimv.biosafety.uface.controller * @Description : TODO * @Version : 1.0 * @Author : ZhuoNing * @Create : 2020-12-25 **/ @Configuration public class MybatisPlusConfig { /** * 注册插件 */ @Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); // 添加分页插件 PaginationInnerInterceptor pageInterceptor = new PaginationInnerInterceptor(); // 设置请求的页面大于最大页后操作,true调回到首页,false继续请求。默认false pageInterceptor.setOverflow(false); // 单页分页条数限制,默认无限制 pageInterceptor.setMaxLimit(500L); // 设置数据库类型 pageInterceptor.setDbType(DbType.MYSQL); interceptor.addInnerInterceptor(pageInterceptor); return interceptor; // MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); // interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); // return interceptor; } }