You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
2.1 KiB
57 lines
2.1 KiB
package com.gaotao.config;
|
|
|
|
import com.baomidou.mybatisplus.annotation.DbType;
|
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
|
import com.gaotao.common.batch.NoahSqlInjector;
|
|
import org.springframework.core.Ordered;
|
|
import org.springframework.core.annotation.Order;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
/**
|
|
* mybatis-plus配置
|
|
*
|
|
*
|
|
*/
|
|
@Configuration
|
|
public class MybatisPlusConfig {
|
|
|
|
/**
|
|
* 分页插件
|
|
*/
|
|
/* @Bean
|
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
|
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
|
|
// 当前页码大于总页数返回首页
|
|
PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();
|
|
//当当前页码大于总页数时,是否返回第一页的数据
|
|
paginationInterceptor.setOverflow(true);
|
|
//设置数据库类型
|
|
paginationInterceptor.setDbType(DbType.SQL_SERVER);
|
|
// 设置最大分页条数 10000条记录
|
|
paginationInterceptor.setMaxLimit(10000L);
|
|
mybatisPlusInterceptor.addInnerInterceptor(paginationInterceptor);
|
|
return mybatisPlusInterceptor;
|
|
}*/
|
|
|
|
@Bean
|
|
@Order(Ordered.HIGHEST_PRECEDENCE)
|
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
|
// 当前页码大于总页数返回首页
|
|
PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();
|
|
//当当前页码大于总页数时,是否返回第一页的数据
|
|
paginationInterceptor.setOverflow(true);
|
|
//设置数据库类型
|
|
paginationInterceptor.setDbType(DbType.SQL_SERVER);
|
|
interceptor.addInnerInterceptor(paginationInterceptor);
|
|
return interceptor;
|
|
}
|
|
|
|
@Bean
|
|
public NoahSqlInjector logicSqlInjector() {
|
|
return new NoahSqlInjector();
|
|
}
|
|
|
|
}
|