From e24437d4bbfd4094c9f4fe2a71f80e9f8a46791f Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Mon, 30 Oct 2023 18:36:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A1=B9=E7=9B=AE=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86=E5=A2=9E=E5=8A=A0jar?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=BC=80=E5=90=AF/=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/domain/FileMetadata.java | 14 ++-- .../project/domain/FileMetadataExample.java | 60 ++++++++++++++ .../project/mapper/FileMetadataMapper.xml | 31 ++++++-- .../ddl/V3.0.0_4__project_management.sql | 1 + .../main/resources/i18n/project.properties | 2 + .../resources/i18n/project_en_US.properties | 2 + .../resources/i18n/project_zh_CN.properties | 2 + .../resources/i18n/project_zh_TW.properties | 2 + .../controller/FileManagementController.java | 8 +- .../project/mapper/ExtFileMetadataMapper.xml | 1 + .../filemanagement/FileUpdateRequest.java | 3 + .../service/FileManagementService.java | 15 ++-- .../service/FileMetadataLogService.java | 21 ++++- .../project/service/FileMetadataService.java | 25 ++++++ .../main/resources/projectGeneratorConfig.xml | 30 +++---- .../FileManagementControllerTests.java | 78 ++++++++++++++++++- ...leManagementPermissionControllerTests.java | 37 +++++++-- .../utils/FileManagementRequestUtils.java | 6 +- .../src/test/resources/file/test-jar.jar | 1 + 19 files changed, 290 insertions(+), 49 deletions(-) create mode 100644 backend/services/project-management/src/test/resources/file/test-jar.jar diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileMetadata.java b/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileMetadata.java index 54a592aa4b..20db7dfe7e 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileMetadata.java +++ b/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileMetadata.java @@ -1,16 +1,12 @@ package io.metersphere.project.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.NotNull; -import jakarta.validation.constraints.Size; -import lombok.Data; - +import jakarta.validation.constraints.*; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; +import lombok.Data; @Data public class FileMetadata implements Serializable { @@ -69,6 +65,9 @@ public class FileMetadata implements Serializable { @NotNull(message = "{file_metadata.latest.not_blank}", groups = {Created.class}) private Boolean latest; + @Schema(description = "启用/禁用;启用禁用(一般常用于jar文件)") + private Boolean enable; + @Schema(description = "同版本数据关联的ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{file_metadata.ref_id.not_blank}", groups = {Created.class}) @Size(min = 1, max = 50, message = "{file_metadata.ref_id.length_range}", groups = {Created.class, Updated.class}) @@ -95,6 +94,7 @@ public class FileMetadata implements Serializable { moduleId("module_id", "moduleId", "VARCHAR", false), path("path", "path", "VARCHAR", true), latest("latest", "latest", "BIT", false), + enable("enable", "enable", "BIT", true), refId("ref_id", "refId", "VARCHAR", false), fileVersion("file_version", "fileVersion", "VARCHAR", false); diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileMetadataExample.java b/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileMetadataExample.java index 795408dec2..d0fd3b2b9e 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileMetadataExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileMetadataExample.java @@ -1114,6 +1114,66 @@ public class FileMetadataExample { return (Criteria) this; } + public Criteria andEnableIsNull() { + addCriterion("`enable` is null"); + return (Criteria) this; + } + + public Criteria andEnableIsNotNull() { + addCriterion("`enable` is not null"); + return (Criteria) this; + } + + public Criteria andEnableEqualTo(Boolean value) { + addCriterion("`enable` =", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotEqualTo(Boolean value) { + addCriterion("`enable` <>", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableGreaterThan(Boolean value) { + addCriterion("`enable` >", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableGreaterThanOrEqualTo(Boolean value) { + addCriterion("`enable` >=", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableLessThan(Boolean value) { + addCriterion("`enable` <", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableLessThanOrEqualTo(Boolean value) { + addCriterion("`enable` <=", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableIn(List values) { + addCriterion("`enable` in", values, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotIn(List values) { + addCriterion("`enable` not in", values, "enable"); + return (Criteria) this; + } + + public Criteria andEnableBetween(Boolean value1, Boolean value2) { + addCriterion("`enable` between", value1, value2, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotBetween(Boolean value1, Boolean value2) { + addCriterion("`enable` not between", value1, value2, "enable"); + return (Criteria) this; + } + public Criteria andRefIdIsNull() { addCriterion("ref_id is null"); return (Criteria) this; diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileMetadataMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileMetadataMapper.xml index 139ac157c2..2af30b5174 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileMetadataMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileMetadataMapper.xml @@ -17,6 +17,7 @@ + @@ -80,7 +81,7 @@ id, `name`, `type`, `size`, create_time, update_time, project_id, `storage`, create_user, - update_user, tags, description, module_id, `path`, latest, ref_id, file_version + update_user, tags, description, module_id, `path`, latest, `enable`, ref_id, file_version