diff --git a/backend/framework/provider/src/main/java/io/metersphere/request/AssociateOtherCaseRequest.java b/backend/framework/provider/src/main/java/io/metersphere/request/AssociateOtherCaseRequest.java index 9d40f3c66e..1480acbe70 100644 --- a/backend/framework/provider/src/main/java/io/metersphere/request/AssociateOtherCaseRequest.java +++ b/backend/framework/provider/src/main/java/io/metersphere/request/AssociateOtherCaseRequest.java @@ -1,6 +1,5 @@ package io.metersphere.request; -import io.metersphere.sdk.constants.ModuleConstants; import io.metersphere.validation.groups.Created; import io.metersphere.validation.groups.Updated; import io.swagger.v3.oas.annotations.media.Schema; @@ -8,6 +7,7 @@ import jakarta.validation.Valid; import jakarta.validation.constraints.NotBlank; import lombok.Data; +import java.util.ArrayList; import java.util.List; @Data @@ -44,7 +44,7 @@ public class AssociateOtherCaseRequest { private String sourceId; @Schema(description = "接口用例的接口协议", requiredMode = Schema.RequiredMode.REQUIRED) - private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP; + private List protocols = new ArrayList<>(); @Schema(description = "关联用例的类型(API,SCENARIO,UI,PERFORMANCE)", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{associate_other_case_request.type.not_blank}") diff --git a/backend/framework/provider/src/main/java/io/metersphere/request/TestCasePageProviderRequest.java b/backend/framework/provider/src/main/java/io/metersphere/request/TestCasePageProviderRequest.java index 1e82e2a55c..676b0edb30 100644 --- a/backend/framework/provider/src/main/java/io/metersphere/request/TestCasePageProviderRequest.java +++ b/backend/framework/provider/src/main/java/io/metersphere/request/TestCasePageProviderRequest.java @@ -1,7 +1,6 @@ package io.metersphere.request; import com.google.common.base.CaseFormat; -import io.metersphere.sdk.constants.ModuleConstants; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.Valid; import jakarta.validation.constraints.*; @@ -11,6 +10,7 @@ import org.apache.commons.lang3.StringUtils; import java.io.Serial; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -25,15 +25,15 @@ public class TestCasePageProviderRequest extends BaseProviderCondition implement private static final long serialVersionUID = 1L; @Min(value = 1, message = "当前页码必须大于0") - @Schema(description = "当前页码") + @Schema(description = "当前页码") private int current; @Min(value = 5, message = "每页显示条数必须不小于5") @Max(value = 500, message = "每页显示条数不能大于500") - @Schema(description = "每页显示条数") + @Schema(description = "每页显示条数") private int pageSize; - @Schema(description = "排序字段(model中的字段 : asc/desc)") + @Schema(description = "排序字段(model中的字段 : asc/desc)") private Map<@Valid @Pattern(regexp = "^[A-Za-z]+$") String, @Valid @NotBlank String> sort; @Schema(description = "接口pk") @@ -45,9 +45,7 @@ public class TestCasePageProviderRequest extends BaseProviderCondition implement private String projectId; @Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{api_definition.protocol.not_blank}") - @Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}") - private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP; + private List protocols = new ArrayList<>(); @Schema(description = "模块ID") private List<@NotBlank String> moduleIds; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionBatchRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionBatchRequest.java index 7b94b85f58..428a6c0c5f 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionBatchRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionBatchRequest.java @@ -1,15 +1,16 @@ package io.metersphere.api.dto.definition; -import io.metersphere.sdk.constants.ModuleConstants; import io.metersphere.system.dto.table.TableBatchProcessDTO; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.Size; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serial; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -28,9 +29,8 @@ public class ApiDefinitionBatchRequest extends TableBatchProcessDTO implements S private String projectId; @Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{api_debug.protocol.not_blank}") - @Size(min = 1, max = 20, message = "{api_debug.protocol.length_range}") - private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP; + @NotEmpty(message = "{api_debug.protocol.not_blank}") + private List<@NotBlank String> protocols = new ArrayList<>(); @Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)") private List<@NotBlank String> moduleIds; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionDocRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionDocRequest.java index f1442d1b54..a8630d2403 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionDocRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionDocRequest.java @@ -1,13 +1,14 @@ package io.metersphere.api.dto.definition; -import io.metersphere.sdk.constants.ModuleConstants; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.Size; import lombok.Data; import java.io.Serial; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -19,7 +20,7 @@ public class ApiDefinitionDocRequest implements Serializable { @Serial private static final long serialVersionUID = 1L; - @Schema(description = "关键字") + @Schema(description = "关键字") private String keyword; @Schema(description = "接口pk") @@ -32,8 +33,8 @@ public class ApiDefinitionDocRequest implements Serializable { private String projectId; @Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED) - @Size(min = 1, max = 20, message = "{api_debug.protocol.length_range}") - private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP; + @NotEmpty(message = "{api_definition.protocol.not_blank}") + private List<@NotBlank String> protocols = new ArrayList<>(); @Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)") private List<@NotBlank String> moduleIds; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionMockDTO.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionMockDTO.java index cdc3a3c9a6..eb1753a58d 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionMockDTO.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionMockDTO.java @@ -34,5 +34,7 @@ public class ApiDefinitionMockDTO extends ApiDefinitionMock { @Schema(description = "接口类型") private String apiMethod; + @Schema(description = "接口协议") + private String protocol; } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionPageRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionPageRequest.java index 4c82aabfb8..e4e84abb77 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionPageRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDefinitionPageRequest.java @@ -1,13 +1,14 @@ package io.metersphere.api.dto.definition; -import io.metersphere.sdk.constants.ModuleConstants; import io.metersphere.system.dto.sdk.BasePageRequest; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.Size; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.ArrayList; import java.util.List; /** @@ -21,14 +22,13 @@ public class ApiDefinitionPageRequest extends BasePageRequest { @Size(min = 1, max = 50, message = "{api_definition.id.length_range}") private String id; - @Schema(description = "接口名称") + @Schema(description = "接口名称") @Size(min = 1, max = 255, message = "{api_definition.name.length_range}") private String name; - @Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{api_definition.protocol.not_blank}") - @Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}") - private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP; + @Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "{api_definition.protocol.not_blank}") + private List<@NotBlank String> protocols = new ArrayList<>(); @Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{api_definition.project_id.not_blank}") diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiModuleRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiModuleRequest.java index ad151527ce..79fd19d61d 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiModuleRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiModuleRequest.java @@ -1,12 +1,13 @@ package io.metersphere.api.dto.definition; -import io.metersphere.sdk.constants.ModuleConstants; import io.metersphere.system.dto.sdk.BaseCondition; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.Size; import lombok.Data; +import java.util.ArrayList; import java.util.List; @Data @@ -15,9 +16,8 @@ public class ApiModuleRequest extends BaseCondition { private List<@NotBlank String> moduleIds; @Schema(description = "协议", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{api_definition_module.protocol.not_blank}") - @Size(min = 1, max = 20, message = "{api_definition_module.protocol.length_range}") - private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP; + @NotEmpty(message = "{api_definition_module.protocol.not_blank}") + private List<@NotBlank String> protocols = new ArrayList<>(); @Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{api_definition_module.project_id.not_blank}") @Size(min = 1, max = 50, message = "{api_definition_module.project_id.length_range}") diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseBatchRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseBatchRequest.java index 32a2f11c1c..27d0e68fe0 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseBatchRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiTestCaseBatchRequest.java @@ -1,14 +1,15 @@ package io.metersphere.api.dto.definition; -import io.metersphere.sdk.constants.ModuleConstants; import io.metersphere.system.dto.table.TableBatchProcessDTO; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.Size; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; @Data @@ -27,9 +28,8 @@ public class ApiTestCaseBatchRequest extends TableBatchProcessDTO implements Ser private String projectId; @Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{api_definition.protocol.not_blank}") - @Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}") - private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP; + @NotEmpty(message = "{api_definition.protocol.not_blank}") + private List protocols = new ArrayList<>(); @Schema(description = "模块ID") private List<@NotBlank String> moduleIds; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiTestCasePageRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiTestCasePageRequest.java index b51b53f885..b0af84e04f 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiTestCasePageRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiTestCasePageRequest.java @@ -1,15 +1,16 @@ package io.metersphere.api.dto.definition; -import io.metersphere.sdk.constants.ModuleConstants; import io.metersphere.system.dto.sdk.BasePageRequest; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.Size; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serial; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; @Data @@ -29,9 +30,8 @@ public class ApiTestCasePageRequest extends BasePageRequest implements Serializa private String projectId; @Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{api_definition.protocol.not_blank}") - @Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}") - private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP; + @NotEmpty(message = "{api_definition.protocol.not_blank}") + private List<@NotBlank String> protocols = new ArrayList<>(); @Schema(description = "模块ID") private List<@NotBlank String> moduleIds; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/request/ApiDefinitionMockPageRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/request/ApiDefinitionMockPageRequest.java index 72118699b8..2e5ae714b5 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/request/ApiDefinitionMockPageRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/request/ApiDefinitionMockPageRequest.java @@ -1,13 +1,14 @@ package io.metersphere.api.dto.definition.request; -import io.metersphere.sdk.constants.ModuleConstants; import io.metersphere.system.dto.sdk.BasePageRequest; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.Size; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.ArrayList; import java.util.List; /** @@ -17,7 +18,7 @@ import java.util.List; @EqualsAndHashCode(callSuper = false) public class ApiDefinitionMockPageRequest extends BasePageRequest { - @Schema(description = "接口 mock 名称") + @Schema(description = "接口 mock 名称") @Size(min = 1, max = 255, message = "{api_definition_mock.name.length_range}") private String name; @@ -34,9 +35,8 @@ public class ApiDefinitionMockPageRequest extends BasePageRequest { private String apiDefinitionId; @Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{api_definition.protocol.not_blank}") - @Size(min = 1, max = 20, message = "{api_definition.protocol.length_range}") - private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP; + @NotEmpty + private List<@NotBlank String> protocols = new ArrayList<>(); @Schema(description = "模块ID") private List<@NotBlank String> moduleIds; diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ScenarioSystemRequest.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ScenarioSystemRequest.java index d7ccaf591e..b052435da3 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ScenarioSystemRequest.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/scenario/ScenarioSystemRequest.java @@ -1,8 +1,8 @@ package io.metersphere.api.dto.scenario; -import io.metersphere.sdk.constants.ModuleConstants; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.Size; import lombok.Data; import lombok.EqualsAndHashCode; @@ -24,8 +24,8 @@ public class ScenarioSystemRequest { @Size(min = 1, max = 50, message = "{api_scenario.project_id.length_range}") private String projectId; @Schema(description = "协议 接口和用例的时候 是必传的", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank - private String protocol = ModuleConstants.NODE_PROTOCOL_HTTP; + @NotEmpty + private List<@NotBlank String> protocols = new ArrayList<>(); @Schema(description = "版本id") private String versionId; } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java index b924fca4f9..1cc3d30da7 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.java @@ -28,7 +28,7 @@ public interface ExtApiDefinitionMapper { Long getPos(@Param("projectId") String projectId); - List getIds(@Param("request") TableBatchProcessDTO request, @Param("projectId") String projectId, @Param("protocol") String protocol, @Param("deleted") boolean deleted); + List getIds(@Param("request") TableBatchProcessDTO request, @Param("projectId") String projectId, @Param("protocols") List protocols, @Param("deleted") boolean deleted); List getRefIds(@Param("ids") List ids, @Param("deleted") boolean deleted); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml index 8367d54ae6..24390c2727 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionMapper.xml @@ -66,7 +66,13 @@ select m.id, m.create_time, m.update_time, m.create_user, m.`name`, m.tags, m.`enable`, m.expect_num, m.project_id, m.status_code, - m.api_definition_id, u.name as create_user_name, d.path as api_path, d.method as apiMethod + m.api_definition_id, u.name as create_user_name, d.path as api_path, d.method as apiMethod, d.protocol as protocol from api_definition_mock m left join `api_definition` d on d.id = m.api_definition_id left join `user` u on u.id = m.create_user @@ -62,9 +62,13 @@ - - and a.protocol = #{request.protocol} + + and a.protocol in + + #{protocol} + + and m.api_definition_id = #{request.apiDefinitionId} @@ -107,8 +111,11 @@ and m.api_definition_id = #{request.apiDefinitionId} - - and d.protocol = #{request.protocol} + + and d.protocol in + + #{protocol} + and d.module_id in diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.xml index 99e34ab0ba..91dd0db772 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.xml @@ -176,8 +176,11 @@ and api_definition.project_id = #{request.projectId} - - AND api_definition.protocol = #{request.protocol} + + AND api_definition.protocol in + + #{protocol} + and api_definition.module_id in diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml index 8c32a91d52..095dc1ea94 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.xml @@ -284,8 +284,11 @@ and api_test_case.project_id = #{request.projectId} - - AND api_definition.protocol = #{request.protocol} + + AND api_definition.protocol in + + #{protocol} + and api_definition.module_id in @@ -412,8 +415,11 @@ - - and a.protocol = #{request.protocol} + + and a.protocol in + + #{protocol} + and atc.api_definition_id = #{request.apiDefinitionId} @@ -444,8 +450,11 @@ - - and a.protocol = #{request.protocol} + + and a.protocol in + + #{protocol} + and atc.api_definition_id = #{request.apiDefinitionId} @@ -552,8 +561,11 @@ #{moduleId} - - and ad.protocol = #{request.protocol} + + and ad.protocol in + + #{protocol} + and ac.api_definition_id = #{request.apiDefinitionId} @@ -575,8 +587,12 @@ #{moduleId} - - and ad.protocol = #{request.protocol} + + and ad.protocol in + + #{protocol} + + and ac.api_definition_id = #{request.apiDefinitionId} diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionImportUtilService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionImportUtilService.java index 191fda1d33..3d31e8bb60 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionImportUtilService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionImportUtilService.java @@ -199,7 +199,7 @@ public class ApiDefinitionImportUtilService { //查询数据库中所有的数据, 用于判断是否重复 ApiDefinitionPageRequest pageRequest = new ApiDefinitionPageRequest(); pageRequest.setProjectId(request.getProjectId()); - pageRequest.setProtocol(request.getProtocol()); + pageRequest.setProtocols(List.of(request.getProtocol())); //TODO 如果是有版本的话 需要加上版本的判断 List apiLists = extApiDefinitionMapper.importList(pageRequest); List apiModules = this.buildTreeData(request.getProjectId(), request.getProtocol()); @@ -812,7 +812,7 @@ public class ApiDefinitionImportUtilService { public List buildTreeData(String projectId, String protocol) { ApiModuleRequest request = new ApiModuleRequest(); request.setProjectId(projectId); - request.setProtocol(protocol); + request.setProtocols(List.of(protocol)); List apiModuleList = extApiDefinitionModuleMapper.selectBaseByRequest(request); return this.buildTreeAndCountResource(apiModuleList, true, Translator.get(UNPLANNED_API)); } diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionModuleService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionModuleService.java index 3d7a3af704..53b3e2f0c5 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionModuleService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionModuleService.java @@ -80,7 +80,7 @@ public class ApiDefinitionModuleService extends ModuleTreeService { public List getTreeOnlyIdsAndResourceCount(ApiModuleRequest request, List moduleCountDTOList) { //节点内容只有Id和parentId - + //构建模块树,并计算每个节点下的所有数量(包含子节点) request.setKeyword(null); request.setModuleIds(null); @@ -286,7 +286,7 @@ public class ApiDefinitionModuleService extends ModuleTreeService { example.createCriteria() .andProjectIdEqualTo(request.getProjectId()) .andDeletedEqualTo(true) - .andProtocolEqualTo(request.getProtocol()); + .andProtocolIn(request.getProtocols()); List apiDefinitions = apiDefinitionMapper.selectByExample(example); if (CollectionUtils.isEmpty(apiDefinitions)) { return new ArrayList<>(); @@ -315,7 +315,7 @@ public class ApiDefinitionModuleService extends ModuleTreeService { EnvApiTreeDTO envApiTreeDTO = new EnvApiTreeDTO(); ApiModuleRequest apiModuleRequest = new ApiModuleRequest(); apiModuleRequest.setProjectId(request.getProjectId()); - apiModuleRequest.setProtocol(ModuleConstants.NODE_PROTOCOL_HTTP); + apiModuleRequest.setProtocols(List.of(ModuleConstants.NODE_PROTOCOL_HTTP)); List fileModuleList = extApiDefinitionModuleMapper.selectBaseByRequest(apiModuleRequest); List baseTreeNodes = super.buildTreeAndCountResource(fileModuleList, true, Translator.get(UNPLANNED_API)); envApiTreeDTO.setModuleTree(baseTreeNodes); diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionService.java index 62740de3a1..353bebdf11 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDefinitionService.java @@ -291,7 +291,7 @@ public class ApiDefinitionService extends MoveNodeService { public void batchUpdate(ApiDefinitionBatchUpdateRequest request, String userId) { ProjectService.checkResourceExist(request.getProjectId()); - List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), false, userId); + List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId); // 记录更新前的数据 apiDefinitionLogService.batchUpdateLog(ids, userId, request.getProjectId()); if (CollectionUtils.isNotEmpty(ids)) { @@ -417,14 +417,14 @@ public class ApiDefinitionService extends MoveNodeService { } public void batchDeleteToGc(ApiDefinitionBatchDeleteRequest request, String userId) { - List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), false, userId); + List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId); if (CollectionUtils.isNotEmpty(ids)) { handleDeleteApiDefinition(ids, request.getDeleteAllVersion(), request.getProjectId(), userId, true); } } public void batchMove(ApiDefinitionBatchMoveRequest request, String userId) { - List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), false, userId); + List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), false, userId); if (!ids.isEmpty()) { // 移动接口所有版本引用的数据 List refIds = extApiDefinitionMapper.getRefIds(ids, false); @@ -805,14 +805,14 @@ public class ApiDefinitionService extends MoveNodeService { } public void batchRecover(ApiDefinitionBatchRequest request, String userId) { - List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), true, userId); + List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), true, userId); if (CollectionUtils.isNotEmpty(ids)) { handleRecoverApiDefinition(ids, userId, request.getProjectId(), true); } } public void batchDelete(ApiDefinitionBatchRequest request, String userId) { - List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocol(), true, userId); + List ids = getBatchApiIds(request, request.getProjectId(), request.getProtocols(), true, userId); if (CollectionUtils.isNotEmpty(ids)) { handleTrashDelApiDefinition(ids, userId, request.getProjectId(), true); } @@ -864,12 +864,12 @@ public class ApiDefinitionService extends MoveNodeService { } // 获取批量操作选中的ID - public List getBatchApiIds(T dto, String projectId, String protocol, boolean deleted, String userId) { + public List getBatchApiIds(T dto, String projectId, List protocols, boolean deleted, String userId) { TableBatchProcessDTO request = (TableBatchProcessDTO) dto; if (request.isSelectAll()) { // 全选 CustomFieldUtils.setBaseQueryRequestCustomMultipleFields(request.getCondition(), userId); - List ids = extApiDefinitionMapper.getIds(request, projectId, protocol, deleted); + List ids = extApiDefinitionMapper.getIds(request, projectId, protocols, deleted); if (CollectionUtils.isNotEmpty(request.getExcludeIds())) { ids.removeAll(request.getExcludeIds()); } diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java index 89319be923..1469124321 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionControllerTests.java @@ -689,6 +689,7 @@ public class ApiDefinitionControllerTests extends BaseTest { apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1001", "1002", "1005")); apiDefinitionBatchUpdateRequest.setExcludeIds(List.of("1005")); apiDefinitionBatchUpdateRequest.setSelectAll(false); + apiDefinitionBatchUpdateRequest.setProtocols(List.of("HTTP")); apiDefinitionBatchUpdateRequest.setType("tags"); // 修改标签,追加 apiDefinitionBatchUpdateRequest.setSelectIds(List.of("1001", "1002")); @@ -814,6 +815,7 @@ public class ApiDefinitionControllerTests extends BaseTest { request.setSelectIds(List.of("1001", "1002", "1005")); request.setExcludeIds(List.of("1005")); request.setSelectAll(false); + request.setProtocols(List.of("HTTP")); this.requestPostWithOkAndReturn(BATCH_MOVE, request); // @@校验日志 @@ -918,6 +920,7 @@ public class ApiDefinitionControllerTests extends BaseTest { request.setProjectId(DEFAULT_PROJECT_ID); request.setCurrent(1); request.setPageSize(10); + request.setProtocols(List.of("HTTP")); request.setDeleted(false); request.setSort(Map.of("createTime", "asc")); // "ALL", "KEYWORD", "FILTER", "COMBINE", "DELETED" @@ -1019,6 +1022,7 @@ public class ApiDefinitionControllerTests extends BaseTest { apiDefinition = apiDefinitionMapper.selectByPrimaryKey("1001"); request.setApiId(apiDefinition.getId()); request.setProjectId(DEFAULT_PROJECT_ID); + request.setProtocols(List.of("HTTP")); request.setType(ApiDefinitionDocType.API.name()); // @@请求成功 MvcResult mvcResult = this.requestPostWithOkAndReturn(DOC, request); @@ -1111,6 +1115,7 @@ public class ApiDefinitionControllerTests extends BaseTest { // @@模块查看文档 request.setApiId(null); request.setProjectId(DEFAULT_PROJECT_ID); + request.setProtocols(List.of("HTTP")); request.setType(ApiDefinitionDocType.MODULE.name()); request.setModuleIds(List.of("1001001")); MvcResult mvcResultModule = this.requestPostWithOkAndReturn(DOC, request); @@ -1325,6 +1330,7 @@ public class ApiDefinitionControllerTests extends BaseTest { request.setSelectIds(List.of("1004")); request.setDeleteAllVersion(false); request.setSelectAll(false); + request.setProtocols(List.of("HTTP")); this.requestPostWithOkAndReturn(BATCH_DELETE_TO_GC, request); // @@校验日志 checkLogModelList.add(new CheckLogModel("1004", OperationLogType.DELETE, BATCH_DELETE_TO_GC)); @@ -1399,6 +1405,7 @@ public class ApiDefinitionControllerTests extends BaseTest { LogUtils.info("batch recover api test"); ApiDefinitionBatchRequest request = new ApiDefinitionBatchRequest(); request.setProjectId(DEFAULT_PROJECT_ID); + request.setProtocols(List.of("HTTP")); // 恢复选中 request.setSelectIds(List.of("1002", "1004", "1005")); request.setExcludeIds(List.of("1005")); @@ -1480,6 +1487,7 @@ public class ApiDefinitionControllerTests extends BaseTest { LogUtils.info("batch trash delete api test"); ApiDefinitionBatchRequest request = new ApiDefinitionBatchRequest(); request.setProjectId(DEFAULT_PROJECT_ID); + request.setProtocols(List.of("HTTP")); // 删除选中 request.setSelectIds(List.of("1003")); diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionMockControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionMockControllerTests.java index 7683a9ebc0..d7a2e8fa1f 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionMockControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionMockControllerTests.java @@ -525,6 +525,7 @@ public class ApiDefinitionMockControllerTests extends BaseTest { request.setApiDefinitionId(apiDefinitionMock.getApiDefinitionId()); request.setCurrent(1); request.setPageSize(10); + request.setProtocols(List.of("HTTP")); request.setSort(Map.of("createTime", "asc")); // "ALL", "KEYWORD", "FILTER", "COMBINE", "DELETED" switch (search) { @@ -600,6 +601,7 @@ public class ApiDefinitionMockControllerTests extends BaseTest { request.setType("Tags"); request.setAppend(true); request.setSelectAll(true); + request.setProtocols(List.of("HTTP")); request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4"))); requestPostWithOkAndReturn(BATCH_EDIT, request); ApiDefinitionMockExample example = new ApiDefinitionMockExample(); diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionModuleControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionModuleControllerTests.java index dab483fcc4..973da83502 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionModuleControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiDefinitionModuleControllerTests.java @@ -815,7 +815,7 @@ public class ApiDefinitionModuleControllerTests extends BaseTest { public void TestModuleCountSuccess() throws Exception { this.preliminaryData(); ApiModuleRequest request = new ApiModuleRequest() {{ - this.setProtocol(ApiConstants.HTTP_PROTOCOL); + this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL)); this.setProjectId(project.getId()); }}; MvcResult moduleCountMvcResult = this.requestPostWithOkAndReturn(URL_FILE_MODULE_COUNT, request); @@ -879,7 +879,7 @@ public class ApiDefinitionModuleControllerTests extends BaseTest { apiDefinition.setDeleted(true); apiDefinitionMapper.updateByExampleSelective(apiDefinition, example); MvcResult result = this.requestPostWithOkAndReturn(URL_MODULE_TRASH_TREE, new ApiModuleRequest() {{ - this.setProtocol(ApiConstants.HTTP_PROTOCOL); + this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL)); this.setProjectId(project.getId()); }}); @@ -892,7 +892,7 @@ public class ApiDefinitionModuleControllerTests extends BaseTest { @Order(12) public void getModuleTrashTreeCount() throws Exception { ApiModuleRequest request = new ApiModuleRequest() {{ - this.setProtocol(ApiConstants.HTTP_PROTOCOL); + this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL)); this.setProjectId(project.getId()); }}; MvcResult moduleCountMvcResult = this.requestPostWithOkAndReturn(URL_MODULE_TRASH_COUNT, request); @@ -954,11 +954,11 @@ public class ApiDefinitionModuleControllerTests extends BaseTest { private List getModuleTreeNode() throws Exception { MvcResult result = this.requestPostWithOkAndReturn(URL_MODULE_TREE, new ApiModuleRequest() {{ - this.setProtocol(ApiConstants.HTTP_PROTOCOL); + this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL)); this.setProjectId(project.getId()); }}); this.requestPostWithOkAndReturn(URL_MODULE_ONLY_TREE, new ApiModuleRequest() {{ - this.setProtocol(ApiConstants.HTTP_PROTOCOL); + this.setProtocols(List.of(ApiConstants.HTTP_PROTOCOL)); this.setProjectId(project.getId()); }}); String returnData = result.getResponse().getContentAsString(StandardCharsets.UTF_8); diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java index ff54f3099e..abe394e709 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiScenarioControllerTests.java @@ -2829,7 +2829,7 @@ public class ApiScenarioControllerTests extends BaseTest { ScenarioSystemRequest scenarioSystemRequest = new ScenarioSystemRequest(); scenarioSystemRequest.setProjectId(DEFAULT_PROJECT_ID); - scenarioSystemRequest.setProtocol("HTTP"); + scenarioSystemRequest.setProtocols(List.of("HTTP")); scenarioSystemRequest.setModuleIds(List.of("test-default")); ApiScenarioSystemRequest apiScenarioSystemRequest = new ApiScenarioSystemRequest(); apiScenarioSystemRequest.setApiRequest(scenarioSystemRequest); diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java index 5d016045da..8801ec9203 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/ApiTestCaseControllerTests.java @@ -508,6 +508,7 @@ public class ApiTestCaseControllerTests extends BaseTest { apiRunModeRequest.setIntegratedReportName("aaaa"); apiRunModeRequest.setPoolId("poolId"); request.setRunModeConfig(apiRunModeRequest); + request.setProtocols(List.of("HTTP")); this.requestPostWithOk(BATCH_RUN, request); apiRunModeRequest.setIntegratedReport(false); @@ -833,6 +834,7 @@ public class ApiTestCaseControllerTests extends BaseTest { pageRequest.setProjectId(DEFAULT_PROJECT_ID); pageRequest.setPageSize(10); pageRequest.setCurrent(1); + pageRequest.setProtocols(List.of("HTTP")); MvcResult mvcResult = requestPostWithOkAndReturn(PAGE, pageRequest); Pager returnPager = parseObjectFromMvcResult(mvcResult, Pager.class); //返回值不为空 @@ -912,6 +914,7 @@ public class ApiTestCaseControllerTests extends BaseTest { request.setType("Tags"); request.setAppend(true); request.setSelectAll(true); + request.setProtocols(List.of("HTTP")); request.setTags(new LinkedHashSet<>(List.of("tag1", "tag3", "tag4"))); requestPostWithOkAndReturn(BATCH_EDIT, request); ApiTestCaseExample example = new ApiTestCaseExample(); @@ -1086,6 +1089,7 @@ public class ApiTestCaseControllerTests extends BaseTest { pageRequest.setProjectId(DEFAULT_PROJECT_ID); pageRequest.setPageSize(10); pageRequest.setCurrent(1); + pageRequest.setProtocols(List.of("HTTP")); MvcResult mvcResult = requestPostWithOkAndReturn(TRASH_PAGE, pageRequest); Pager returnPager = parseObjectFromMvcResult(mvcResult, Pager.class); //返回值不为空 @@ -1137,6 +1141,7 @@ public class ApiTestCaseControllerTests extends BaseTest { request.setSelectAll(false); request.setSelectIds(List.of(apiTestCase.getId())); request.setExcludeIds(List.of(apiTestCase.getId())); + request.setProtocols(List.of("HTTP")); requestPostWithOkAndReturn(BATCH_RECOVER, request); ApiDefinition apiDefinition = new ApiDefinition(); diff --git a/backend/services/api-test/src/test/java/io/metersphere/api/controller/AssociateApiProviderTest.java b/backend/services/api-test/src/test/java/io/metersphere/api/controller/AssociateApiProviderTest.java index a823e0034f..44043c3a7a 100644 --- a/backend/services/api-test/src/test/java/io/metersphere/api/controller/AssociateApiProviderTest.java +++ b/backend/services/api-test/src/test/java/io/metersphere/api/controller/AssociateApiProviderTest.java @@ -19,7 +19,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@SpringBootTest(webEnvironment= SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @AutoConfigureMockMvc public class AssociateApiProviderTest extends BaseTest { @@ -36,6 +36,7 @@ public class AssociateApiProviderTest extends BaseTest { request.setProjectId("project-associate-case-test"); request.setCurrent(1); request.setPageSize(10); + request.setProtocols(List.of("HTTP")); request.setSort(new HashMap<>() {{ put("createTime", "desc"); }}); @@ -53,6 +54,7 @@ public class AssociateApiProviderTest extends BaseTest { request.setProjectId("project-associate-case-test"); request.setCurrent(1); request.setPageSize(10); + request.setProtocols(List.of("HTTP")); request.setSort(new HashMap<>() {{ put("createTime", "desc"); }}); @@ -69,6 +71,7 @@ public class AssociateApiProviderTest extends BaseTest { request.setSourceType("API"); request.setSourceId("gyq_associate_case_id_1"); request.setSelectAll(true); + request.setProtocols(List.of("HTTP")); request.setProjectId("project-associate-case-test"); request.setExcludeIds(List.of("gyq_associate_api_case_id_2")); List apiTestCases = provider.getSelectApiTestCases(request, false); diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java index cb6f29edb0..e0bdde030d 100644 --- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java +++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java @@ -114,6 +114,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest { request.setProjectId("project_gyq_associate_test"); request.setCurrent(1); request.setPageSize(10); + request.setProtocols(List.of("HTTP")); request.setSort(new HashMap<>() {{ put("createTime", "desc"); }}); @@ -162,6 +163,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest { request.setProjectId("project_gyq_associate_test"); request.setCurrent(1); request.setPageSize(10); + request.setProtocols(List.of("HTTP")); List apiTestCaseList = provider.getApiTestCaseList("functional_case_test", "case_id", "source_id", request); MvcResult mvcResult = this.requestPostWithOkAndReturn(URL_CASE_PAGE, request); String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); @@ -195,6 +197,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest { request.setProjectId("project_gyq_associate_test"); request.setCurrent(1); request.setPageSize(10); + request.setProtocols(List.of("HTTP")); MvcResult mvcResult = this.requestPostWithOkAndReturn(URL_CASE_PAGE_MODULE_COUNT, request); String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class); @@ -592,7 +595,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest { testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis()); testPlanCaseExecuteHistoryMapper.insertSelective(testPlanCaseExecuteHistory); gyqReviewCaseTest = getPlanExecuteHistoryList("gyq_associate_function_case"); - Assertions.assertTrue(gyqReviewCaseTest.size()>1); + Assertions.assertTrue(gyqReviewCaseTest.size() > 1); } public List getPlanExecuteHistoryList(String caseId) throws Exception { diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanApiCaseBatchRequest.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanApiCaseBatchRequest.java index 671a385d8e..ff43365321 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanApiCaseBatchRequest.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanApiCaseBatchRequest.java @@ -1,6 +1,7 @@ package io.metersphere.plan.dto.request; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotEmpty; import lombok.Data; @@ -13,5 +14,5 @@ import java.util.List; public class TestPlanApiCaseBatchRequest extends BasePlanCaseBatchRequest { @Schema(description = "接口协议", requiredMode = Schema.RequiredMode.REQUIRED) @NotEmpty(message = "{api_definition.protocol.not_blank}") - private List protocols; + private List<@NotBlank String> protocols; } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml index 2c360b4e95..9ecd35d1eb 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanApiCaseMapper.xml @@ -128,9 +128,12 @@ and api_definition.project_id = #{request.projectId} - + + AND api_definition.protocol in + + #{protocol} + + @@ -437,9 +440,12 @@ - + + and a.protocol in + + #{protocol} + + and atc.api_definition_id = #{request.apiDefinitionId} @@ -639,7 +645,6 @@ - + + \ No newline at end of file diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanTaskCenterService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanTaskCenterService.java index 87ad4ce1a2..4e42110560 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanTaskCenterService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanTaskCenterService.java @@ -23,6 +23,7 @@ import io.metersphere.system.service.UserLoginService; import io.metersphere.system.utils.PageUtils; import io.metersphere.system.utils.Pager; import jakarta.annotation.Resource; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.kafka.core.KafkaTemplate; @@ -113,15 +114,18 @@ public class TestPlanTaskCenterService { public List getPage(TaskCenterPageRequest request, List projectList, boolean isSystem) { List list = new ArrayList<>(); List projectIds = projectList.stream().map(OptionDTO::getId).toList(); - Map historyDeletedMap = new HashMap<>(); - list = extTestPlanReportMapper.taskCenterlist(request, isSystem ? new ArrayList<>() : projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); - //执行历史列表 + if (CollectionUtils.isNotEmpty(projectIds)) { + Map historyDeletedMap = new HashMap<>(); + list = extTestPlanReportMapper.taskCenterlist(request, isSystem ? new ArrayList<>() : projectIds, DateUtils.getDailyStartTime(), DateUtils.getDailyEndTime()); + //执行历史列表 /*List reportIds = list.stream().map(TaskCenterDTO::getId).toList(); if (CollectionUtils.isNotEmpty(reportIds)) { List historyDeletedList = extTestPlanReportMapper.getHistoryDeleted(reportIds); historyDeletedMap = historyDeletedList.stream().collect(Collectors.toMap(ExecuteReportDTO::getId, Function.identity())); }*/ - processTaskCenter(list, projectList, projectIds, historyDeletedMap); + processTaskCenter(list, projectList, projectIds, historyDeletedMap); + } + return list; } @@ -186,5 +190,5 @@ public class TestPlanTaskCenterService { throw new MSException(Translator.get("organization_not_exist")); } } - + } diff --git a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiCaseControllerTests.java b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiCaseControllerTests.java index 32a1da54e0..3e5b3a8c82 100644 --- a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiCaseControllerTests.java +++ b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanApiCaseControllerTests.java @@ -36,7 +36,7 @@ public class TestPlanApiCaseControllerTests extends BaseTest { request.setPageSize(10); request.setTestPlanId("wxxx_1"); request.setProjectId("wxx_1234"); - request.setProtocol("HTTP"); + request.setProtocols(List.of("HTTP")); this.requestPost(API_CASE_PAGE, request); request.setSort(new HashMap<>() {{ put("createTime", "desc"); @@ -54,7 +54,7 @@ public class TestPlanApiCaseControllerTests extends BaseTest { TestPlanApiCaseModuleRequest request = new TestPlanApiCaseModuleRequest(); request.setTestPlanId("wxxx_1"); request.setProjectId("wxx_1234"); - request.setProtocol("HTTP"); + request.setProtocols(List.of("HTTP")); request.setCurrent(1); request.setPageSize(10); request.setTreeType("MODULE"); diff --git a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanAssociateControllerTests.java b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanAssociateControllerTests.java index 900076c612..05c98cf99f 100644 --- a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanAssociateControllerTests.java +++ b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanAssociateControllerTests.java @@ -15,6 +15,7 @@ import org.springframework.test.web.servlet.MvcResult; import java.nio.charset.StandardCharsets; import java.util.HashMap; +import java.util.List; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @@ -54,6 +55,7 @@ public class TestPlanAssociateControllerTests extends BaseTest { request.setPageSize(10); request.setTestPlanId("wxx_1"); request.setProjectId("1234567"); + request.setProtocols(List.of("HTTP")); this.requestPost(API_ASSOCIATION_URL, request); request.setProjectId("wx_1234"); this.requestPost(API_ASSOCIATION_URL, request); @@ -74,6 +76,7 @@ public class TestPlanAssociateControllerTests extends BaseTest { request.setPageSize(10); request.setProjectId("1234567"); request.setTestPlanId("wxx_1"); + request.setProtocols(List.of("HTTP")); this.requestPost(API_CASE_ASSOCIATION_URL, request); request.setProjectId("wx_1234"); this.requestPost(API_CASE_ASSOCIATION_URL, request); diff --git a/frontend/src/views/api-test/management/components/management/api/apiTable.vue b/frontend/src/views/api-test/management/components/management/api/apiTable.vue index c96c15027e..457e0ad2b7 100644 --- a/frontend/src/views/api-test/management/components/management/api/apiTable.vue +++ b/frontend/src/views/api-test/management/components/management/api/apiTable.vue @@ -383,6 +383,13 @@ width: 200, columnSelectorDisabled: true, }, + { + title: 'apiTestManagement.protocol', + dataIndex: 'protocol', + showTooltip: true, + width: 200, + showDrag: true, + }, { title: 'apiTestManagement.apiType', dataIndex: 'method', @@ -494,6 +501,7 @@ return item; }); } + await initFilterColumn(); await tableStore.initColumn(TableKeyEnum.API_TEST, columns, 'drawer', true); if (props.readOnly) { @@ -964,12 +972,15 @@ :deep(.param-input:not(.arco-input-focus, .arco-select-view-focus)) { &:not(:hover) { border-color: transparent !important; + .arco-input::placeholder { @apply invisible; } + .arco-select-view-icon { @apply invisible; } + .arco-select-view-value { color: var(--color-text-brand); } diff --git a/frontend/src/views/api-test/management/components/management/case/caseTable.vue b/frontend/src/views/api-test/management/components/management/case/caseTable.vue index 23a33839b0..2619e7859f 100644 --- a/frontend/src/views/api-test/management/components/management/case/caseTable.vue +++ b/frontend/src/views/api-test/management/components/management/case/caseTable.vue @@ -400,6 +400,13 @@ width: 180, columnSelectorDisabled: true, }, + { + title: 'apiTestManagement.protocol', + dataIndex: 'protocol', + showTooltip: true, + width: 200, + showDrag: true, + }, { title: 'case.caseLevel', dataIndex: 'priority', diff --git a/frontend/src/views/api-test/management/components/management/mock/mockTable.vue b/frontend/src/views/api-test/management/components/management/mock/mockTable.vue index d5926062a5..74d734f115 100644 --- a/frontend/src/views/api-test/management/components/management/mock/mockTable.vue +++ b/frontend/src/views/api-test/management/components/management/mock/mockTable.vue @@ -286,6 +286,13 @@ width: 200, showDrag: true, }, + { + title: 'apiTestManagement.protocol', + dataIndex: 'protocol', + showTooltip: true, + width: 200, + showDrag: true, + }, { title: 'mockManagement.apiPath', dataIndex: 'apiPath', diff --git a/frontend/src/views/api-test/management/components/recycle/api/apiTable.vue b/frontend/src/views/api-test/management/components/recycle/api/apiTable.vue index 1562ffe303..db839e77bf 100644 --- a/frontend/src/views/api-test/management/components/recycle/api/apiTable.vue +++ b/frontend/src/views/api-test/management/components/recycle/api/apiTable.vue @@ -173,6 +173,13 @@ width: 200, columnSelectorDisabled: true, }, + { + title: 'apiTestManagement.protocol', + dataIndex: 'protocol', + showTooltip: true, + width: 200, + showDrag: true, + }, { title: 'apiTestManagement.apiType', dataIndex: 'method', diff --git a/frontend/src/views/api-test/management/components/recycle/case/caseTable.vue b/frontend/src/views/api-test/management/components/recycle/case/caseTable.vue index 20a49e326a..76fd2f93bd 100644 --- a/frontend/src/views/api-test/management/components/recycle/case/caseTable.vue +++ b/frontend/src/views/api-test/management/components/recycle/case/caseTable.vue @@ -181,6 +181,13 @@ width: 180, columnSelectorDisabled: true, }, + { + title: 'apiTestManagement.protocol', + dataIndex: 'protocol', + showTooltip: true, + width: 200, + showDrag: true, + }, { title: 'case.caseLevel', dataIndex: 'priority', diff --git a/frontend/src/views/api-test/management/locale/en-US.ts b/frontend/src/views/api-test/management/locale/en-US.ts index aa3b953ca4..3330595bd6 100644 --- a/frontend/src/views/api-test/management/locale/en-US.ts +++ b/frontend/src/views/api-test/management/locale/en-US.ts @@ -40,6 +40,7 @@ export default { 'apiTestManagement.apiType': 'Method', 'apiTestManagement.apiStatus': 'Status', 'apiTestManagement.path': 'Path', + 'apiTestManagement.protocol': 'Protocol', 'apiTestManagement.version': 'Version', 'apiTestManagement.createTime': 'Creation Time', 'apiTestManagement.updateTime': 'Update Time', diff --git a/frontend/src/views/api-test/management/locale/zh-CN.ts b/frontend/src/views/api-test/management/locale/zh-CN.ts index 150f2d3b6a..b07572a41d 100644 --- a/frontend/src/views/api-test/management/locale/zh-CN.ts +++ b/frontend/src/views/api-test/management/locale/zh-CN.ts @@ -39,6 +39,7 @@ export default { 'apiTestManagement.apiType': '请求类型', 'apiTestManagement.apiStatus': '状态', 'apiTestManagement.path': '路径', + 'apiTestManagement.protocol': '协议', 'apiTestManagement.version': '版本', 'apiTestManagement.createTime': '创建时间', 'apiTestManagement.updateTime': '更新时间',