diff --git a/src/main/java/com/realtime/protection/configuration/entity/rule/dynamicrule/DynamicRuleObject.java b/src/main/java/com/realtime/protection/configuration/entity/rule/dynamicrule/DynamicRuleObject.java index 453c2ce..5273285 100644 --- a/src/main/java/com/realtime/protection/configuration/entity/rule/dynamicrule/DynamicRuleObject.java +++ b/src/main/java/com/realtime/protection/configuration/entity/rule/dynamicrule/DynamicRuleObject.java @@ -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; diff --git a/src/main/java/com/realtime/protection/server/rule/dynamicrule/DynamicRuleMapper.java b/src/main/java/com/realtime/protection/server/rule/dynamicrule/DynamicRuleMapper.java index cf01cf2..980f423 100644 --- a/src/main/java/com/realtime/protection/server/rule/dynamicrule/DynamicRuleMapper.java +++ b/src/main/java/com/realtime/protection/server/rule/dynamicrule/DynamicRuleMapper.java @@ -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 protectObjectIds); diff --git a/src/main/java/com/realtime/protection/server/rule/dynamicrule/DynamicRuleService.java b/src/main/java/com/realtime/protection/server/rule/dynamicrule/DynamicRuleService.java index d8309ac..461f048 100644 --- a/src/main/java/com/realtime/protection/server/rule/dynamicrule/DynamicRuleService.java +++ b/src/main/java/com/realtime/protection/server/rule/dynamicrule/DynamicRuleService.java @@ -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; diff --git a/src/main/resources/mappers/AlertMessageMapper.xml b/src/main/resources/mappers/AlertMessageMapper.xml index 421c5c7..71ee45d 100644 --- a/src/main/resources/mappers/AlertMessageMapper.xml +++ b/src/main/resources/mappers/AlertMessageMapper.xml @@ -28,7 +28,7 @@ - + @@ -37,6 +37,7 @@ + @@ -109,28 +110,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + SELECT COUNT(*) FROM t_dynamic_rule - left join t_strategy_template - on t_dynamic_rule.template_id = t_strategy_template.strategy_template_id + left join t_strategy_template_new + on t_dynamic_rule.template_id = t_strategy_template_new.strategy_template_id t_dynamic_rule.dynamic_rule_name like concat('%', #{dynamicRuleName}, '%') @@ -284,7 +301,7 @@ and t_dynamic_rule.dynamic_rule_id = #{dynamicRuleId} - and t_strategy_template.strategy_template_source_system = #{sourceSystem} + and t_strategy_template_new.strategy_template_source_system = #{sourceSystem} and t_dynamic_rule.dynamic_rule_create_username = #{creator} @@ -293,10 +310,10 @@ and t_dynamic_rule.audit_status = #{auditStatus} - and t_strategy_template.strategy_template_name = #{eventType} + and t_strategy_template_new.strategy_template_name = #{eventType} - and t_dynamic_rule.dynamic_rule_protect_level = #{protectLevel} + and t_strategy_template_new.protect_level = #{protectLevel} @@ -305,8 +322,8 @@ resultMap="dynamicRulePageQueryMap"> select * from t_dynamic_rule - left join t_strategy_template - on t_dynamic_rule.template_id = t_strategy_template.strategy_template_id + left join t_strategy_template_new + on t_dynamic_rule.template_id = t_strategy_template_new.strategy_template_id where dynamic_rule_id in #{id} diff --git a/src/main/resources/mappers/TaskMapper.xml b/src/main/resources/mappers/TaskMapper.xml index 0184f36..ba6a303 100644 --- a/src/main/resources/mappers/TaskMapper.xml +++ b/src/main/resources/mappers/TaskMapper.xml @@ -354,8 +354,8 @@ task_start_time, task_end_time, tdr.dynamic_rule_id as rule_id, - strategy_template_source_system as source_system, - strategy_template_name as event_type, + tst.strategy_template_source_system as source_system, + tst.event_type as event_type, tdr.log_rule_id, INET_NTOA(protect_object_ip) as protect_object_ip, protect_object_port, @@ -366,7 +366,7 @@ LEFT JOIN realtime_protection.t_protect_object_dynamic_rule_conn tpodrc on tdr.dynamic_rule_id = tpodrc.dynamic_rule_id LEFT JOIN realtime_protection.t_protect_object tpo on tpo.protect_object_id = tpodrc.protect_object_id - LEFT JOIN realtime_protection.t_strategy_template tst on tdr.template_id = tst.strategy_template_id + LEFT JOIN realtime_protection.t_strategy_template_new tst on tdr.template_id = tst.strategy_template_id WHERE task_id = #{task_id}