From c76e08145152b48743a03d30f9ec348ce83031aa Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Thu, 11 Jan 2024 20:06:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B):=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E8=AF=84=E8=AE=BA=E5=89=AF?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/FunctionalCaseAttachment.java | 34 ++-- .../FunctionalCaseAttachmentExample.java | 70 +++++++++ .../mapper/FunctionalCaseAttachmentMapper.xml | 38 ++++- .../3.0.0/ddl/V3.0.0_10__functional_case.sql | 2 + .../sdk/constants/DefaultRepositoryDir.java | 5 + .../metersphere/sdk/file/FileRepository.java | 7 + .../metersphere/sdk/file/GitRepository.java | 5 + .../sdk/file/LocalFileRepository.java | 6 + .../metersphere/sdk/file/MinioRepository.java | 10 ++ .../constants/CaseFileSourceType.java | 11 ++ .../FunctionalCaseAttachmentController.java | 7 + .../request/FunctionalCaseCommentRequest.java | 13 ++ .../FunctionalCaseAttachmentService.java | 148 +++++++++++++++++- .../service/FunctionalCaseCommentService.java | 10 ++ ...nctionalCaseAttachmentControllerTests.java | 75 ++++++++- 15 files changed, 408 insertions(+), 33 deletions(-) create mode 100644 backend/services/case-management/src/main/java/io/metersphere/functional/constants/CaseFileSourceType.java diff --git a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseAttachment.java b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseAttachment.java index 8fe8b18142..3e1962fd5b 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseAttachment.java +++ b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseAttachment.java @@ -1,10 +1,8 @@ package io.metersphere.functional.domain; -import io.metersphere.validation.groups.Created; -import io.metersphere.validation.groups.Updated; +import io.metersphere.validation.groups.*; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; +import jakarta.validation.constraints.*; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; @@ -12,40 +10,43 @@ import lombok.Data; @Data public class FunctionalCaseAttachment implements Serializable { - @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{functional_case_attachment.id.not_blank}", groups = {Updated.class}) @Size(min = 1, max = 50, message = "{functional_case_attachment.id.length_range}", groups = {Created.class, Updated.class}) private String id; - @Schema(description = "功能用例ID", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "功能用例ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{functional_case_attachment.case_id.not_blank}", groups = {Created.class}) @Size(min = 1, max = 50, message = "{functional_case_attachment.case_id.length_range}", groups = {Created.class, Updated.class}) private String caseId; - @Schema(description = "文件的ID", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "文件的ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{functional_case_attachment.file_id.not_blank}", groups = {Created.class}) @Size(min = 1, max = 50, message = "{functional_case_attachment.file_id.length_range}", groups = {Created.class, Updated.class}) private String fileId; - @Schema(description = "文件名称", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "文件名称", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{functional_case_attachment.file_name.not_blank}", groups = {Created.class}) @Size(min = 1, max = 255, message = "{functional_case_attachment.file_name.length_range}", groups = {Created.class, Updated.class}) private String fileName; - @Schema(description = "文件大小", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{functional_case_attachment.size.not_blank}", groups = {Created.class}) - @Size(min = 1, max = 19, message = "{functional_case_attachment.size.length_range}", groups = {Created.class, Updated.class}) + @Schema(description = "文件来源", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{functional_case_attachment.file_source.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{functional_case_attachment.file_source.length_range}", groups = {Created.class, Updated.class}) + private String fileSource; + + @Schema(description = "文件大小", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{functional_case_attachment.size.not_blank}", groups = {Created.class}) private Long size; - @Schema(description = "是否本地", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{functional_case_attachment.local.not_blank}", groups = {Created.class}) - @Size(min = 1, max = 1, message = "{functional_case_attachment.local.length_range}", groups = {Created.class, Updated.class}) + @Schema(description = "是否本地", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{functional_case_attachment.local.not_blank}", groups = {Created.class}) private Boolean local; - @Schema(description = "创建人") + @Schema(description = "创建人") private String createUser; - @Schema(description = "创建时间") + @Schema(description = "创建时间") private Long createTime; private static final long serialVersionUID = 1L; @@ -55,6 +56,7 @@ public class FunctionalCaseAttachment implements Serializable { caseId("case_id", "caseId", "VARCHAR", false), fileId("file_id", "fileId", "VARCHAR", false), fileName("file_name", "fileName", "VARCHAR", false), + fileSource("file_source", "fileSource", "VARCHAR", false), size("size", "size", "BIGINT", true), local("local", "local", "BIT", true), createUser("create_user", "createUser", "VARCHAR", false), diff --git a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseAttachmentExample.java b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseAttachmentExample.java index c8394f86b9..3d4f5bd7a3 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseAttachmentExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/functional/domain/FunctionalCaseAttachmentExample.java @@ -384,6 +384,76 @@ public class FunctionalCaseAttachmentExample { return (Criteria) this; } + public Criteria andFileSourceIsNull() { + addCriterion("file_source is null"); + return (Criteria) this; + } + + public Criteria andFileSourceIsNotNull() { + addCriterion("file_source is not null"); + return (Criteria) this; + } + + public Criteria andFileSourceEqualTo(String value) { + addCriterion("file_source =", value, "fileSource"); + return (Criteria) this; + } + + public Criteria andFileSourceNotEqualTo(String value) { + addCriterion("file_source <>", value, "fileSource"); + return (Criteria) this; + } + + public Criteria andFileSourceGreaterThan(String value) { + addCriterion("file_source >", value, "fileSource"); + return (Criteria) this; + } + + public Criteria andFileSourceGreaterThanOrEqualTo(String value) { + addCriterion("file_source >=", value, "fileSource"); + return (Criteria) this; + } + + public Criteria andFileSourceLessThan(String value) { + addCriterion("file_source <", value, "fileSource"); + return (Criteria) this; + } + + public Criteria andFileSourceLessThanOrEqualTo(String value) { + addCriterion("file_source <=", value, "fileSource"); + return (Criteria) this; + } + + public Criteria andFileSourceLike(String value) { + addCriterion("file_source like", value, "fileSource"); + return (Criteria) this; + } + + public Criteria andFileSourceNotLike(String value) { + addCriterion("file_source not like", value, "fileSource"); + return (Criteria) this; + } + + public Criteria andFileSourceIn(List values) { + addCriterion("file_source in", values, "fileSource"); + return (Criteria) this; + } + + public Criteria andFileSourceNotIn(List values) { + addCriterion("file_source not in", values, "fileSource"); + return (Criteria) this; + } + + public Criteria andFileSourceBetween(String value1, String value2) { + addCriterion("file_source between", value1, value2, "fileSource"); + return (Criteria) this; + } + + public Criteria andFileSourceNotBetween(String value1, String value2) { + addCriterion("file_source not between", value1, value2, "fileSource"); + return (Criteria) this; + } + public Criteria andSizeIsNull() { addCriterion("`size` is null"); return (Criteria) this; diff --git a/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/FunctionalCaseAttachmentMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/FunctionalCaseAttachmentMapper.xml index 6134d7579b..0773748326 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/FunctionalCaseAttachmentMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/functional/mapper/FunctionalCaseAttachmentMapper.xml @@ -6,6 +6,7 @@ + @@ -70,7 +71,7 @@ - id, case_id, file_id, file_name, `size`, `local`, create_user, create_time + id, case_id, file_id, file_name, file_source, `size`, `local`, create_user, create_time