1、AlertMessage实体类增加content字段,并同步mapper中新增、查询方法增加content字段

2、DynamicRuleObject实体类新增log_rule_id属性,并同步mapper中新增、查询方法增加log_rule_id字段
3、StaticRule新建增加ip、maskip是否匹配的判断,批量新建和更新还没增加。
This commit is contained in:
Hao Miao
2024-01-29 23:41:13 +08:00
parent e48f837b64
commit 1be5269d1d
11 changed files with 129 additions and 61 deletions

View File

@@ -26,8 +26,6 @@ public class DynamicRuleService {
@Transactional
public Integer newDynamicRuleObject(DynamicRuleObject dynamicRule) {
dynamicRuleMapper.newDynamicRule(dynamicRule);
//判断protectObject id是否有效
boolean ProtectObjIdValid = dynamicRule.getProtectObjectIds().stream()
.allMatch(
@@ -36,6 +34,8 @@ public class DynamicRuleService {
if (!ProtectObjIdValid) {
throw new IllegalArgumentException("protect object id is invalid");
}
dynamicRuleMapper.newDynamicRule(dynamicRule);
Integer dynamicRuleId = dynamicRule.getDynamicRuleId();
dynamicRule.getProtectObjectIds().forEach(
protectObjectId -> dynamicRuleMapper.newDynamicRulProtectObjectConcat(dynamicRuleId, protectObjectId));
@@ -104,9 +104,10 @@ public class DynamicRuleService {
//template在表中删除了需要重新设置template感觉这种情况不多见
dynamicRuleObject.setDynamicRuleSourceSystem("need reset");
dynamicRuleObject.setDynamicRuleEventType("need reset");
}
}else{
dynamicRuleObject.setDynamicRuleSourceSystem(template.getSourceSystem());
dynamicRuleObject.setDynamicRuleEventType(template.getTemplateName());
}
return dynamicRuleObject;
}