use of com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor in project project by Ahaochan.
the class MyBatisPlusConfig method mybatisPlusInterceptor.
/**
* @see <a href="https://mp.baomidou.com/guide/interceptor.html">插件主体(必看!)(since 3.4.0)</a>
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
List<InnerInterceptor> innerInterceptors = Arrays.asList(// new TenantLineInnerInterceptor(), new DynamicTableNameInnerInterceptor(),
new PaginationInnerInterceptor(), new OptimisticLockerInnerInterceptor(), // update 和 delete 必须要有 where
new BlockAttackInnerInterceptor());
mybatisPlusInterceptor.setInterceptors(innerInterceptors);
return mybatisPlusInterceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor in project bubble-fireworks by fxbin.
the class MybatisPlusAutoConfiguration method mybatisPlusInterceptor.
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 分页插件
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
// 乐观锁插件
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
return interceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor in project helio-starters by uncarbon97.
the class HelioMybatisPlusAutoConfiguration method mybatisPlusInterceptor.
@Bean
@ConditionalOnMissingBean
public MybatisPlusInterceptor mybatisPlusInterceptor(TenantSupport tenantSupport) {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
/*
https://baomidou.com/pages/2976a3/#%E5%B1%9E%E6%80%A7
使用多个功能需要注意顺序关系,建议使用如下顺序
多租户,动态表名
分页,乐观锁
sql性能规范,防止全表更新与删除
*/
if (Boolean.TRUE.equals(helioProperties.getTenant().getEnabled())) {
// 配置文件中启用了多租户功能,注入对应支持 bean
tenantSupport.support(helioProperties, interceptor);
}
/*
分页插件
*/
PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
// 设置sql的limit为无限制
paginationInnerInterceptor.setMaxLimit(-1L);
interceptor.addInnerInterceptor(paginationInnerInterceptor);
/*
乐观锁
*/
if (Boolean.TRUE.equals(helioProperties.getCrud().getOptimisticLock().getEnabled())) {
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
}
/*
防止全表更新与删除
*/
interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
return interceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor in project albedo by somowhere.
the class AuthorityMybatisAutoConfiguration method getPaginationBeforeInnerInterceptor.
/**
* 数据权限插件
*
* @return 数据权限插件
*/
@Override
protected List<InnerInterceptor> getPaginationBeforeInnerInterceptor() {
List<InnerInterceptor> list = new ArrayList<>();
Boolean isDataScope = databaseProperties.getIsDataScope();
if (isDataScope) {
list.add(new OptimisticLockerInnerInterceptor());
list.add(new DataScopeInterceptor());
}
return list;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor in project chao-cloud by chaojunzi.
the class MybatisPlusConfig method mybatisPlusInterceptor.
/**
* mybatis-plus插件
*
* @return {@link MybatisPlusInterceptor}
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 设置sql的limit为无限制,默认是500
PaginationInnerInterceptor pageInterceptor = new PaginationInnerInterceptor();
pageInterceptor.setMaxLimit(-1L);
interceptor.addInnerInterceptor(pageInterceptor);
// 乐观锁插件
OptimisticLockerInnerInterceptor lockerInnerInterceptor = new OptimisticLockerInnerInterceptor();
interceptor.addInnerInterceptor(lockerInnerInterceptor);
return interceptor;
}
Aggregations