diff --git a/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java b/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java index 5748cb9541..fd7ec58b73 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java @@ -63,9 +63,8 @@ public class TestPlanController { } @PostMapping("/list/all") - public List listAll() { - String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); - return testPlanService.listTestAllPlan(currentWorkspaceId); + public List listAll(@RequestBody QueryTestPlanRequest request) { + return testPlanService.listTestAllPlan(request); } @PostMapping("/list/all/relate") diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index f449e5a2eb..a59caafe62 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -560,23 +560,15 @@ public class TestPlanService { return extTestPlanMapper.listRecent(SessionUtils.getUserId(), projectId); } - public List listTestAllPlan(String currentWorkspaceId) { - if (StringUtils.isNotBlank(SessionUtils.getCurrentProjectId())) { - TestPlanExample testPlanExample = new TestPlanExample(); - TestPlanExample.Criteria criteria = testPlanExample.createCriteria(); - criteria.andProjectIdEqualTo(SessionUtils.getCurrentProjectId()); - List testPlans = testPlanMapper.selectByExample(testPlanExample); - if (!CollectionUtils.isEmpty(testPlans)) { - List testPlanIds = testPlans.stream().map(TestPlan::getId).collect(Collectors.toList()); - TestPlanExample testPlanExample1 = new TestPlanExample(); - TestPlanExample.Criteria testPlanCriteria = testPlanExample1.createCriteria(); - testPlanCriteria.andWorkspaceIdEqualTo(currentWorkspaceId); - testPlanCriteria.andIdIn(testPlanIds); - return testPlanMapper.selectByExample(testPlanExample1); - } + public List listTestAllPlan(QueryTestPlanRequest request) { + String projectId = request.getProjectId(); + if (StringUtils.isBlank(projectId)) { + return new ArrayList<>(); } - return new ArrayList<>(); + TestPlanExample example = new TestPlanExample(); + example.createCriteria().andProjectIdEqualTo(projectId); + return testPlanMapper.selectByExample(example); } public List listRelateAllPlan() { diff --git a/frontend/src/business/components/track/plan/view/TestPlanView.vue b/frontend/src/business/components/track/plan/view/TestPlanView.vue index 0663133c77..13b6676ad0 100644 --- a/frontend/src/business/components/track/plan/view/TestPlanView.vue +++ b/frontend/src/business/components/track/plan/view/TestPlanView.vue @@ -48,6 +48,7 @@ import TestPlanApi from "./comonents/api/TestPlanApi"; import TestCaseStatisticsReportView from "./comonents/report/statistics/TestCaseStatisticsReportView"; import TestReportTemplateList from "./comonents/TestReportTemplateList"; import TestPlanLoad from "@/business/components/track/plan/view/comonents/load/TestPlanLoad"; +import {getCurrentProjectID} from "@/common/js/utils"; export default { name: "TestPlanView", @@ -114,7 +115,7 @@ export default { } }, getTestPlans() { - this.$post('/test/plan/list/all', {}, response => { + this.$post('/test/plan/list/all', {projectId: getCurrentProjectID()}, response => { this.testPlans = response.data; this.testPlans.forEach(plan => { if (this.planId && plan.id === this.planId) {