1、重构Template,其他模块使用之前Template的也相应修改为新的Template
This commit is contained in:
@@ -76,7 +76,7 @@ public class DynamicRuleObject {
|
||||
@JsonProperty("template_id")
|
||||
@Schema(description = "策略模板id", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer templateId;
|
||||
@NotNull
|
||||
// @NotNull
|
||||
@JsonProperty("dynamic_rule_protect_level")
|
||||
@Max(value = 3)
|
||||
@Min(value = 1)
|
||||
@@ -91,7 +91,7 @@ public class DynamicRuleObject {
|
||||
// @JsonProperty("dynamic_rule_range")
|
||||
// @Schema(description = "范围", example = "北京", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
// private String dynamicRuleRange;
|
||||
@NotNull
|
||||
// @NotNull
|
||||
@JsonProperty("dynamic_rule_frequency")
|
||||
@Schema(description = "频率", example = "1", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Integer dynamicRuleFrequency;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.realtime.protection.server.rule.dynamicrule;
|
||||
|
||||
import com.realtime.protection.configuration.entity.defense.object.ProtectObject;
|
||||
import com.realtime.protection.configuration.entity.defense.template.Template;
|
||||
import com.realtime.protection.configuration.entity.defense.template.TemplateNew;
|
||||
import com.realtime.protection.configuration.entity.rule.dynamicrule.DynamicRuleObject;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -37,7 +37,7 @@ public interface DynamicRuleMapper {
|
||||
|
||||
void deleteDynamicRuleProtectObjectConcat(Integer dynamicRuleId);
|
||||
|
||||
Template queryTemplateByRuleId(Integer dynamicRuleId);
|
||||
TemplateNew queryTemplateByRuleId(Integer dynamicRuleId);
|
||||
|
||||
boolean newDynamicRulProtectObjectsConcat(Integer dynamicRuleId, List<Integer> protectObjectIds);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.realtime.protection.server.rule.dynamicrule;
|
||||
|
||||
import com.alibaba.excel.util.ListUtils;
|
||||
import com.realtime.protection.configuration.entity.defense.template.Template;
|
||||
import com.realtime.protection.configuration.entity.defense.template.TemplateNew;
|
||||
import com.realtime.protection.configuration.entity.rule.dynamicrule.DynamicRuleObject;
|
||||
import com.realtime.protection.configuration.utils.Counter;
|
||||
import com.realtime.protection.configuration.utils.SqlSessionWrapper;
|
||||
@@ -122,7 +123,7 @@ public class DynamicRuleService {
|
||||
//查询DynamicRule关联的ProtectObject
|
||||
dynamicRuleObject.setProtectObjects(dynamicRuleMapper.queryProtectObjectByRuleId(dynamicRuleId));
|
||||
//查询DynamicRule关联的template详细信息
|
||||
Template template = dynamicRuleMapper.queryTemplateByRuleId(dynamicRuleId);
|
||||
TemplateNew template = dynamicRuleMapper.queryTemplateByRuleId(dynamicRuleId);
|
||||
if (template == null){
|
||||
//template在表中删除了,需要重新设置template(感觉这种情况不多见)
|
||||
dynamicRuleObject.setDynamicRuleSourceSystem(null);
|
||||
@@ -130,6 +131,7 @@ public class DynamicRuleService {
|
||||
}else{
|
||||
dynamicRuleObject.setDynamicRuleSourceSystem(template.getSourceSystem());
|
||||
dynamicRuleObject.setDynamicRuleEventType(template.getTemplateName());
|
||||
dynamicRuleObject.setDynamicRuleProtectLevel(Integer.valueOf(template.getProtectLevel()));
|
||||
}
|
||||
|
||||
return dynamicRuleObject;
|
||||
|
||||
Reference in New Issue
Block a user