From 22ad3f3a855b9fcebbdd2abd5daa76594292deae Mon Sep 17 00:00:00 2001 From: song-tianyang Date: Wed, 8 Nov 2023 17:34:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E5=BA=93=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/domain/FileAssociation.java | 142 +++ .../domain/FileAssociationExample.java | 950 ++++++++++++++++++ .../project/mapper/FileAssociationMapper.java | 34 + .../project/mapper/FileAssociationMapper.xml | 365 +++++++ .../ddl/V3.0.0_4__project_management.sql | 31 +- .../main/resources/i18n/project.properties | 4 + .../resources/i18n/project_en_US.properties | 4 + .../resources/i18n/project_zh_CN.properties | 4 + .../resources/i18n/project_zh_TW.properties | 82 +- .../controller/FileRepositoryController.java | 8 + .../response/FileInformationResponse.java | 4 + .../response/FileRepositoryResponse.java | 38 + .../project/mapper/ExtFileMetadataMapper.xml | 1 + .../service/FileRepositoryService.java | 10 + .../FileManagementControllerTests.java | 4 + .../FileRepositoryControllerTest.java | 33 + .../utils/FileManagementRequestUtils.java | 2 + 17 files changed, 1665 insertions(+), 51 deletions(-) create mode 100644 backend/framework/domain/src/main/java/io/metersphere/project/domain/FileAssociation.java create mode 100644 backend/framework/domain/src/main/java/io/metersphere/project/domain/FileAssociationExample.java create mode 100644 backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileAssociationMapper.java create mode 100644 backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileAssociationMapper.xml create mode 100644 backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/response/FileRepositoryResponse.java diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileAssociation.java b/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileAssociation.java new file mode 100644 index 0000000000..caf04e9f0a --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileAssociation.java @@ -0,0 +1,142 @@ +package io.metersphere.project.domain; + +import io.metersphere.validation.groups.*; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import lombok.Data; + +@Data +public class FileAssociation implements Serializable { + @Schema(description = "", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{file_association.id.not_blank}", groups = {Updated.class}) + @Size(min = 1, max = 50, message = "{file_association.id.length_range}", groups = {Created.class, Updated.class}) + private String id; + + @Schema(description = "多用于场景步骤内具体的步骤ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{file_association.source_item_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{file_association.source_item_id.length_range}", groups = {Created.class, Updated.class}) + private String sourceItemId; + + @Schema(description = "资源类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{file_association.source_type.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{file_association.source_type.length_range}", groups = {Created.class, Updated.class}) + private String sourceType; + + @Schema(description = "资源ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{file_association.source_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{file_association.source_id.length_range}", groups = {Created.class, Updated.class}) + private String sourceId; + + @Schema(description = "文件ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{file_association.file_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{file_association.file_id.length_range}", groups = {Created.class, Updated.class}) + private String fileId; + + @Schema(description = "文件同版本ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{file_association.file_ref_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{file_association.file_ref_id.length_range}", groups = {Created.class, Updated.class}) + private String fileRefId; + + @Schema(description = "文件版本", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{file_association.file_version.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{file_association.file_version.length_range}", groups = {Created.class, Updated.class}) + private String fileVersion; + + @Schema(description = "创建时间") + private Long createTime; + + @Schema(description = "修改人") + private String updateUser; + + @Schema(description = "更新时间") + private Long updateTime; + + @Schema(description = "创建人") + private String createUser; + + private static final long serialVersionUID = 1L; + + public enum Column { + id("id", "id", "VARCHAR", false), + sourceItemId("source_item_id", "sourceItemId", "VARCHAR", false), + sourceType("source_type", "sourceType", "VARCHAR", false), + sourceId("source_id", "sourceId", "VARCHAR", false), + fileId("file_id", "fileId", "VARCHAR", false), + fileRefId("file_ref_id", "fileRefId", "VARCHAR", false), + fileVersion("file_version", "fileVersion", "VARCHAR", false), + createTime("create_time", "createTime", "BIGINT", false), + updateUser("update_user", "updateUser", "VARCHAR", false), + updateTime("update_time", "updateTime", "BIGINT", false), + createUser("create_user", "createUser", "VARCHAR", false); + + private static final String BEGINNING_DELIMITER = "`"; + + private static final String ENDING_DELIMITER = "`"; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileAssociationExample.java b/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileAssociationExample.java new file mode 100644 index 0000000000..d6a2d5a726 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/project/domain/FileAssociationExample.java @@ -0,0 +1,950 @@ +package io.metersphere.project.domain; + +import java.util.ArrayList; +import java.util.List; + +public class FileAssociationExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public FileAssociationExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(String value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(String value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(String value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(String value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(String value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(String value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLike(String value) { + addCriterion("id like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotLike(String value) { + addCriterion("id not like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(String value1, String value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(String value1, String value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andSourceItemIdIsNull() { + addCriterion("source_item_id is null"); + return (Criteria) this; + } + + public Criteria andSourceItemIdIsNotNull() { + addCriterion("source_item_id is not null"); + return (Criteria) this; + } + + public Criteria andSourceItemIdEqualTo(String value) { + addCriterion("source_item_id =", value, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceItemIdNotEqualTo(String value) { + addCriterion("source_item_id <>", value, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceItemIdGreaterThan(String value) { + addCriterion("source_item_id >", value, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceItemIdGreaterThanOrEqualTo(String value) { + addCriterion("source_item_id >=", value, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceItemIdLessThan(String value) { + addCriterion("source_item_id <", value, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceItemIdLessThanOrEqualTo(String value) { + addCriterion("source_item_id <=", value, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceItemIdLike(String value) { + addCriterion("source_item_id like", value, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceItemIdNotLike(String value) { + addCriterion("source_item_id not like", value, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceItemIdIn(List values) { + addCriterion("source_item_id in", values, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceItemIdNotIn(List values) { + addCriterion("source_item_id not in", values, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceItemIdBetween(String value1, String value2) { + addCriterion("source_item_id between", value1, value2, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceItemIdNotBetween(String value1, String value2) { + addCriterion("source_item_id not between", value1, value2, "sourceItemId"); + return (Criteria) this; + } + + public Criteria andSourceTypeIsNull() { + addCriterion("source_type is null"); + return (Criteria) this; + } + + public Criteria andSourceTypeIsNotNull() { + addCriterion("source_type is not null"); + return (Criteria) this; + } + + public Criteria andSourceTypeEqualTo(String value) { + addCriterion("source_type =", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeNotEqualTo(String value) { + addCriterion("source_type <>", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeGreaterThan(String value) { + addCriterion("source_type >", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeGreaterThanOrEqualTo(String value) { + addCriterion("source_type >=", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeLessThan(String value) { + addCriterion("source_type <", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeLessThanOrEqualTo(String value) { + addCriterion("source_type <=", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeLike(String value) { + addCriterion("source_type like", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeNotLike(String value) { + addCriterion("source_type not like", value, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeIn(List values) { + addCriterion("source_type in", values, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeNotIn(List values) { + addCriterion("source_type not in", values, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeBetween(String value1, String value2) { + addCriterion("source_type between", value1, value2, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceTypeNotBetween(String value1, String value2) { + addCriterion("source_type not between", value1, value2, "sourceType"); + return (Criteria) this; + } + + public Criteria andSourceIdIsNull() { + addCriterion("source_id is null"); + return (Criteria) this; + } + + public Criteria andSourceIdIsNotNull() { + addCriterion("source_id is not null"); + return (Criteria) this; + } + + public Criteria andSourceIdEqualTo(String value) { + addCriterion("source_id =", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdNotEqualTo(String value) { + addCriterion("source_id <>", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdGreaterThan(String value) { + addCriterion("source_id >", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdGreaterThanOrEqualTo(String value) { + addCriterion("source_id >=", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdLessThan(String value) { + addCriterion("source_id <", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdLessThanOrEqualTo(String value) { + addCriterion("source_id <=", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdLike(String value) { + addCriterion("source_id like", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdNotLike(String value) { + addCriterion("source_id not like", value, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdIn(List values) { + addCriterion("source_id in", values, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdNotIn(List values) { + addCriterion("source_id not in", values, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdBetween(String value1, String value2) { + addCriterion("source_id between", value1, value2, "sourceId"); + return (Criteria) this; + } + + public Criteria andSourceIdNotBetween(String value1, String value2) { + addCriterion("source_id not between", value1, value2, "sourceId"); + return (Criteria) this; + } + + public Criteria andFileIdIsNull() { + addCriterion("file_id is null"); + return (Criteria) this; + } + + public Criteria andFileIdIsNotNull() { + addCriterion("file_id is not null"); + return (Criteria) this; + } + + public Criteria andFileIdEqualTo(String value) { + addCriterion("file_id =", value, "fileId"); + return (Criteria) this; + } + + public Criteria andFileIdNotEqualTo(String value) { + addCriterion("file_id <>", value, "fileId"); + return (Criteria) this; + } + + public Criteria andFileIdGreaterThan(String value) { + addCriterion("file_id >", value, "fileId"); + return (Criteria) this; + } + + public Criteria andFileIdGreaterThanOrEqualTo(String value) { + addCriterion("file_id >=", value, "fileId"); + return (Criteria) this; + } + + public Criteria andFileIdLessThan(String value) { + addCriterion("file_id <", value, "fileId"); + return (Criteria) this; + } + + public Criteria andFileIdLessThanOrEqualTo(String value) { + addCriterion("file_id <=", value, "fileId"); + return (Criteria) this; + } + + public Criteria andFileIdLike(String value) { + addCriterion("file_id like", value, "fileId"); + return (Criteria) this; + } + + public Criteria andFileIdNotLike(String value) { + addCriterion("file_id not like", value, "fileId"); + return (Criteria) this; + } + + public Criteria andFileIdIn(List values) { + addCriterion("file_id in", values, "fileId"); + return (Criteria) this; + } + + public Criteria andFileIdNotIn(List values) { + addCriterion("file_id not in", values, "fileId"); + return (Criteria) this; + } + + public Criteria andFileIdBetween(String value1, String value2) { + addCriterion("file_id between", value1, value2, "fileId"); + return (Criteria) this; + } + + public Criteria andFileIdNotBetween(String value1, String value2) { + addCriterion("file_id not between", value1, value2, "fileId"); + return (Criteria) this; + } + + public Criteria andFileRefIdIsNull() { + addCriterion("file_ref_id is null"); + return (Criteria) this; + } + + public Criteria andFileRefIdIsNotNull() { + addCriterion("file_ref_id is not null"); + return (Criteria) this; + } + + public Criteria andFileRefIdEqualTo(String value) { + addCriterion("file_ref_id =", value, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileRefIdNotEqualTo(String value) { + addCriterion("file_ref_id <>", value, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileRefIdGreaterThan(String value) { + addCriterion("file_ref_id >", value, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileRefIdGreaterThanOrEqualTo(String value) { + addCriterion("file_ref_id >=", value, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileRefIdLessThan(String value) { + addCriterion("file_ref_id <", value, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileRefIdLessThanOrEqualTo(String value) { + addCriterion("file_ref_id <=", value, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileRefIdLike(String value) { + addCriterion("file_ref_id like", value, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileRefIdNotLike(String value) { + addCriterion("file_ref_id not like", value, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileRefIdIn(List values) { + addCriterion("file_ref_id in", values, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileRefIdNotIn(List values) { + addCriterion("file_ref_id not in", values, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileRefIdBetween(String value1, String value2) { + addCriterion("file_ref_id between", value1, value2, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileRefIdNotBetween(String value1, String value2) { + addCriterion("file_ref_id not between", value1, value2, "fileRefId"); + return (Criteria) this; + } + + public Criteria andFileVersionIsNull() { + addCriterion("file_version is null"); + return (Criteria) this; + } + + public Criteria andFileVersionIsNotNull() { + addCriterion("file_version is not null"); + return (Criteria) this; + } + + public Criteria andFileVersionEqualTo(String value) { + addCriterion("file_version =", value, "fileVersion"); + return (Criteria) this; + } + + public Criteria andFileVersionNotEqualTo(String value) { + addCriterion("file_version <>", value, "fileVersion"); + return (Criteria) this; + } + + public Criteria andFileVersionGreaterThan(String value) { + addCriterion("file_version >", value, "fileVersion"); + return (Criteria) this; + } + + public Criteria andFileVersionGreaterThanOrEqualTo(String value) { + addCriterion("file_version >=", value, "fileVersion"); + return (Criteria) this; + } + + public Criteria andFileVersionLessThan(String value) { + addCriterion("file_version <", value, "fileVersion"); + return (Criteria) this; + } + + public Criteria andFileVersionLessThanOrEqualTo(String value) { + addCriterion("file_version <=", value, "fileVersion"); + return (Criteria) this; + } + + public Criteria andFileVersionLike(String value) { + addCriterion("file_version like", value, "fileVersion"); + return (Criteria) this; + } + + public Criteria andFileVersionNotLike(String value) { + addCriterion("file_version not like", value, "fileVersion"); + return (Criteria) this; + } + + public Criteria andFileVersionIn(List values) { + addCriterion("file_version in", values, "fileVersion"); + return (Criteria) this; + } + + public Criteria andFileVersionNotIn(List values) { + addCriterion("file_version not in", values, "fileVersion"); + return (Criteria) this; + } + + public Criteria andFileVersionBetween(String value1, String value2) { + addCriterion("file_version between", value1, value2, "fileVersion"); + return (Criteria) this; + } + + public Criteria andFileVersionNotBetween(String value1, String value2) { + addCriterion("file_version not between", value1, value2, "fileVersion"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Long value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Long value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Long value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Long value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Long value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Long value1, Long value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Long value1, Long value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateUserIsNull() { + addCriterion("update_user is null"); + return (Criteria) this; + } + + public Criteria andUpdateUserIsNotNull() { + addCriterion("update_user is not null"); + return (Criteria) this; + } + + public Criteria andUpdateUserEqualTo(String value) { + addCriterion("update_user =", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotEqualTo(String value) { + addCriterion("update_user <>", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserGreaterThan(String value) { + addCriterion("update_user >", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserGreaterThanOrEqualTo(String value) { + addCriterion("update_user >=", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserLessThan(String value) { + addCriterion("update_user <", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserLessThanOrEqualTo(String value) { + addCriterion("update_user <=", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserLike(String value) { + addCriterion("update_user like", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotLike(String value) { + addCriterion("update_user not like", value, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserIn(List values) { + addCriterion("update_user in", values, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotIn(List values) { + addCriterion("update_user not in", values, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserBetween(String value1, String value2) { + addCriterion("update_user between", value1, value2, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateUserNotBetween(String value1, String value2) { + addCriterion("update_user not between", value1, value2, "updateUser"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Long value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Long value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Long value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Long value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Long value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Long value1, Long value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Long value1, Long value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNull() { + addCriterion("create_user is null"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNotNull() { + addCriterion("create_user is not null"); + return (Criteria) this; + } + + public Criteria andCreateUserEqualTo(String value) { + addCriterion("create_user =", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotEqualTo(String value) { + addCriterion("create_user <>", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThan(String value) { + addCriterion("create_user >", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThanOrEqualTo(String value) { + addCriterion("create_user >=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThan(String value) { + addCriterion("create_user <", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThanOrEqualTo(String value) { + addCriterion("create_user <=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLike(String value) { + addCriterion("create_user like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotLike(String value) { + addCriterion("create_user not like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserIn(List values) { + addCriterion("create_user in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotIn(List values) { + addCriterion("create_user not in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserBetween(String value1, String value2) { + addCriterion("create_user between", value1, value2, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotBetween(String value1, String value2) { + addCriterion("create_user not between", value1, value2, "createUser"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileAssociationMapper.java b/backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileAssociationMapper.java new file mode 100644 index 0000000000..6edfb40aa5 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileAssociationMapper.java @@ -0,0 +1,34 @@ +package io.metersphere.project.mapper; + +import io.metersphere.project.domain.FileAssociation; +import io.metersphere.project.domain.FileAssociationExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface FileAssociationMapper { + long countByExample(FileAssociationExample example); + + int deleteByExample(FileAssociationExample example); + + int deleteByPrimaryKey(String id); + + int insert(FileAssociation record); + + int insertSelective(FileAssociation record); + + List selectByExample(FileAssociationExample example); + + FileAssociation selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") FileAssociation record, @Param("example") FileAssociationExample example); + + int updateByExample(@Param("record") FileAssociation record, @Param("example") FileAssociationExample example); + + int updateByPrimaryKeySelective(FileAssociation record); + + int updateByPrimaryKey(FileAssociation record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") FileAssociation.Column ... selective); +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileAssociationMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileAssociationMapper.xml new file mode 100644 index 0000000000..df4b481477 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/project/mapper/FileAssociationMapper.xml @@ -0,0 +1,365 @@ + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, source_item_id, source_type, source_id, file_id, file_ref_id, file_version, create_time, + update_user, update_time, create_user + + + + + delete from file_association + where id = #{id,jdbcType=VARCHAR} + + + delete from file_association + + + + + + insert into file_association (id, source_item_id, source_type, + source_id, file_id, file_ref_id, + file_version, create_time, update_user, + update_time, create_user) + values (#{id,jdbcType=VARCHAR}, #{sourceItemId,jdbcType=VARCHAR}, #{sourceType,jdbcType=VARCHAR}, + #{sourceId,jdbcType=VARCHAR}, #{fileId,jdbcType=VARCHAR}, #{fileRefId,jdbcType=VARCHAR}, + #{fileVersion,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateUser,jdbcType=VARCHAR}, + #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}) + + + insert into file_association + + + id, + + + source_item_id, + + + source_type, + + + source_id, + + + file_id, + + + file_ref_id, + + + file_version, + + + create_time, + + + update_user, + + + update_time, + + + create_user, + + + + + #{id,jdbcType=VARCHAR}, + + + #{sourceItemId,jdbcType=VARCHAR}, + + + #{sourceType,jdbcType=VARCHAR}, + + + #{sourceId,jdbcType=VARCHAR}, + + + #{fileId,jdbcType=VARCHAR}, + + + #{fileRefId,jdbcType=VARCHAR}, + + + #{fileVersion,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{updateUser,jdbcType=VARCHAR}, + + + #{updateTime,jdbcType=BIGINT}, + + + #{createUser,jdbcType=VARCHAR}, + + + + + + update file_association + + + id = #{record.id,jdbcType=VARCHAR}, + + + source_item_id = #{record.sourceItemId,jdbcType=VARCHAR}, + + + source_type = #{record.sourceType,jdbcType=VARCHAR}, + + + source_id = #{record.sourceId,jdbcType=VARCHAR}, + + + file_id = #{record.fileId,jdbcType=VARCHAR}, + + + file_ref_id = #{record.fileRefId,jdbcType=VARCHAR}, + + + file_version = #{record.fileVersion,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + update_user = #{record.updateUser,jdbcType=VARCHAR}, + + + update_time = #{record.updateTime,jdbcType=BIGINT}, + + + create_user = #{record.createUser,jdbcType=VARCHAR}, + + + + + + + + update file_association + set id = #{record.id,jdbcType=VARCHAR}, + source_item_id = #{record.sourceItemId,jdbcType=VARCHAR}, + source_type = #{record.sourceType,jdbcType=VARCHAR}, + source_id = #{record.sourceId,jdbcType=VARCHAR}, + file_id = #{record.fileId,jdbcType=VARCHAR}, + file_ref_id = #{record.fileRefId,jdbcType=VARCHAR}, + file_version = #{record.fileVersion,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_user = #{record.updateUser,jdbcType=VARCHAR}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + create_user = #{record.createUser,jdbcType=VARCHAR} + + + + + + update file_association + + + source_item_id = #{sourceItemId,jdbcType=VARCHAR}, + + + source_type = #{sourceType,jdbcType=VARCHAR}, + + + source_id = #{sourceId,jdbcType=VARCHAR}, + + + file_id = #{fileId,jdbcType=VARCHAR}, + + + file_ref_id = #{fileRefId,jdbcType=VARCHAR}, + + + file_version = #{fileVersion,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + update_user = #{updateUser,jdbcType=VARCHAR}, + + + update_time = #{updateTime,jdbcType=BIGINT}, + + + create_user = #{createUser,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update file_association + set source_item_id = #{sourceItemId,jdbcType=VARCHAR}, + source_type = #{sourceType,jdbcType=VARCHAR}, + source_id = #{sourceId,jdbcType=VARCHAR}, + file_id = #{fileId,jdbcType=VARCHAR}, + file_ref_id = #{fileRefId,jdbcType=VARCHAR}, + file_version = #{fileVersion,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_user = #{updateUser,jdbcType=VARCHAR}, + update_time = #{updateTime,jdbcType=BIGINT}, + create_user = #{createUser,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + + + insert into file_association + (id, source_item_id, source_type, source_id, file_id, file_ref_id, file_version, + create_time, update_user, update_time, create_user) + values + + (#{item.id,jdbcType=VARCHAR}, #{item.sourceItemId,jdbcType=VARCHAR}, #{item.sourceType,jdbcType=VARCHAR}, + #{item.sourceId,jdbcType=VARCHAR}, #{item.fileId,jdbcType=VARCHAR}, #{item.fileRefId,jdbcType=VARCHAR}, + #{item.fileVersion,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.updateUser,jdbcType=VARCHAR}, + #{item.updateTime,jdbcType=BIGINT}, #{item.createUser,jdbcType=VARCHAR}) + + + + insert into file_association ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.id,jdbcType=VARCHAR} + + + #{item.sourceItemId,jdbcType=VARCHAR} + + + #{item.sourceType,jdbcType=VARCHAR} + + + #{item.sourceId,jdbcType=VARCHAR} + + + #{item.fileId,jdbcType=VARCHAR} + + + #{item.fileRefId,jdbcType=VARCHAR} + + + #{item.fileVersion,jdbcType=VARCHAR} + + + #{item.createTime,jdbcType=BIGINT} + + + #{item.updateUser,jdbcType=VARCHAR} + + + #{item.updateTime,jdbcType=BIGINT} + + + #{item.createUser,jdbcType=VARCHAR} + + + ) + + + \ No newline at end of file diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_management.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_management.sql index 51840e1750..9e1a55eab7 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_management.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_4__project_management.sql @@ -45,23 +45,30 @@ CREATE INDEX idx_name ON fake_error (name); CREATE TABLE IF NOT EXISTS file_association ( - `id` VARCHAR(50) NOT NULL COMMENT '', - `type` VARCHAR(50) NOT NULL COMMENT '模块类型,服务拆分后就是各个服务', - `source_id` VARCHAR(50) NOT NULL COMMENT '各个模块关联时自身Id/比如API/CASE/SCENAEIO', - `source_item_id` VARCHAR(50) NOT NULL COMMENT '对应资源引用时具体id,如一个用例引用多个文件', - `file_metadata_id` VARCHAR(50) NOT NULL COMMENT '文件id', - `file_type` VARCHAR(50) NOT NULL COMMENT '文件类型', - `project_id` VARCHAR(50) NOT NULL COMMENT '项目id', + `id` VARCHAR(50) NOT NULL COMMENT '', + `source_item_id` VARCHAR(50) NOT NULL COMMENT '多用于场景步骤内具体的步骤ID', + `source_type` VARCHAR(50) NOT NULL COMMENT '资源类型', + `source_id` VARCHAR(50) NOT NULL COMMENT '资源ID', + `file_id` VARCHAR(50) NOT NULL COMMENT '文件ID', + `file_ref_id` VARCHAR(50) NOT NULL COMMENT '文件同版本ID', + `file_version` VARCHAR(50) NOT NULL COMMENT '文件版本', + `create_time` BIGINT NOT NULL COMMENT '创建时间', + `update_user` VARCHAR(50) NOT NULL COMMENT '修改人', + `update_time` BIGINT NOT NULL COMMENT '更新时间', + `create_user` VARCHAR(50) COMMENT '创建人', PRIMARY KEY (id) -) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4 - COLLATE = utf8mb4_general_ci COMMENT = '文件关联资源关系(分散到模块)'; +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_general_ci + COMMENT = '文件资源关联'; -CREATE INDEX idx_file_metadata_id ON file_association (file_metadata_id); -CREATE INDEX idx_project_id ON file_association (project_id); + +CREATE INDEX idx_file_metadata_id ON file_association (file_id); +CREATE INDEX idx_source_type ON file_association (source_type); CREATE INDEX idx_source_id ON file_association (source_id); + CREATE TABLE IF NOT EXISTS file_metadata_repository ( `file_metadata_id` VARCHAR(50) NOT NULL COMMENT '文件ID', diff --git a/backend/framework/sdk/src/main/resources/i18n/project.properties b/backend/framework/sdk/src/main/resources/i18n/project.properties index 72b31baa5c..6ee5b37867 100644 --- a/backend/framework/sdk/src/main/resources/i18n/project.properties +++ b/backend/framework/sdk/src/main/resources/i18n/project.properties @@ -20,6 +20,7 @@ file_module.project_id.not_blank=项目ID不能为空 file_module.name.length_range=名称长度必须在{min}-{max}之间 file_module.name.not_blank=名称不能为空 file_repository.connect.error=存储库链接失败 +file_repository.not.exist=存储库不存在 file_repository.platform.error=存储库类型不正确 file_repository.id.not_blank=存储库ID不能为空 file_repository.name.not_blank=存储库名称不能为空 @@ -28,6 +29,8 @@ file_repository.token.not_blank=存储库token不能为空 file_repository.url.not_blank=存储库地址不能为空 file_repository.branch.not_blank=存储库分支不能为空 file_repository.file_path.not_blank=存储库文件路径不能为空 +file.association.error.type=不支持的文件关联资源类型 +file.association.source.not.exist=文件关联时资源不存在 custom_field_template.id.not_blank=ID不能为空 custom_field_template.field_id.length_range=字段ID长度必须在{min}-{max}之间 custom_field_template.field_id.not_blank=字段ID不能为空 @@ -431,6 +434,7 @@ drop_node.not.exist=目标节点不存在 file_module.parent.not.exist=文件模块父节点不存在 upload.file.error=上传文件失败 file.not.exist=文件不存在 +file.some.not.exist=部分文件不存在 old.file.not.exist=旧文件不存在 file.not.jar=不是jar文件 change.jar.enable=修改了jar文件的启用状态 diff --git a/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties index 8f6b005eba..1c71658b6b 100644 --- a/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/project_en_US.properties @@ -31,7 +31,10 @@ file_module.project_id.length_range=Project ID length must be between {min} and file_module.project_id.not_blank=Project ID is required file_module.name.length_range=Name length must be between {min} and {max} file_module.name.not_blank=Name is required +file.association.error.type=Source type is error +file.association.source.not.exist=Source not exist file_repository.connect.error=Repository connect error +file_repository.not.exist=Repository not exist file_repository.platform.error=Repository platform error file_repository.id.not_blank=Repository ID is required file_repository.name.not_blank=Repository name is required @@ -467,6 +470,7 @@ drop_node.not.exist=Drop node is not exist file_module.parent.not.exist=File module parent does not exist upload.file.error=Upload file error file.not.exist=File does not exist +file.some.not.exist=Some file not exist old.file.not.exist=Old file does not exist file.not.jar=Not jar file change.jar.enable=Change jar file enable diff --git a/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties index f4909cb286..18e1c1fffa 100644 --- a/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/project_zh_CN.properties @@ -31,7 +31,10 @@ file_module.project_id.length_range=项目ID长度必须在{min}-{max}之间 file_module.project_id.not_blank=项目ID不能为空 file_module.name.length_range=名称长度必须在{min}-{max}之间 file_module.name.not_blank=名称不能为空 +file.association.error.type=不支持的文件关联资源类型 +file.association.source.not.exist=文件关联时资源不存在 file_repository.connect.error=存储库链接失败 +file_repository.not.exist=存储库不存在 file_repository.platform.error=存储库类型不正确 file_repository.id.not_blank=存储库ID不能为空 file_repository.name.not_blank=存储库名称不能为空 @@ -466,6 +469,7 @@ drop_node.not.exist=目标节点不存在 file_module.parent.not.exist=文件模块父节点不存在 upload.file.error=上传文件失败 file.not.exist=文件不存在 +file.some.not.exist=部分文件不存在 old.file.not.exist=旧文件不存在 file.not.jar=不是jar文件 change.jar.enable=修改了jar文件的启用状态 diff --git a/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties index fe766a5d7f..a7ad814897 100644 --- a/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/project_zh_TW.properties @@ -31,7 +31,10 @@ file_module.project_id.length_range=項目ID長度必須在{min}-{max}之間 file_module.project_id.not_blank=項目ID不能為空 file_module.name.length_range=名稱長度必須在{min}-{max}之間 file_module.name.not_blank=名稱不能為空 -file_repository.connect.error=存储库链接失败 +file.association.error.type=不支持的文件關聯資源類型 +file.association.source.not.exist=文件關聯時資源不存在 +file_repository.connect.error=存儲庫鏈接失敗 +file_repository.not.exist=存儲庫不存在 file_repository.platform.error=存儲庫類型不正確 file_repository.id.not_blank=存儲庫ID不能為空 file_repository.name.not_blank=存儲庫名稱不能為空 @@ -189,7 +192,7 @@ message.jenkins_task_management=Jenkins message.schedule_task_management=定時任務 message.create=創建 message.update=更新 -message.delete=删除 +message.delete=刪除 message.execute_completed=執行完成 message.comment=評論 message.at=被@ @@ -200,7 +203,7 @@ message.review_at=評審被@ message.review_completed=評審完成 message.case_create=創建用例 message.case_update=更新用例 -message.case_delete=删除用例 +message.case_delete=刪除用例 message.case_execute_successful=用例執行成功 message.case_execute_fake_error=用例執行誤報 message.case_execute_failed=用例執行失敗 @@ -224,19 +227,19 @@ message.case_field=用例字段 message.report_field=報告字段 message.test_plan_task_create=${OPERATOR}創建了測試計劃:${name} message.test_plan_task_update=${OPERATOR}更新了測試計劃:${name} -message.test_plan_task_delete=${OPERATOR}删除了測試計劃:${name} +message.test_plan_task_delete=${OPERATOR}刪除了測試計劃:${name} message.test_plan_task_execute=${OPERATOR}執行了測試計劃:${name} -message.test_plan_report_task_delete=${OPERATOR}删除了測試計劃報告:${name} +message.test_plan_report_task_delete=${OPERATOR}刪除了測試計劃報告:${name} message.bug_task_create=${OPERATOR}創建了缺陷:${title} message.bug_task_update=${OPERATOR}更新了缺陷:${title} -message.bug_task_delete=${OPERATOR}删除了缺陷:${title} +message.bug_task_delete=${OPERATOR}刪除了缺陷:${title} message.bug_task_comment=${OPERATOR}評論了你的缺陷:${title} message.bug_task_at_comment=${OPERATOR}評論了缺陷:${title} 並@了你 message.bug_task_reply_comment=${OPERATOR}在缺陷 ${title} 回覆了你的評論 -message.bug_sync_task_execute_completed=${OPERATOR}同步了${total}条缺陷 +message.bug_sync_task_execute_completed=${OPERATOR}同步了${total}條缺陷 message.functional_case_task_create=${OPERATOR}創建了功能用例:${name} message.functional_case_task_update=${OPERATOR}更新了功能用例:${name} -message.functional_case_task_delete=${OPERATOR}删除了功能用例:${name} +message.functional_case_task_delete=${OPERATOR}刪除了功能用例:${name} message.functional_case_task_comment=${OPERATOR}評論了你的功能用例:${name} message.functional_case_task_review=${OPERATOR}評審了${reviewName}${name} message.functional_case_task_review_at=${OPERATOR}在${reviewName}${name}@了你 @@ -248,48 +251,48 @@ message.functional_case_task_at_comment=${OPERATOR}評論了功能用例:${name} message.functional_case_task_reply_comment=${OPERATOR}在用例 ${name} 回覆了你的評論 message.case_review_task_create=${OPERATOR}創建了用例評審:${name} message.case_review_task_update=${OPERATOR}更新了用例評審:${name} -message.case_review_task_delete=${OPERATOR}删除了用例評審:${name} +message.case_review_task_delete=${OPERATOR}刪除了用例評審:${name} message.case_review_task_review_completed=${OPERATOR}完成了用例評審:${name} message.api_definition_task_create=${OPERATOR}創建了介面文檔:${name} message.api_definition_task_update=${OPERATOR}更新了介面文檔:${name} -message.api_definition_task_delete=${OPERATOR}删除了介面文檔:${name} +message.api_definition_task_delete=${OPERATOR}刪除了介面文檔:${name} message.api_definition_task_case_create=${OPERATOR}創建了介面用例:${name} message.api_definition_task_case_update=${OPERATOR}更新了介面用例:${name} -message.api_definition_task_case_delete=${OPERATOR}删除了介面用例:${name} +message.api_definition_task_case_delete=${OPERATOR}刪除了介面用例:${name} message.api_definition_task_case_execute=${OPERATOR}執行了介面用例:${name} message.api_scenario_task_create=${OPERATOR}創建了介面場景:${name} message.api_scenario_task_update=${OPERATOR}更新了介面場景:${name} -message.api_scenario_task_delete=${OPERATOR}删除了介面場景:${name} +message.api_scenario_task_delete=${OPERATOR}刪除了介面場景:${name} message.api_scenario_task_scenario_execute=${OPERATOR}執行了介面場景:${name} -message.api_report_task_delete=${OPERATOR}删除了接口報告:${name} +message.api_report_task_delete=${OPERATOR}刪除了接口報告:${name} message.ui_scenario_task_create=${OPERATOR}創建了UI用例:${name} message.ui_scenario_task_update=${OPERATOR}更新了UI用例:${name} -message.ui_scenario_task_delete=${OPERATOR}删除了UI用例:${name} +message.ui_scenario_task_delete=${OPERATOR}刪除了UI用例:${name} message.ui_scenario_task_execute=${OPERATOR}執行了UI用例:${name} -message.ui_report_task_delete=${OPERATOR}删除了UI報告:${name} +message.ui_report_task_delete=${OPERATOR}刪除了UI報告:${name} message.load_test_task_create=${OPERATOR}創建了性能用例:${name} message.load_test_task_update=${OPERATOR}更新了性能用例:${name} -message.load_test_task_delete=${OPERATOR}删除了性能用例:${name} +message.load_test_task_delete=${OPERATOR}刪除了性能用例:${name} message.load_test_task_execute_completed=${OPERATOR}執行了性能用例:${name} -message.load_report_task_delete=${OPERATOR}删除了性能報告:${name} +message.load_report_task_delete=${OPERATOR}刪除了性能報告:${name} message.jenkins_task_execute=Jenkins執行了:${name} message.schedule_task_open=${OPERATOR}開啟了定時任務:${name} message.schedule_task_close=${OPERATOR}關閉了定時任務:${name} message.title.test_plan_task_create=測試計劃創建通知 message.title.test_plan_task_update=測試計劃更新通知 -message.title.test_plan_task_delete=測試計劃删除通知 +message.title.test_plan_task_delete=測試計劃刪除通知 message.title.test_plan_task_execute_success=測試計劃執行成功通知 message.title.test_plan_task_execute_failed=測試計劃執行失敗通知 message.title.test_plan_report_task_delete=測試計劃報告刪除通知 message.title.bug_task_create=缺陷創建通知 message.title.bug_task_update=缺陷更新通知 -message.title.bug_task_delete=缺陷删除通知 +message.title.bug_task_delete=缺陷刪除通知 message.title.bug_task_comment=缺陷評論通知 message.title.bug_sync_task_execute_completed=同步缺陷執行完成通知 message.title.functional_case_task_create=功能用例創建通知 message.title.functional_case_task_update=功能用例更新通知 -message.title.functional_case_task_delete=功能用例删除通知 +message.title.functional_case_task_delete=功能用例刪除通知 message.title.functional_case_task_comment=功能用例評論通知 message.title.functional_case_task_review_passed=用例評審透過通知 message.title.functional_case_task_review_fail=用例評審不透過通知 @@ -300,35 +303,35 @@ message.title.functional_case_task_execute_at=用例執行通知 message.title.case_review_task_create=用例評審創建通知 message.title.case_review_task_update=用例評審更新通知 -message.title.case_review_task_delete=用例評審删除通知 +message.title.case_review_task_delete=用例評審刪除通知 message.title.case_review_task_review_completed=用例評審評審完成通知 message.title.api_definition_task_create=介面文檔創建通知 message.title.api_definition_task_update=介面文檔更新通知 -message.title.api_definition_task_delete=介面文檔删除通知 +message.title.api_definition_task_delete=介面文檔刪除通知 message.title.api_definition_task_case_create=介面用例創建通知 message.title.api_definition_task_case_update=介面用例更新通知 -message.title.api_definition_task_case_delete=介面用例删除通知 +message.title.api_definition_task_case_delete=介面用例刪除通知 message.title.api_definition_task_case_execute_successful=介面用例執行成功通知 message.title.api_definition_task_case_execute_fake_error=介面用例執行誤報通知 message.title.api_definition_task_case_execute_failed=介面用例執行失敗通知 message.title.api_scenario_task_create=介面場景創建通知 message.title.api_scenario_task_update=介面場景更新通知 -message.title.api_scenario_task_delete=介面場景删除通知 +message.title.api_scenario_task_delete=介面場景刪除通知 message.title.api_scenario_task_scenario_execute_successful=介面場景執行成功通知 -message.title.api_scenario_task_scenario_execute_fake_error=介面場景执誤報通知 +message.title.api_scenario_task_scenario_execute_fake_error=介面場景執誤報通知 message.title.api_scenario_task_scenario_execute_failed=介面場景執行失敗通知 -message.title.api_report_task_delete=接口報告删除通知 +message.title.api_report_task_delete=接口報告刪除通知 message.title.ui_scenario_task_create=UI用例創建通知 message.title.ui_scenario_task_update=UI用例更新通知 -message.title.ui_scenario_task_delete=UI用例删除通知 +message.title.ui_scenario_task_delete=UI用例刪除通知 message.title.ui_scenario_task_execute_successful=UI用例執行成功通知 message.title.ui_scenario_task_execute_failed=UI用例執行失敗通知 -message.title.ui_report_task_delete=UI報告删除通知 +message.title.ui_report_task_delete=UI報告刪除通知 message.title.load_test_task_create=性能用例創建通知 message.title.load_test_task_update=性能用例更新通知 -message.title.load_test_task_delete=性能用例删除通知 +message.title.load_test_task_delete=性能用例刪除通知 message.title.load_test_task_execute_completed=性能用例執行完成通知 -message.title.load_report_task_delete=性能報告删除通知 +message.title.load_report_task_delete=性能報告刪除通知 message.title.jenkins_task_execute_successful=Jenkins任務執行成功通知 message.title.jenkins_task_execute_failed=Jenkins任務執行失敗通知 message.title.schedule_task_open=開啟定時任務通知 @@ -343,11 +346,11 @@ message.domain.case_model=編輯模式 message.domain.last_execute_result=最近的執行結果 message.domain.create_user=創建人 message.domain.update_user=更新人 -message.domain.delete_user=删除人 +message.domain.delete_user=刪除人 message.domain.create_time=創建時間 message.domain.update_time=更新時間 message.domain.delete_time=刪除時間 -#接口定义和用例 +#接口定義和用例 message.domain.protocol=介面協定 message.domain.method=http協定類型 message.domain.path=http協定路徑/其它協定則為空 @@ -378,11 +381,11 @@ message.domain.api_scenario_tags=標籤 message.domain.api_scenario_grouped=是否為環境組 message.domain.api_scenario_createUser=創建人 message.domain.api_scenario_updateUser=更新人 -message.domain.api_scenario_deleteUser=删除人 +message.domain.api_scenario_deleteUser=刪除人 message.domain.api_scenario_createTime=創建時間 message.domain.api_scenario_updateTime=更新時間 message.domain.api_scenario_deleteTime=刪除時間 -# 测试计划 +# 測試計劃 message.domain.test_plan_stage=測試階段 message.domain.test_plan_status=測試計劃狀態 message.domain.test_plan_description=描述 @@ -395,9 +398,9 @@ message.domain.test_plan_plannedStartTime=計劃開始時間 message.domain.test_plan_plannedEndTime=計劃結束時間 message.domain.test_plan_actualStartTime=實際開始時間 message.domain.test_plan_actualEndTime=實際結束時間 -# 用例评审 +# 用例評審 message.domain.case_review_name=名稱 -message.domain.case_review_status=评审狀態 +message.domain.case_review_status=評審狀態 message.domain.case_review_description=描述 message.domain.case_review_tags=標籤 message.domain.case_review_createUser=創建人 @@ -417,7 +420,7 @@ message.domain.bug_createUser=創建人 message.domain.bug_updateUser=更新人 message.domain.bug_createTime=創建時間 message.domain.bug_updateTime=更新時間 -message.domain.bug_deleteUser=删除人 +message.domain.bug_deleteUser=刪除人 message.domain.bug_deleteTime=刪除時間 message.domain.bug_handleUser=處理人 #UI @@ -433,7 +436,7 @@ message.domain.ui_createUser=創建人 message.domain.ui_updateUser=更新人 message.domain.ui_createTime=創建時間 message.domain.ui_updateTime=更新時間 -message.domain.ui_deleteUser=删除人 +message.domain.ui_deleteUser=刪除人 message.domain.ui_deleteTime=刪除時間 message.domain.ui_description=描述 #性能 @@ -445,7 +448,7 @@ message.domain.load_updateUser=更新人 message.domain.load_createTime=創建時間 message.domain.load_updateTime=更新時間 message.domain.load_description=描述 -#定时任务 +#定時任務 message.domain.schedule_key=qrtz UUID message.domain.schedule_type=資源類型 message.domain.schedule_value=cron 表達式 @@ -467,6 +470,7 @@ drop_node.not.exist=目標節點不存在 file_module.parent.not.exist=文件模塊父節點不存在 upload.file.error=上傳文件失敗 file.not.exist=文件不存在 +file.some.not.exist=部分文件不存在 old.file.not.exist=舊文件不存在 file.not.jar=不是jar文件 change.jar.enable=修改了jar文件的啟用狀態 diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileRepositoryController.java b/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileRepositoryController.java index b79ad28aa1..8b1e0db8d3 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileRepositoryController.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/controller/FileRepositoryController.java @@ -4,6 +4,7 @@ import io.metersphere.project.dto.filemanagement.request.FileRepositoryConnectRe import io.metersphere.project.dto.filemanagement.request.FileRepositoryCreateRequest; import io.metersphere.project.dto.filemanagement.request.FileRepositoryUpdateRequest; import io.metersphere.project.dto.filemanagement.request.RepositoryFileAddRequest; +import io.metersphere.project.dto.filemanagement.response.FileRepositoryResponse; import io.metersphere.project.service.FileMetadataService; import io.metersphere.project.service.FileRepositoryService; import io.metersphere.sdk.constants.PermissionConstants; @@ -43,6 +44,13 @@ public class FileRepositoryController { return fileMetadataService.getFileType(projectId, StorageType.GIT.name()); } + @GetMapping(value = "/info/{id}") + @Operation(summary = "项目管理-文件管理-存储库-存储库信息") + @RequiresPermissions(PermissionConstants.PROJECT_FILE_MANAGEMENT_READ) + public FileRepositoryResponse getRepositoryInfo(@PathVariable String id) { + return fileRepositoryService.getRepositoryInfo(id); + } + @PostMapping("/add-repository") @Operation(summary = "项目管理-文件管理-存储库-添加存储库") @RequiresPermissions(PermissionConstants.PROJECT_FILE_MANAGEMENT_READ_ADD) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/response/FileInformationResponse.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/response/FileInformationResponse.java index 93f71a298f..d4bc396096 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/response/FileInformationResponse.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/response/FileInformationResponse.java @@ -55,6 +55,9 @@ public class FileInformationResponse { @Schema(description = "启用/禁用(jar文件)") private boolean enable; + @Schema(description = "关联ID") + private String refId; + public FileInformationResponse(FileMetadata fileMetadata) { if (fileMetadata != null) { this.id = fileMetadata.getId(); @@ -72,6 +75,7 @@ public class FileInformationResponse { this.createUser = fileMetadata.getCreateUser(); this.updateUser = fileMetadata.getUpdateUser(); this.updateTime = fileMetadata.getUpdateTime(); + this.refId = fileMetadata.getRefId(); } } } diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/response/FileRepositoryResponse.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/response/FileRepositoryResponse.java new file mode 100644 index 0000000000..76f4791556 --- /dev/null +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/filemanagement/response/FileRepositoryResponse.java @@ -0,0 +1,38 @@ +package io.metersphere.project.dto.filemanagement.response; + +import io.metersphere.project.domain.FileModule; +import io.metersphere.project.domain.FileModuleRepository; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +public class FileRepositoryResponse { + @Schema(description = "ID") + private String id; + @Schema(description = "存储库名称") + private String name; + + @Schema(description = "存储库Token") + private String token; + + @Schema(description = "存储库地址") + private String url; + + @Schema(description = "所属平台;GitHub/Gitlab/Gitee") + private String platform; + + @Schema(description = "用户名;platform为Gitee时必填") + private String userName; + + public FileRepositoryResponse(FileModule fileModule, FileModuleRepository repository) { + this.id = fileModule.getId(); + this.name = fileModule.getName(); + this.token = repository.getToken(); + this.url = repository.getUrl(); + this.platform = repository.getPlatform(); + this.userName = repository.getUserName(); + } + +} diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.xml b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.xml index 72c7838450..5f3399e372 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.xml +++ b/backend/services/project-management/src/main/java/io/metersphere/project/mapper/ExtFileMetadataMapper.xml @@ -150,6 +150,7 @@ f.path, f.project_id, f.size, + f.ref_id, f.storage FROM file_metadata f INNER JOIN user updateUser ON f.update_user = updateUser.id diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/FileRepositoryService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/FileRepositoryService.java index 848db47e7a..ca1d561bc1 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/FileRepositoryService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/FileRepositoryService.java @@ -8,6 +8,7 @@ import io.metersphere.project.dto.filemanagement.FileRepositoryLog; import io.metersphere.project.dto.filemanagement.request.FileRepositoryCreateRequest; import io.metersphere.project.dto.filemanagement.request.FileRepositoryUpdateRequest; import io.metersphere.project.dto.filemanagement.request.RepositoryFileAddRequest; +import io.metersphere.project.dto.filemanagement.response.FileRepositoryResponse; import io.metersphere.project.mapper.FileMetadataRepositoryMapper; import io.metersphere.project.mapper.FileModuleRepositoryMapper; import io.metersphere.sdk.constants.ModuleConstants; @@ -150,4 +151,13 @@ public class FileRepositoryService extends FileModuleService { return fileMetadata.getId(); } + + public FileRepositoryResponse getRepositoryInfo(String id) { + FileModule fileModule = fileModuleMapper.selectByPrimaryKey(id); + FileModuleRepository repository = fileModuleRepositoryMapper.selectByPrimaryKey(id); + if (fileModule == null || repository == null) { + throw new MSException(Translator.get("file_repository.not.exist")); + } + return new FileRepositoryResponse(fileModule, repository); + } } diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java index 408a9ac688..3f1c6cb767 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileManagementControllerTests.java @@ -146,6 +146,9 @@ public class FileManagementControllerTests extends BaseTest { Assertions.assertNotNull(a1Node); checkLog(a1Node.getId(), OperationLogType.ADD, FileManagementRequestUtils.URL_MODULE_ADD); + //测试a1无法获取存储库详情 + this.requestGet(String.format(FileManagementRequestUtils.URL_FILE_REPOSITORY_INFO, a1Node.getId())).andExpect(status().is5xxServerError()); + //根目录下创建节点a2和a3,在a1下创建子节点a1-b1 request = new FileModuleCreateRequest(); request.setProjectId(project.getId()); @@ -864,6 +867,7 @@ public class FileManagementControllerTests extends BaseTest { JSON.parseObject(fileMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()), Pager.class); List fileList = JSON.parseArray(JSON.toJSONString(pageResult.getList()), FileInformationResponse.class); + for (FileInformationResponse fileDTO : fileList) { MvcResult originalResult = this.downloadFile(String.format(FileManagementRequestUtils.URL_FILE_PREVIEW_ORIGINAL, "admin", fileDTO.getId())); Assertions.assertTrue(originalResult.getResponse().getContentAsByteArray().length > 0); diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileRepositoryControllerTest.java b/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileRepositoryControllerTest.java index cfcb380c8e..5e61250eea 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileRepositoryControllerTest.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/controller/filemanagement/FileRepositoryControllerTest.java @@ -3,6 +3,7 @@ package io.metersphere.project.controller.filemanagement; import io.metersphere.project.domain.*; import io.metersphere.project.dto.filemanagement.request.*; import io.metersphere.project.dto.filemanagement.response.FileInformationResponse; +import io.metersphere.project.dto.filemanagement.response.FileRepositoryResponse; import io.metersphere.project.mapper.FileMetadataMapper; import io.metersphere.project.mapper.FileMetadataRepositoryMapper; import io.metersphere.project.mapper.FileModuleMapper; @@ -179,6 +180,19 @@ public class FileRepositoryControllerTest extends BaseTest { repositoryId = rh.getData().toString(); this.checkFileRepository(repositoryId, createRequest.getProjectId(), createRequest.getName(), createRequest.getPlatform(), createRequest.getUrl(), createRequest.getToken(), createRequest.getUserName()); this.checkLog(repositoryId, OperationLogType.ADD, FileManagementRequestUtils.URL_FILE_REPOSITORY_CREATE); + + //测试获取详情 + MvcResult mvcResult = this.requestGetWithOkAndReturn(String.format(FileManagementRequestUtils.URL_FILE_REPOSITORY_INFO, repositoryId)); + String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class); + FileRepositoryResponse response = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), FileRepositoryResponse.class); + Assertions.assertEquals(response.getId(), repositoryId); + Assertions.assertEquals(response.getName(), createRequest.getName()); + Assertions.assertEquals(response.getPlatform(), createRequest.getPlatform()); + Assertions.assertEquals(response.getToken(), GITEE_TOKEN); + Assertions.assertEquals(response.getUrl(), GITEE_URL); + Assertions.assertEquals(response.getUserName(), GITEE_USERNAME); + //参数测试: 没有url createRequest = new FileRepositoryCreateRequest(); createRequest.setProjectId(project.getId()); @@ -241,6 +255,9 @@ public class FileRepositoryControllerTest extends BaseTest { //测试整体过程中没有修改数据成功 this.checkFileRepository(repositoryId, createRequest.getProjectId(), createRequest.getName(), createRequest.getPlatform(), createRequest.getUrl(), createRequest.getToken(), createRequest.getUserName()); + + //测试获取没有数据的详情 + this.requestGet(String.format(FileManagementRequestUtils.URL_FILE_REPOSITORY_INFO, IDGenerator.nextStr())).andExpect(status().is5xxServerError()); } @Test @@ -462,6 +479,22 @@ public class FileRepositoryControllerTest extends BaseTest { this.requestPost(FileManagementRequestUtils.URL_FILE_REPOSITORY_FILE_ADD, request).andExpect(status().isBadRequest()); } + //检查前台的页面查询 + //空数据下,检查文件列表 + FileMetadataTableRequest tableRequest = new FileMetadataTableRequest() {{ + this.setCurrent(1); + this.setPageSize(10); + this.setProjectId(project.getId()); + this.setCombine(new HashMap<>() {{ + this.put("storage", StorageType.GIT.name()); + }}); + }}; + MvcResult pageResult = this.requestPostWithOkAndReturn(FileManagementRequestUtils.URL_FILE_PAGE, tableRequest); + String returnData = pageResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class); + Pager> tableResult = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), Pager.class); + Assertions.assertEquals(tableResult.getTotal(), fileList.size()); + } @Test diff --git a/backend/services/project-management/src/test/java/io/metersphere/project/utils/FileManagementRequestUtils.java b/backend/services/project-management/src/test/java/io/metersphere/project/utils/FileManagementRequestUtils.java index 3b6edaea9a..e1570b128d 100644 --- a/backend/services/project-management/src/test/java/io/metersphere/project/utils/FileManagementRequestUtils.java +++ b/backend/services/project-management/src/test/java/io/metersphere/project/utils/FileManagementRequestUtils.java @@ -46,6 +46,8 @@ public class FileManagementRequestUtils { */ //存储库列表 public static final String URL_FILE_REPOSITORY_LIST = "/project/file/repository/list/%s"; + //存储库详情 + public static final String URL_FILE_REPOSITORY_INFO = "/project/file/repository/info/%s"; //存储库文件类型 public static final String URL_FILE_REPOSITORY_FILE_TYPE = "/project/file/repository/file-type/%s"; //测试连接存储库