From a1cc2092f1932d73fec98a95c6659ddc85bb3af1 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 21 Jun 2024 14:31:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B):=20tr?= =?UTF-8?q?ee=20=E4=B8=8D=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FunctionalCaseMinderController.java | 7 ++----- .../request/FunctionalCaseMindTreeRequest.java | 16 ++++++++++++++++ .../service/FunctionalCaseMinderService.java | 2 +- .../FunctionalCaseMinderControllerTest.java | 3 +-- 4 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseMindTreeRequest.java diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseMinderController.java b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseMinderController.java index 6c5511f96c..d1a289d492 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseMinderController.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalCaseMinderController.java @@ -4,10 +4,7 @@ import com.alibaba.excel.util.StringUtils; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.functional.dto.FunctionalMinderTreeDTO; -import io.metersphere.functional.request.FunctionalCaseMindRequest; -import io.metersphere.functional.request.FunctionalCaseMinderEditRequest; -import io.metersphere.functional.request.FunctionalCasePlanMindRequest; -import io.metersphere.functional.request.FunctionalCaseReviewMindRequest; +import io.metersphere.functional.request.*; import io.metersphere.functional.service.FunctionalCaseMinderService; import io.metersphere.sdk.constants.PermissionConstants; import io.metersphere.system.dto.sdk.BaseTreeNode; @@ -42,7 +39,7 @@ public class FunctionalCaseMinderController { @Operation(summary = "用例管理-功能用例-脑图-获取空白节点和模块的组合树") @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ) @CheckOwner(resourceId = "#projectId", resourceType = "project") - public List getTree(@Validated @RequestBody FunctionalCaseMindRequest request) { + public List getTree(@Validated @RequestBody FunctionalCaseMindTreeRequest request) { return functionalCaseMinderService.getTree(request); } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseMindTreeRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseMindTreeRequest.java new file mode 100644 index 0000000000..249a95a6df --- /dev/null +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCaseMindTreeRequest.java @@ -0,0 +1,16 @@ +package io.metersphere.functional.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class FunctionalCaseMindTreeRequest { + @Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{functional_case.project_id.not_blank}") + private String projectId; + + @Schema(description = "模块ID", requiredMode = Schema.RequiredMode.REQUIRED) + private String moduleId; + +} diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java index b8dc6d8d7f..e52efe8260 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java @@ -1162,7 +1162,7 @@ public class FunctionalCaseMinderService { } - public List getTree(FunctionalCaseMindRequest request) { + public List getTree(FunctionalCaseMindTreeRequest request) { List functionalModuleList = extFunctionalCaseModuleMapper.selectBaseByProjectId(request.getProjectId()); List baseTreeNodes = extFunctionalCaseMapper.selectBaseMindNodeByProjectId(request.getProjectId()); functionalModuleList.addAll(baseTreeNodes); diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseMinderControllerTest.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseMinderControllerTest.java index 6b4069199f..cb4dd8add0 100644 --- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseMinderControllerTest.java +++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseMinderControllerTest.java @@ -334,9 +334,8 @@ public class FunctionalCaseMinderControllerTest extends BaseTest { @Test @Order(3) public void testGetCaseModuleNodeList() throws Exception { - FunctionalCaseMindRequest request = new FunctionalCaseMindRequest(); + FunctionalCaseMindTreeRequest request = new FunctionalCaseMindTreeRequest(); request.setProjectId("project-case-minder-test"); - request.setCurrent(1); MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_NODE_MODULE_URL, request); String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8); ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class);