use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project diboot by dibo-software.
the class CoreAutoConfig method mybatisPlusInterceptor.
/**
* Mybatis-plus分页插件
*/
@Bean
@ConditionalOnMissingBean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return interceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project springboot-demo by small-rose.
the class MybatisPlusConfig method mybatisPlusInterceptor.
/**
* 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置
* MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project c4p by xseuen.
the class MybatisPlusConfig method mybatisPlusInterceptor.
// 最新版
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project Open-Job by lijunping365.
the class MyBatisPlusConfig method mybatisPlusInterceptor.
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
final MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
// 分页插件
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
// 乐观锁插件
mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
// sql性能规范插件
// mybatisPlusInterceptor.addInnerInterceptor(new IllegalSQLInnerInterceptor());
// 防止全表更新与删除插件
mybatisPlusInterceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
return mybatisPlusInterceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project jeecg-boot by jeecgboot.
the class MybatisPlusSaasConfig method mybatisPlusInterceptor.
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 先 add TenantLineInnerInterceptor 再 add PaginationInnerInterceptor
interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(new TenantLineHandler() {
@Override
public Expression getTenantId() {
String tenant_id = oConvertUtils.getString(TenantContext.getTenant(), "0");
return new LongValue(tenant_id);
}
@Override
public String getTenantIdColumn() {
return TENANT_FIELD_NAME;
}
// 返回 true 表示不走租户逻辑
@Override
public boolean ignoreTable(String tableName) {
for (String temp : tenantTable) {
if (temp.equalsIgnoreCase(tableName)) {
return false;
}
}
return true;
}
}));
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return interceptor;
}
Aggregations