use of com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor 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.inner.BlockAttackInnerInterceptor in project learn-simple by muggle0.
the class MybatisPlusConfig method mybatisPlusInterceptor.
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 分页插件
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
// 防止全表更新插件
interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
return interceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor in project ieasy-server by baayso.
the class MybatisPlusConfig method mybatisPlusInterceptor.
/**
* mybatis-plus 插件
* <p>
* 文档:https://baomidou.com/pages/2976a3/
* <p>
* 使用多个功能需要注意顺序关系,建议使用如下顺序<br>
* 1) 多租户,动态表名<br>
* 2) 分页,乐观锁<br>
* 3) sql 性能规范,防止全表更新与删除<br>
* 总结: 对 sql 进行单次改造的优先放入,不对 sql 进行改造的最后放入
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 防止全表更新与删除插件
interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
// 多租户插件
TenantLineInnerInterceptor tenantLineInnerInterceptor = new TenantLineInnerInterceptor();
// 行级租户SQL解析器
tenantLineInnerInterceptor.setTenantLineHandler(new BasicTenantLineHandler());
interceptor.addInnerInterceptor(tenantLineInnerInterceptor);
// 分页插件
// 如果使用了分页插件注意先 add TenantLineInnerInterceptor 再 add PaginationInnerInterceptor
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
// 乐观锁插件
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
return interceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor in project demo-SpringBoot by Max-Qiu.
the class MybatisPlusConfig method paginationInterceptor.
@Bean
public MybatisPlusInterceptor paginationInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 添加分页插件
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
// 添加 攻击 SQL 阻断解析器,防止全表更新与删除
interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
// 添加 乐观锁 插件
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
return interceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor 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;
}
Aggregations