From 5bebf4fe7c1183ab15fef4cf3cd2174161e5c28d Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Sun, 4 Feb 2024 16:04:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=94=A8=E4=BE=8B=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96=E9=9C=80=E6=B1=82=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/functional/dto/DemandDTO.java | 2 +- .../mapper/ExtFunctionalCaseDemandMapper.java | 4 +-- .../mapper/ExtFunctionalCaseDemandMapper.xml | 29 +------------------ .../service/FunctionalCaseDemandService.java | 4 +-- .../FunctionalCaseDemandControllerTests.java | 3 -- 5 files changed, 5 insertions(+), 37 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/DemandDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/DemandDTO.java index 4f849d6d54..7d6bf597fe 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/DemandDTO.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/DemandDTO.java @@ -18,7 +18,7 @@ public class DemandDTO implements Serializable { @Schema(description = "需求ID") private String demandId; - @Schema(description = "需求ID") + @Schema(description = "父需求ID") private String parent; @Schema(description = "需求标题", requiredMode = Schema.RequiredMode.REQUIRED) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseDemandMapper.java b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseDemandMapper.java index 52b105cbba..96cee2fef3 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseDemandMapper.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseDemandMapper.java @@ -1,6 +1,5 @@ package io.metersphere.functional.mapper; -import io.metersphere.functional.domain.FunctionalCaseDemand; import io.metersphere.functional.dto.FunctionalDemandDTO; import org.apache.ibatis.annotations.Param; @@ -11,7 +10,6 @@ import java.util.List; */ public interface ExtFunctionalCaseDemandMapper { - List selectGroupByKeyword(@Param("keyword") String keyword, @Param("caseId") String caseId); - List selectByKeyword(@Param("keyword") String keyword, @Param("caseId") String caseId, @Param("platforms") List platforms, @Param("ids") List ids); + List selectParentDemandByKeyword(@Param("keyword") String keyword, @Param("caseId") String caseId); } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseDemandMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseDemandMapper.xml index cb43aed85e..68814530bf 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseDemandMapper.xml +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseDemandMapper.xml @@ -2,7 +2,7 @@ - SELECT * FROM functional_case_demand @@ -14,33 +14,6 @@ (functional_case_demand.demand_name LIKE CONCAT('%', #{keyword}, '%')) ) - GROUP BY functional_case_demand.demand_platform - - - \ No newline at end of file diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java index 88f5887abf..b3b60bc4d3 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseDemandService.java @@ -60,14 +60,14 @@ public class FunctionalCaseDemandService { * @return List */ public List listFunctionalCaseDemands(QueryDemandListRequest request) { - List parentDemands = extFunctionalCaseDemandMapper.selectGroupByKeyword(request.getKeyword(), request.getCaseId()); + List parentDemands = extFunctionalCaseDemandMapper.selectParentDemandByKeyword(request.getKeyword(), request.getCaseId()); if (CollectionUtils.isEmpty(parentDemands)) { return new ArrayList<>(); } + Map functionalCaseDemandMap = parentDemands.stream().filter(t -> StringUtils.isNotBlank(t.getDemandId())).collect(Collectors.toMap(FunctionalCaseDemand::getDemandId, t -> t)); List ids = parentDemands.stream().map(FunctionalCaseDemand::getId).toList(); FunctionalCaseDemandExample functionalCaseDemandExample = new FunctionalCaseDemandExample(); functionalCaseDemandExample.createCriteria().andIdNotIn(ids); - Map functionalCaseDemandMap = parentDemands.stream().filter(t -> StringUtils.isNotBlank(t.getDemandId())).collect(Collectors.toMap(FunctionalCaseDemand::getDemandId, t -> t)); List functionalCaseDemands = functionalCaseDemandMapper.selectByExample(functionalCaseDemandExample); int lastSize = 0; while (CollectionUtils.isNotEmpty(functionalCaseDemands) && functionalCaseDemands.size() != lastSize) { diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseDemandControllerTests.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseDemandControllerTests.java index 7ccc390986..fdb73b959b 100644 --- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseDemandControllerTests.java +++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseDemandControllerTests.java @@ -20,7 +20,6 @@ import io.metersphere.system.base.BaseTest; import io.metersphere.system.controller.handler.ResultHolder; import io.metersphere.system.domain.SystemParameter; import io.metersphere.system.log.constants.OperationLogType; -import io.metersphere.system.mapper.ServiceIntegrationMapper; import io.metersphere.system.mapper.SystemParameterMapper; import io.metersphere.system.utils.Pager; import jakarta.annotation.Resource; @@ -59,8 +58,6 @@ public class FunctionalCaseDemandControllerTests extends BaseTest { @Resource private SystemParameterMapper systemParameterMapper; @Resource - private ServiceIntegrationMapper serviceIntegrationMapper; - @Resource private BasePluginTestService basePluginTestService; @Resource private MockServerClient mockServerClient;