From 1fc354e556c9c1a665501b97233adc58b1f8d597 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 15 May 2020 17:42:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E8=B7=9F?= =?UTF-8?q?=E8=B8=AA=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/dto/TestPlanCaseDTO.java | 1 + .../track/service/TestPlanService.java | 6 ++++++ .../service/TestPlanTestCaseService.java | 19 +++++++++++++++---- .../components/track/home/TrackHome.vue | 10 +--------- .../home/components/TestCaseSideList.vue | 10 ++++++---- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/dto/TestPlanCaseDTO.java b/backend/src/main/java/io/metersphere/track/dto/TestPlanCaseDTO.java index 66831d2cac..da153f6f03 100644 --- a/backend/src/main/java/io/metersphere/track/dto/TestPlanCaseDTO.java +++ b/backend/src/main/java/io/metersphere/track/dto/TestPlanCaseDTO.java @@ -12,5 +12,6 @@ public class TestPlanCaseDTO extends TestCaseWithBLOBs { private String status; private String results; private String planId; + private String planName; private String caseId; } 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 cb4acb0c5f..8537eaaf81 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -321,4 +321,10 @@ public class TestPlanService { } } } + + public List getTestPlanByTestIds(List planIds) { + TestPlanExample example = new TestPlanExample(); + example.createCriteria().andIdIn(planIds); + return testPlanMapper.selectByExample(example); + } } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java index 9e66e3e470..4d43b5111f 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanTestCaseService.java @@ -1,9 +1,7 @@ package io.metersphere.track.service; import com.github.pagehelper.PageHelper; -import io.metersphere.base.domain.TestPlanTestCase; -import io.metersphere.base.domain.TestPlanTestCaseExample; -import io.metersphere.base.domain.User; +import io.metersphere.base.domain.*; import io.metersphere.base.mapper.TestPlanTestCaseMapper; import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper; import io.metersphere.commons.constants.TestPlanTestCaseStatus; @@ -13,6 +11,7 @@ import io.metersphere.commons.utils.SessionUtils; import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.service.UserService; import io.metersphere.track.dto.TestPlanCaseDTO; +import io.metersphere.track.dto.TestPlanDTO; import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest; import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; import org.apache.commons.lang3.StringUtils; @@ -35,6 +34,9 @@ public class TestPlanTestCaseService { @Resource UserService userService; + @Resource + TestPlanService testPlanService; + @Resource ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper; @@ -78,7 +80,16 @@ public class TestPlanTestCaseService { if (request.getPlanIds().isEmpty()) { return new ArrayList<>(); } - return extTestPlanTestCaseMapper.getRecentTestedTestCase(request); + List recentTestedTestCase = extTestPlanTestCaseMapper.getRecentTestedTestCase(request); + List planIds = recentTestedTestCase.stream().map(TestPlanCaseDTO::getPlanId).collect(Collectors.toList()); + + Map testPlanMap = testPlanService.getTestPlanByTestIds(planIds).stream() + .collect(Collectors.toMap(TestPlan::getId, TestPlan::getName)); + + recentTestedTestCase.forEach(testCase -> { + testCase.setPlanName(testPlanMap.get(testCase.getPlanId())); + }); + return recentTestedTestCase; } public List getPendingTestCases(QueryTestPlanCaseRequest request, int count) { diff --git a/frontend/src/business/components/track/home/TrackHome.vue b/frontend/src/business/components/track/home/TrackHome.vue index bba9dfb636..c2b24e0907 100644 --- a/frontend/src/business/components/track/home/TrackHome.vue +++ b/frontend/src/business/components/track/home/TrackHome.vue @@ -6,14 +6,7 @@ - - - - - - - - + @@ -37,7 +30,6 @@ innitData() { this.$refs.relatedTestPlanList.initTableData(); this.$refs.testCaseRecentList.initTableData(); - this.$refs.testCasePendingList.initTableData(); } } } diff --git a/frontend/src/business/components/track/home/components/TestCaseSideList.vue b/frontend/src/business/components/track/home/components/TestCaseSideList.vue index 5baf65ac16..3bf1f489af 100644 --- a/frontend/src/business/components/track/home/components/TestCaseSideList.vue +++ b/frontend/src/business/components/track/home/components/TestCaseSideList.vue @@ -39,6 +39,11 @@ + + + @@ -60,9 +65,6 @@ } }, props: { - type: { - type: String - }, title: { type: String }, @@ -72,7 +74,7 @@ }, methods: { initTableData() { - this.result = this.$post('/test/plan/case/' + this.type + '/5', {}, response => { + this.result = this.$post('/test/plan/case/recent/10', {}, response => { this.tableData = response.data; }); },