package com.atwc.srb.base.config; import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import org.mybatis.spring.annotation.MapperScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration //@MapperScan(basePackages = "com.atwc.srb.*.mapper") public class MybatisplusConfig { @Bean public MybatisPlusInterceptor interceptor(){ MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); paginationInnerInterceptor.setOverflow(true); paginationInnerInterceptor.setDbType(DbType.MYSQL); interceptor.addInnerInterceptor(paginationInnerInterceptor); interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); return interceptor; } }
mybatis需要配置分页拦截器,Page分页查询才能生效
于 2023-04-06 19:52:16 首次发布