mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-08 16:57:09 +08:00
feat(data/mybatis-plus): 新增防全表更新与删除插件启用配置
This commit is contained in:
@@ -59,6 +59,11 @@ public class MyBatisPlusExtensionProperties {
|
||||
*/
|
||||
private PaginationProperties pagination;
|
||||
|
||||
/**
|
||||
* 启用防全表更新与删除插件
|
||||
*/
|
||||
private boolean blockAttackPluginEnabled = true;
|
||||
|
||||
/**
|
||||
* 数据权限插件配置属性
|
||||
*/
|
||||
@@ -175,4 +180,12 @@ public class MyBatisPlusExtensionProperties {
|
||||
public void setPagination(PaginationProperties pagination) {
|
||||
this.pagination = pagination;
|
||||
}
|
||||
|
||||
public boolean isBlockAttackPluginEnabled() {
|
||||
return blockAttackPluginEnabled;
|
||||
}
|
||||
|
||||
public void setBlockAttackPluginEnabled(boolean blockAttackPluginEnabled) {
|
||||
this.blockAttackPluginEnabled = blockAttackPluginEnabled;
|
||||
}
|
||||
}
|
||||
|
@@ -77,7 +77,9 @@ public class MybatisPlusAutoConfiguration {
|
||||
interceptor.addInnerInterceptor(this.paginationInnerInterceptor(paginationProperties));
|
||||
}
|
||||
// 防全表更新与删除插件
|
||||
interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
|
||||
if (properties.isBlockAttackPluginEnabled()) {
|
||||
interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
|
||||
}
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user