diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java new file mode 100644 index 0000000000..298fbe2b25 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java @@ -0,0 +1,14 @@ +package io.metersphere.base.mapper.ext; + +import io.metersphere.base.domain.TestCase; +import io.metersphere.controller.request.ReportRequest; +import io.metersphere.controller.request.testcase.QueryTestCaseRequest; +import io.metersphere.dto.ReportDTO; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ExtTestCaseMapper { + + List getTestCaseNames(@Param("request") QueryTestCaseRequest request); +} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml new file mode 100644 index 0000000000..6a05c036fe --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/controller/TestCaseController.java b/backend/src/main/java/io/metersphere/controller/TestCaseController.java index c5915dd483..f98e82f6be 100644 --- a/backend/src/main/java/io/metersphere/controller/TestCaseController.java +++ b/backend/src/main/java/io/metersphere/controller/TestCaseController.java @@ -38,6 +38,11 @@ public class TestCaseController { return testCaseService.getTestCaseByNodeId(nodeIds); } + @PostMapping("/name/all") + public List getTestCaseNames(@RequestBody QueryTestCaseRequest request){ + return testCaseService.getTestCaseNames(request); + } + @PostMapping("/get/{testCaseId}") public List getTestCase(@PathVariable String testCaseId){ return testCaseService.getTestCase(testCaseId); diff --git a/backend/src/main/java/io/metersphere/controller/request/testcase/QueryTestCaseRequest.java b/backend/src/main/java/io/metersphere/controller/request/testcase/QueryTestCaseRequest.java index 50c513da8c..feb9d65bf4 100644 --- a/backend/src/main/java/io/metersphere/controller/request/testcase/QueryTestCaseRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/testcase/QueryTestCaseRequest.java @@ -8,6 +8,16 @@ public class QueryTestCaseRequest extends TestCase { List nodeIds; + String planId; + + public String getPlanId() { + return planId; + } + + public void setPlanId(String planId) { + this.planId = planId; + } + public List getNodeIds() { return nodeIds; } diff --git a/backend/src/main/java/io/metersphere/service/TestCaseService.java b/backend/src/main/java/io/metersphere/service/TestCaseService.java index 833205085e..dd4eb48960 100644 --- a/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -4,7 +4,10 @@ package io.metersphere.service; import io.metersphere.base.domain.TestCase; import io.metersphere.base.domain.TestCaseExample; import io.metersphere.base.domain.TestCaseWithBLOBs; +import io.metersphere.base.domain.TestPlan; import io.metersphere.base.mapper.TestCaseMapper; +import io.metersphere.base.mapper.TestPlanMapper; +import io.metersphere.base.mapper.ext.ExtTestCaseMapper; import io.metersphere.controller.request.testcase.QueryTestCaseRequest; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -21,6 +24,12 @@ public class TestCaseService { @Resource TestCaseMapper testCaseMapper; + @Resource + ExtTestCaseMapper extTestCaseMapper; + + @Resource + TestPlanMapper testPlanMapper; + public void addTestCase(TestCaseWithBLOBs testCase) { testCase.setId(UUID.randomUUID().toString()); testCase.setCreateTime(System.currentTimeMillis()); @@ -63,4 +72,13 @@ public class TestCaseService { } return testCaseMapper.selectByExampleWithBLOBs(testCaseExample); } + + public List getTestCaseNames(QueryTestCaseRequest request) { + + TestPlan testPlan = testPlanMapper.selectByPrimaryKey(request.getPlanId()); + + request.setProjectId(testPlan.getProjectId()); + + return extTestCaseMapper.getTestCaseNames(request); + } } diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index 10d66e6f6f..4602e18b37 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -5,7 +5,7 @@ - + @@ -78,8 +78,6 @@ }, watch: { '$route'(to, from) { - console.log(from); - console.log(to); if (from.name.indexOf("Project") > 0){ this.getProjects(); } diff --git a/frontend/src/business/components/track/plan/TestPlanView.vue b/frontend/src/business/components/track/plan/TestPlanView.vue index ee32db3d99..cbbe1c14eb 100644 --- a/frontend/src/business/components/track/plan/TestPlanView.vue +++ b/frontend/src/business/components/track/plan/TestPlanView.vue @@ -7,11 +7,20 @@ :plan-id="planId" class="node_tree" @nodeSelectEvent="get" - @refresh="refresh" ref="nodeTree"> + + + + + + @@ -19,10 +28,12 @@ + + diff --git a/frontend/src/business/components/track/plan/components/TestCaseRelevance.vue b/frontend/src/business/components/track/plan/components/TestCaseRelevance.vue new file mode 100644 index 0000000000..7a543a229d --- /dev/null +++ b/frontend/src/business/components/track/plan/components/TestCaseRelevance.vue @@ -0,0 +1,201 @@ + + + + +