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 c1b7adceb4..280b3c20f2 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,6 +4,7 @@ import com.alibaba.excel.util.StringUtils; 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.service.FunctionalCaseMinderService; import io.metersphere.sdk.constants.PermissionConstants; @@ -69,4 +70,12 @@ public class FunctionalCaseMinderController { return functionalCaseMinderService.getReviewMindFunctionalCase(request, false, userId, viewStatusUserId); } + @PostMapping("/plan/list") + @Operation(summary = "测试计划-功能用例-脑图用例跟根据模块ID查询列表") + @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_MINDER) + @CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project") + public List getPlanFunctionalCaseMinderTree(@Validated @RequestBody FunctionalCasePlanMindRequest request) { + return functionalCaseMinderService.getPlanMindFunctionalCase(request, false); + } + } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.java b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.java index 596728c13e..66e49d204e 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.java @@ -3,10 +3,7 @@ package io.metersphere.functional.mapper; import io.metersphere.dto.TestCaseProviderDTO; import io.metersphere.functional.domain.FunctionalCase; import io.metersphere.functional.dto.*; -import io.metersphere.functional.request.FunctionalCaseBatchMoveRequest; -import io.metersphere.functional.request.FunctionalCaseMindRequest; -import io.metersphere.functional.request.FunctionalCasePageRequest; -import io.metersphere.functional.request.FunctionalCaseReviewMindRequest; +import io.metersphere.functional.request.*; import io.metersphere.project.dto.ModuleCountDTO; import io.metersphere.request.AssociateOtherCaseRequest; import io.metersphere.request.TestCasePageProviderRequest; @@ -90,4 +87,7 @@ public interface ExtFunctionalCaseMapper { */ List getMinderCaseReviewList(@Param("request") FunctionalCaseReviewMindRequest request, @Param("deleted") boolean delete, @Param("userId") String userId, @Param("viewStatusUserId") String viewStatusUserId); + List getMinderTestPlanList(@Param("request") FunctionalCasePlanMindRequest request, @Param("deleted") boolean delete); + + } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml index 2a7314f60f..1d827a0ea9 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseMapper.xml @@ -813,7 +813,7 @@ + + \ No newline at end of file diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCasePlanMindRequest.java b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCasePlanMindRequest.java new file mode 100644 index 0000000000..f3799ce71f --- /dev/null +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/request/FunctionalCasePlanMindRequest.java @@ -0,0 +1,15 @@ +package io.metersphere.functional.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class FunctionalCasePlanMindRequest extends FunctionalCaseMindRequest { + + @Schema(description = "测试计划id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_functional_case.test_plan_id.not_blank}") + private String planId; + + +} 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 182f333d03..9ddfee22cf 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 @@ -782,4 +782,14 @@ public class FunctionalCaseMinderService { } + public List getPlanMindFunctionalCase(FunctionalCasePlanMindRequest request, boolean deleted) { + List list = new ArrayList<>(); + //查出当前模块下的所有用例 + List functionalCaseMindDTOList = extFunctionalCaseMapper.getMinderTestPlanList(request, deleted); + //构造父子级数据 + buildList(functionalCaseMindDTOList, list); + return list; + } + + } 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 0e32844cb2..62f86ecd69 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 @@ -41,6 +41,10 @@ public class FunctionalCaseMinderControllerTest extends BaseTest { //评审 public static final String FUNCTIONAL_CASE_REVIEW_LIST_URL = "/functional/mind/case/review/list"; + //测试计划 + public static final String FUNCTIONAL_CASE_PLAN_LIST_URL = "/functional/mind/case/plan/list"; + + @Resource private FunctionalCaseBlobMapper functionalCaseBlobMapper; @@ -261,4 +265,20 @@ public class FunctionalCaseMinderControllerTest extends BaseTest { Assertions.assertEquals(1, baseTreeNodes.size()); } + @Test + @Order(4) + public void testGetCasePlanList() throws Exception { + FunctionalCasePlanMindRequest request = new FunctionalCasePlanMindRequest(); + request.setProjectId("project-case-minder-test"); + request.setModuleId("TEST_MINDER_MODULE_ID_GYQ4"); + request.setPlanId("TEST_MINDER_PLAN_ID_1"); + MvcResult mvcResultPage = this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_PLAN_LIST_URL, request); + String contentAsString = mvcResultPage.getResponse().getContentAsString(StandardCharsets.UTF_8); + ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class); + List baseTreeNodes = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), FunctionalMinderTreeDTO.class); + Assertions.assertNotNull(baseTreeNodes); + Assertions.assertEquals(2, baseTreeNodes.size()); + System.out.println(baseTreeNodes); + } + } diff --git a/backend/services/case-management/src/test/resources/dml/init_file_minder_test.sql b/backend/services/case-management/src/test/resources/dml/init_file_minder_test.sql index c52fcbb495..06aed5622d 100644 --- a/backend/services/case-management/src/test/resources/dml/init_file_minder_test.sql +++ b/backend/services/case-management/src/test/resources/dml/init_file_minder_test.sql @@ -47,6 +47,12 @@ VALUES ; +INSERT INTO test_plan(id, num, project_id, group_id, module_id, name, status, type, tags, create_time, create_user, update_time, update_user, planned_start_time, planned_end_time, actual_start_time, actual_end_time, description) + VALUE ('TEST_MINDER_PLAN_ID_1', 1000, 'project-case-minder-test', 'none', 'TEST_MINDER_PLAN_MODULE', '脑图测试计划', 'PREPARED', 'TEST_PLAN', null, 1669174143999, 'admin', 1669174143999, 'admin', null, null, null,null,null); + +INSERT INTO test_plan_functional_case(id, test_plan_id, functional_case_id, create_time, create_user, execute_user, last_exec_time, last_exec_result, pos) + VALUES ('test_plan_functional_case_minder_id1', 'TEST_MINDER_PLAN_ID_1', 'TEST_FUNCTIONAL_MINDER_CASE_ID_5', 1669174143999, 'admin', 'admin', 1669174143999, 'SUCCESS', 5000), + ('test_plan_functional_case_minder_id2', 'TEST_MINDER_PLAN_ID_1', 'TEST_FUNCTIONAL_MINDER_CASE_ID_5', 1669174143999, 'admin', 'admin', 1669174143999, 'SUCCESS', 10000); INSERT INTO custom_field (id, name, scene, type, remark, internal, scope_type, create_time, update_time, create_user, scope_id) VALUES ('custom_field_minder_gyq_id_2', 'functional_priority', 'FUNCTIONAL', 'SELECT', '', true, 'ORGANIZATION', UNIX_TIMESTAMP() * 1000, UNIX_TIMESTAMP() * 1000, 'admin', '100001'), diff --git a/frontend/src/views/case-management/caseReview/components/detail/caseTable.vue b/frontend/src/views/case-management/caseReview/components/detail/caseTable.vue index 7c21218be4..6ee251577a 100644 --- a/frontend/src/views/case-management/caseReview/components/detail/caseTable.vue +++ b/frontend/src/views/case-management/caseReview/components/detail/caseTable.vue @@ -627,7 +627,13 @@ dialogLoading.value = false; resetSelector(); loadList(); - emit('refresh', tableParams.value); + emit('refresh', { + ...tableParams.value, + current: propsRes.value.msPagination?.current, + pageSize: propsRes.value.msPagination?.pageSize, + total: propsRes.value.msPagination?.total, + moduleIds: [], + }); } catch (error) { // eslint-disable-next-line no-console console.log(error); @@ -680,7 +686,13 @@ Message.success(t('common.updateSuccess')); dialogVisible.value = false; resetSelector(); - emit('refresh', tableParams.value); + emit('refresh', { + ...tableParams.value, + current: propsRes.value.msPagination?.current, + pageSize: propsRes.value.msPagination?.pageSize, + total: propsRes.value.msPagination?.total, + moduleIds: [], + }); loadList(); } catch (error) { // eslint-disable-next-line no-console @@ -741,7 +753,13 @@ Message.success(t('caseManagement.caseReview.reviewSuccess')); dialogVisible.value = false; resetSelector(); - emit('refresh', tableParams.value); + emit('refresh', { + ...tableParams.value, + current: propsRes.value.msPagination?.current, + pageSize: propsRes.value.msPagination?.pageSize, + total: propsRes.value.msPagination?.total, + moduleIds: [], + }); loadList(); } catch (error) { // eslint-disable-next-line no-console