diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.java index ff54fa5a9b..c29727c077 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.java @@ -1,5 +1,6 @@ package io.metersphere.base.mapper.ext; +import io.metersphere.base.domain.TestPlan; import io.metersphere.track.dto.TestPlanDTO; import io.metersphere.track.dto.TestPlanDTOWithMetric; import io.metersphere.track.request.testcase.QueryTestPlanRequest; @@ -32,4 +33,6 @@ public interface ExtTestPlanMapper { String findScheduleCreateUserById(String testPlanId); List findIdByPerformanceReportId(String reportId); + + List listRecent(@Param("userId") String userId, @Param("projectId") String currentProjectId); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.xml index 53d54f2994..85d112f388 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanMapper.xml @@ -240,5 +240,16 @@ WHERE reportData.performance_info like CONCAT('%', #{0},'%') AND report.is_performance_executing = true; + \ No newline at end of file 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 c896bc41b3..c1f1f6e0ef 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestPlanController.java @@ -66,9 +66,8 @@ public class TestPlanController { @GetMapping("recent/{count}") public List recentTestPlans(@PathVariable int count) { - String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId(); PageHelper.startPage(1, count, true); - return testPlanService.recentTestPlans(currentWorkspaceId); + return testPlanService.recentTestPlans(); } @PostMapping("/get/{testPlanId}") 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 fe0d58e77d..bdf0b28af4 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -467,26 +467,8 @@ public class TestPlanService { } } - public List recentTestPlans(String currentWorkspaceId) { - if (StringUtils.isBlank(currentWorkspaceId)) { - return null; - } - 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 testPlanTestCaseExample = new TestPlanExample(); - testPlanTestCaseExample.createCriteria().andWorkspaceIdEqualTo(currentWorkspaceId) - .andIdIn(testPlanIds) - .andPrincipalEqualTo(SessionUtils.getUserId()); - testPlanTestCaseExample.setOrderByClause("update_time desc"); - return testPlanMapper.selectByExample(testPlanTestCaseExample); - } - } - return new ArrayList<>(); + public List recentTestPlans() { + return extTestPlanMapper.listRecent(SessionUtils.getUserId(), SessionUtils.getCurrentProjectId()); } public List listTestAllPlan(String currentWorkspaceId) { diff --git a/frontend/src/business/components/track/common/tableItems/plan/PlanStatusTableItem.vue b/frontend/src/business/components/track/common/tableItems/plan/PlanStatusTableItem.vue index 0721190c41..caa447aae5 100644 --- a/frontend/src/business/components/track/common/tableItems/plan/PlanStatusTableItem.vue +++ b/frontend/src/business/components/track/common/tableItems/plan/PlanStatusTableItem.vue @@ -3,12 +3,14 @@ +