From b941ffebf5341069d3006220e909f3ddd4a553f7 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Sat, 9 May 2020 19:26:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E4=BA=BA=E6=98=BE=E7=A4=BA=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../testplancase/QueryTestPlanCaseRequest.java | 1 - .../io/metersphere/dto/TestPlanCaseDTO.java | 2 +- .../service/TestPlanTestCaseService.java | 18 +++++++++++++++++- .../track/plan/view/comonents/ExecutorEdit.vue | 2 +- .../view/comonents/TestPlanTestCaseList.vue | 6 +----- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/backend/src/main/java/io/metersphere/controller/request/testplancase/QueryTestPlanCaseRequest.java b/backend/src/main/java/io/metersphere/controller/request/testplancase/QueryTestPlanCaseRequest.java index 8be81d9827..2027a5aa45 100644 --- a/backend/src/main/java/io/metersphere/controller/request/testplancase/QueryTestPlanCaseRequest.java +++ b/backend/src/main/java/io/metersphere/controller/request/testplancase/QueryTestPlanCaseRequest.java @@ -19,5 +19,4 @@ public class QueryTestPlanCaseRequest extends TestPlanTestCase { private String workspaceId; private String name; - } diff --git a/backend/src/main/java/io/metersphere/dto/TestPlanCaseDTO.java b/backend/src/main/java/io/metersphere/dto/TestPlanCaseDTO.java index 067589985f..2a39cf6187 100644 --- a/backend/src/main/java/io/metersphere/dto/TestPlanCaseDTO.java +++ b/backend/src/main/java/io/metersphere/dto/TestPlanCaseDTO.java @@ -1,6 +1,5 @@ package io.metersphere.dto; -import io.metersphere.base.domain.TestCase; import io.metersphere.base.domain.TestCaseWithBLOBs; import lombok.Data; @@ -8,6 +7,7 @@ import lombok.Data; public class TestPlanCaseDTO extends TestCaseWithBLOBs { private String executor; + private String executorName; private String status; private String results; } diff --git a/backend/src/main/java/io/metersphere/service/TestPlanTestCaseService.java b/backend/src/main/java/io/metersphere/service/TestPlanTestCaseService.java index 8f5ab4e2eb..0c5bca8933 100644 --- a/backend/src/main/java/io/metersphere/service/TestPlanTestCaseService.java +++ b/backend/src/main/java/io/metersphere/service/TestPlanTestCaseService.java @@ -2,20 +2,25 @@ package io.metersphere.service; import io.metersphere.base.domain.TestPlanTestCase; import io.metersphere.base.domain.TestPlanTestCaseExample; +import io.metersphere.base.domain.User; import io.metersphere.base.mapper.TestPlanTestCaseMapper; import io.metersphere.base.mapper.ext.ExtTestCaseMapper; import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper; import io.metersphere.commons.constants.TestPlanTestCaseStatus; import io.metersphere.commons.utils.BeanUtils; +import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.testcase.TestPlanCaseBatchRequest; import io.metersphere.controller.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.dto.TestPlanCaseDTO; +import io.metersphere.user.SessionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; @Service @Transactional(rollbackFor = Exception.class) @@ -24,11 +29,22 @@ public class TestPlanTestCaseService { @Resource TestPlanTestCaseMapper testPlanTestCaseMapper; + @Resource + UserService userService; + @Resource ExtTestPlanTestCaseMapper extTestPlanTestCaseMapper; public List getTestPlanCases(QueryTestPlanCaseRequest request) { - return extTestPlanTestCaseMapper.list(request); + List list = extTestPlanTestCaseMapper.list(request); + QueryMemberRequest queryMemberRequest = new QueryMemberRequest(); + queryMemberRequest.setWorkspaceId(SessionUtils.getCurrentWorkspaceId()); + Map userMap = userService.getMemberList(queryMemberRequest) + .stream().collect(Collectors.toMap(User::getId, User::getName)); + list.forEach(item -> { + item.setExecutorName(userMap.get(item.getExecutor())); + }); + return list; } public void editTestCase(TestPlanTestCase testPlanTestCase) { diff --git a/frontend/src/business/components/track/plan/view/comonents/ExecutorEdit.vue b/frontend/src/business/components/track/plan/view/comonents/ExecutorEdit.vue index df639fd1f8..12fd6244c8 100644 --- a/frontend/src/business/components/track/plan/view/comonents/ExecutorEdit.vue +++ b/frontend/src/business/components/track/plan/view/comonents/ExecutorEdit.vue @@ -5,7 +5,7 @@ width="20%"> + :label="item.name" :value="item.id">