From deb9ad96709bd80fd4ae1f1461a47a6b61f90ac4 Mon Sep 17 00:00:00 2001 From: metersphere-bot <78466014+metersphere-bot@users.noreply.github.com> Date: Tue, 11 Jan 2022 16:44:42 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=8E=B7=E5=8F=96=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E6=8A=A5=E5=91=8A=E6=8E=A5=E5=8F=A3=E6=95=88=E7=8E=87?= =?UTF-8?q?=E4=BC=98=E5=8C=96=20(#9219)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: chenjianxing Co-authored-by: jianxing <41557596+AgAngle@users.noreply.github.com> --- .../api/service/ApiScenarioReportService.java | 11 ++++++++++- .../base/mapper/ext/ExtApiScenarioReportMapper.xml | 12 +++--------- .../resources/db/migration/V105__v1.16.5_release.sql | 5 ++++- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java index f2dbfb5a24..b78d0c1b4e 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -133,7 +133,16 @@ public class ApiScenarioReportService { public List list(QueryAPIReportRequest request) { request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); - return extApiScenarioReportMapper.list(request); + List list = extApiScenarioReportMapper.list(request); + List userIds = list.stream().map(APIScenarioReportResult::getUserId) + .collect(Collectors.toList()); + Map userMap = ServiceUtils.getUserMap(userIds); + list.forEach(item -> { + User user = userMap.get(item.getUserId()); + if (user != null) + item.setUserName(user.getName()); + }); + return list; } public List idList(QueryAPIReportRequest request) { diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml index 4c4bc807c3..f0cda17d4d 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml @@ -99,13 +99,10 @@