diff --git a/src/main/java/com/realtime/protection/configuration/entity/defense/object/ProtectObject.java b/src/main/java/com/realtime/protection/configuration/entity/defense/object/ProtectObject.java index c202d99..3a5a250 100644 --- a/src/main/java/com/realtime/protection/configuration/entity/defense/object/ProtectObject.java +++ b/src/main/java/com/realtime/protection/configuration/entity/defense/object/ProtectObject.java @@ -10,6 +10,8 @@ import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Pattern; import lombok.Data; +import java.time.LocalDateTime; + @Data public class ProtectObject { @JsonProperty("proobj_id") @@ -88,4 +90,12 @@ public class ProtectObject { @JsonProperty("audit_user_depart") @Schema(description = "审核用户部门", example = "部门1") private String auditUserDepart; + + @JsonProperty("create_time") + @Schema(description = "创建时间", example = "") + private LocalDateTime createTime; + + @JsonProperty("modify_time") + @Schema(description = "修改时间", example = "") + private LocalDateTime modifyTime; } diff --git a/src/main/java/com/realtime/protection/configuration/entity/whitelist/WhiteListObject.java b/src/main/java/com/realtime/protection/configuration/entity/whitelist/WhiteListObject.java index c71566f..512846d 100644 --- a/src/main/java/com/realtime/protection/configuration/entity/whitelist/WhiteListObject.java +++ b/src/main/java/com/realtime/protection/configuration/entity/whitelist/WhiteListObject.java @@ -10,6 +10,8 @@ import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Pattern; import lombok.Data; +import java.time.LocalDateTime; + @Data public class WhiteListObject { @JsonProperty("whiteobj_id") @@ -88,4 +90,10 @@ public class WhiteListObject { @Schema(description = "审核用户部门", example = "部门1") private String auditUserDepart; + @JsonProperty("create_time") + @Schema(description = "创建时间", example = "") + private LocalDateTime createTime; + @JsonProperty("modify_time") + @Schema(description = "修改时间", example = "") + private LocalDateTime modifyTime; } diff --git a/src/main/resources/mappers/ProtectObjectMapper.xml b/src/main/resources/mappers/ProtectObjectMapper.xml index bb365e8..3f0773f 100644 --- a/src/main/resources/mappers/ProtectObjectMapper.xml +++ b/src/main/resources/mappers/ProtectObjectMapper.xml @@ -10,12 +10,14 @@ protect_object_ip, protect_object_port, protect_object_url, protect_object_protocol, protect_object_create_username, protect_object_create_depart, - protect_object_create_user_id, protect_object_display_id) + protect_object_create_user_id, protect_object_display_id + ,create_time, modify_time) VALUE (#{proobj.protectObjectId}, #{proobj.protectObjectName}, #{proobj.protectObjectSystemName}, INET_ATON(#{proobj.protectObjectIPAddress}), #{proobj.protectObjectPort}, #{proobj.protectObjectURL}, #{proobj.protectObjectProtocol}, #{proobj.protectObjectCreateUsername}, #{proobj.protectObjectCreateDepart}, - #{proobj.protectObjectCreateUserId}, #{proobj.protectObjectDisplayId}) + #{proobj.protectObjectCreateUserId}, #{proobj.protectObjectDisplayId}, + NOW(), NOW()) @@ -23,14 +25,14 @@ protect_object_ip, protect_object_port, protect_object_url, protect_object_protocol, protect_object_create_username, protect_object_create_depart, - protect_object_create_user_id, protect_object_display_id) + protect_object_create_user_id, protect_object_display_id, create_time, modify_time) VALUES (#{proobj.protectObjectId}, #{proobj.protectObjectName}, #{proobj.protectObjectSystemName}, INET_ATON(#{proobj.protectObjectIPAddress}), #{proobj.protectObjectPort}, #{proobj.protectObjectURL}, #{proobj.protectObjectProtocol}, #{proobj.protectObjectCreateUsername}, #{proobj.protectObjectCreateDepart}, - #{proobj.protectObjectCreateUserId}, #{proobj.protectObjectDisplayId}) + #{proobj.protectObjectCreateUserId}, #{proobj.protectObjectDisplayId}, NOW(), NOW() @@ -131,6 +133,7 @@ + @@ -138,6 +141,16 @@ + + + + + + + + + + diff --git a/src/main/resources/mappers/WhiteListMapper.xml b/src/main/resources/mappers/WhiteListMapper.xml index 709f454..866835a 100644 --- a/src/main/resources/mappers/WhiteListMapper.xml +++ b/src/main/resources/mappers/WhiteListMapper.xml @@ -146,6 +146,14 @@ + + + + + + + + @@ -173,7 +181,7 @@ diff --git a/src/test/java/com/realtime/protection/server/defense/object/ProtectObjectServiceTest.java b/src/test/java/com/realtime/protection/server/defense/object/ProtectObjectServiceTest.java index 3a7c35d..2b8095b 100644 --- a/src/test/java/com/realtime/protection/server/defense/object/ProtectObjectServiceTest.java +++ b/src/test/java/com/realtime/protection/server/defense/object/ProtectObjectServiceTest.java @@ -56,6 +56,16 @@ class ProtectObjectServiceTest extends ProtectionApplicationTests { // Boolean success = protectObjectService.newProtectObjects(protectObjects); // assertTrue(success); } + @Test + void queryProtectObjectByid() { + + protectObjectService.newProtectObject(protectObject); + + System.out.println(protectObjectService.queryProtectObject(protectObject.getProtectObjectId())); + + + } + @Test void queryProtectObject() { diff --git a/src/test/java/com/realtime/protection/server/whitelist/WhiteListServiceTest.java b/src/test/java/com/realtime/protection/server/whitelist/WhiteListServiceTest.java index 5e5a5b6..db8168d 100644 --- a/src/test/java/com/realtime/protection/server/whitelist/WhiteListServiceTest.java +++ b/src/test/java/com/realtime/protection/server/whitelist/WhiteListServiceTest.java @@ -141,6 +141,13 @@ class WhiteListServiceTest extends ProtectionApplicationTests { List whiteListObjects = whiteListService.queryWhiteListObject(null, null, null, null, null, 1, 2); System.out.println(whiteListObjects); } + @Test + void testQueryWhiteListObjectbyid() { + List whiteListObjects = whiteListService.queryWhiteListObject(null, null, null, null, null, 1, 2); + System.out.println( + whiteListService.queryWhiteListObjectById( + whiteListObjects.get(0).getWhiteListId())); + } @Test void testUpdateAuditStatusByIdBatch() {