From ce0a688130a40debd290ef288076022539e69b33 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 3 Nov 2020 14:33:20 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/mapper/ext/ExtTestPlanTestCaseMapper.java | 7 +++++++ .../base/mapper/ext/ExtTestPlanTestCaseMapper.xml | 8 ++++++++ .../base/mapper/ext/ExtTestReviewCaseMapper.java | 7 +++++++ .../base/mapper/ext/ExtTestReviewCaseMapper.xml | 8 ++++++++ .../track/service/TestCaseReviewService.java | 11 ++++++----- .../io/metersphere/track/service/TestPlanService.java | 11 ++++++----- 6 files changed, 42 insertions(+), 10 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java index a42648ab81..1bff19ab89 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.java @@ -31,4 +31,11 @@ public interface ExtTestPlanTestCaseMapper { List getTestPlanTestCaseIds(String testId); + /** + * 根据项目 ids 查询 TestPlanCaseDTO 列表 + * @param ids project id list + * @return List + */ + List listTestCaseByProjectIds(@Param("ids") List ids); + } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml index 4737fed2b2..7b267835c1 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml @@ -210,6 +210,14 @@ + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java index 69575d5f69..a08e4de8f8 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java @@ -484,7 +484,7 @@ public class TestCaseReviewService { request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); request.setReviewIds(extTestReviewCaseMapper.findRelateTestReviewId(user.getId(), SessionUtils.getCurrentWorkspaceId())); - List projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentOrganizationId()); + List projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentWorkspaceId()); List testReviews = extTestCaseReviewMapper.listRelate(request); @@ -553,10 +553,11 @@ public class TestCaseReviewService { return name; } - public List listTestCaseByProjectIds(List projectIds) { - QueryCaseReviewRequest request = new QueryCaseReviewRequest(); - request.setProjectIds(projectIds); - return extTestReviewCaseMapper.list(request); + private List listTestCaseByProjectIds(List projectIds) { + if (CollectionUtils.isEmpty(projectIds)) { + return new ArrayList<>(); + } + return extTestReviewCaseMapper.listTestCaseByProjectIds(projectIds); } /*编辑,新建,完成,删除通知内容*/ 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 14e16fb576..4467628bcf 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -365,7 +365,7 @@ public class TestPlanService { request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); request.setPlanIds(extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId())); - List projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentOrganizationId()); + List projectIds = extProjectMapper.getProjectIdByWorkspaceId(SessionUtils.getCurrentWorkspaceId()); List testPlans = extTestPlanMapper.listRelate(request); @@ -411,10 +411,11 @@ public class TestPlanService { return testPlanTestCaseService.list(request); } - public List listTestCaseByProjectIds(List projectIds) { - QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest(); - request.setProjectIds(projectIds); - return extTestPlanTestCaseMapper.list(request); + private List listTestCaseByProjectIds(List projectIds) { + if (CollectionUtils.isEmpty(projectIds)) { + return new ArrayList<>(); + } + return extTestPlanTestCaseMapper.listTestCaseByProjectIds(projectIds); } public TestCaseReportMetricDTO getMetric(String planId) {