From 72383aa6c3e13bd35d9569e5b7126e520fe970e8 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 16 Jan 2024 11:41:31 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B):=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96=E4=B8=89=E6=96=B9=E9=9C=80?= =?UTF-8?q?=E6=B1=82=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../provider/BaseAssociateApiProvider.java | 3 +- .../AssociateCaseModuleProviderRequest.java | 37 ---------- .../mapper/ExtApiDefinitionModuleMapper.java | 6 -- .../mapper/ExtApiDefinitionModuleMapper.xml | 71 ------------------- .../api/mapper/ExtApiTestCaseMapper.java | 6 ++ .../api/mapper/ExtApiTestCaseMapper.xml | 20 ++++++ .../api/provider/AssociateApiProvider.java | 15 ++-- .../controller/AssociateApiProviderTest.java | 12 ++-- .../FunctionalCaseDemandController.java | 10 +++ .../FunctionalTestCaseController.java | 4 +- .../mapper/ExtFunctionalCaseModuleMapper.java | 1 + .../mapper/ExtFunctionalCaseModuleMapper.xml | 12 ++++ .../request/AssociateCaseModuleRequest.java | 1 + .../FunctionalThirdDemandPageRequest.java | 33 +++++++++ .../service/FunctionalCaseDemandService.java | 19 +++++ .../service/FunctionalTestCaseService.java | 14 ++-- .../FunctionalCaseDemandControllerTests.java | 55 ++++++++++++++ .../FunctionalTestCaseControllerTests.java | 6 +- .../test/resources/dml/init_case_demand.sql | 12 +++- .../system/base/BasePluginTestService.java | 7 +- 20 files changed, 200 insertions(+), 144 deletions(-) delete mode 100644 backend/framework/provider/src/main/java/io/metersphere/request/AssociateCaseModuleProviderRequest.java create mode 100644 backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalThirdDemandPageRequest.java diff --git a/backend/framework/provider/src/main/java/io/metersphere/provider/BaseAssociateApiProvider.java b/backend/framework/provider/src/main/java/io/metersphere/provider/BaseAssociateApiProvider.java index ef2268747e..7ef5a997d9 100644 --- a/backend/framework/provider/src/main/java/io/metersphere/provider/BaseAssociateApiProvider.java +++ b/backend/framework/provider/src/main/java/io/metersphere/provider/BaseAssociateApiProvider.java @@ -2,7 +2,6 @@ package io.metersphere.provider; import io.metersphere.api.domain.ApiTestCase; import io.metersphere.dto.TestCaseProviderDTO; -import io.metersphere.request.AssociateCaseModuleProviderRequest; import io.metersphere.request.AssociateOtherCaseRequest; import io.metersphere.request.TestCasePageProviderRequest; @@ -31,7 +30,7 @@ public interface BaseAssociateApiProvider { * @param deleted 接口定义是否删除 * @return 接口模块统计数量 */ - Map moduleCount(String sourceType, String sourceName, String apiCaseColumnName, AssociateCaseModuleProviderRequest request, boolean deleted); + Map moduleCount(String sourceType, String sourceName, String apiCaseColumnName, TestCasePageProviderRequest request, boolean deleted); /** * 根据页面筛选条件获取批量操作的用例 diff --git a/backend/framework/provider/src/main/java/io/metersphere/request/AssociateCaseModuleProviderRequest.java b/backend/framework/provider/src/main/java/io/metersphere/request/AssociateCaseModuleProviderRequest.java deleted file mode 100644 index 045b6f36eb..0000000000 --- a/backend/framework/provider/src/main/java/io/metersphere/request/AssociateCaseModuleProviderRequest.java +++ /dev/null @@ -1,37 +0,0 @@ -package io.metersphere.request; - -import io.metersphere.sdk.constants.ModuleConstants; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; -import lombok.Data; - -import java.util.List; - -@Data -public class AssociateCaseModuleProviderRequest { - - @Schema(description = "关联关系表里主ID eg:功能用例关联接口用例时为功能用例id") - @NotBlank(message = "{api_definition.project_id.not_blank}") - @Size(min = 1, max = 50, message = "{api_definition.project_id.length_range}") - private String sourceId; - - @Schema(description = "模块ID(根据模块树查询时要把当前节点以及子节点都放在这里。)") - 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; - - @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}") - private String projectId; - - @Schema(description = "用例关键字") - private String keyword; - - @Schema(description = "模块关键字") - private String moduleKeyword; -} diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.java b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.java index 8d0bd002bc..b2b06b7bc4 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDefinitionModuleMapper.java @@ -4,7 +4,6 @@ import io.metersphere.api.dto.debug.ApiTreeNode; import io.metersphere.api.dto.definition.ApiModuleRequest; import io.metersphere.project.dto.ModuleCountDTO; import io.metersphere.project.dto.NodeSortQueryParam; -import io.metersphere.request.AssociateCaseModuleProviderRequest; import io.metersphere.system.dto.sdk.BaseModule; import io.metersphere.system.dto.sdk.BaseTreeNode; import org.apache.ibatis.annotations.Param; @@ -35,9 +34,4 @@ public interface ExtApiDefinitionModuleMapper { List selectNodeByIds(@Param("ids") List ids); List selectBaseByIds(@Param("ids") List ids); - - List countModuleIdByProviderRequest(@Param("table") String resourceType, @Param("sourceName") String sourceName, @Param("apiCaseColumnName") String apiCaseColumnName, @Param("request") AssociateCaseModuleProviderRequest request, @Param("deleted") boolean deleted); - - List selectIdAndParentIdByProviderRequest(@Param("request") AssociateCaseModuleProviderRequest request); - } 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 919c3a174e..d683ab83ea 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 @@ -116,58 +116,6 @@ ORDER BY pos - - - - - - - - ad.deleted = #{deleted} - - AND ad.project_id = #{request.projectId} - - - AND atc.name like CONCAT('%', #{request.keyword},'%') - - - AND ad.module_id IN - - #{item} - - - - AND ad.protocol = #{request.protocol} - - AND ad.latest = 1 - - - - - @@ -395,23 +343,4 @@ - - - - - AND m.project_id = #{request.projectId} - - - AND m.name like CONCAT('%', #{request.moduleKeyword},'%') - - - AND m.id IN - - #{item} - - - - - - \ No newline at end of file diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java index 45169cd337..99004b2421 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiTestCaseMapper.java @@ -7,8 +7,10 @@ import io.metersphere.api.dto.definition.ApiTestCaseDTO; import io.metersphere.api.dto.definition.ApiTestCasePageRequest; import io.metersphere.api.dto.definition.CasePassDTO; import io.metersphere.dto.TestCaseProviderDTO; +import io.metersphere.project.dto.ModuleCountDTO; import io.metersphere.request.AssociateOtherCaseRequest; import io.metersphere.request.TestCasePageProviderRequest; +import io.metersphere.system.dto.sdk.BaseTreeNode; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -47,6 +49,10 @@ public interface ExtApiTestCaseMapper { List listByProviderRequest(@Param("table") String resourceType, @Param("sourceName") String sourceName, @Param("apiCaseColumnName") String apiCaseColumnName, @Param("request") TestCasePageProviderRequest request, @Param("deleted") boolean deleted); + List countModuleIdByProviderRequest(@Param("table") String resourceType, @Param("sourceName") String sourceName, @Param("apiCaseColumnName") String apiCaseColumnName, @Param("request") TestCasePageProviderRequest request, @Param("deleted") boolean deleted); + + List selectIdAndParentIdByProjectId(@Param("projectId") String projectId); + List getTestCaseByProvider(@Param("request") AssociateOtherCaseRequest request, @Param("deleted") boolean deleted); 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 42cf4a3377..1fca392628 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 @@ -185,6 +185,26 @@ + + + + + +