From a4089c22705a1d649880ed2e8a28b72f6f68d527 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Wed, 25 Aug 2021 11:02:12 +0800 Subject: [PATCH] =?UTF-8?q?fix=20(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20K8s=E4=B8=B2=E8=A1=8C=E9=9B=86=E6=88=90=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E9=A1=BA=E5=BA=8F=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20#1006159=20--bug=3D1006159=20--user=3D=E8=B5=B5=E5=8B=87=20?= =?UTF-8?q?=E3=80=90=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=E3=80=91=E4=BD=BF?= =?UTF-8?q?=E7=94=A8k8s=E8=B5=84...=20https://www.tapd.cn/55049933/s/10391?= =?UTF-8?q?29?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiScenarioReportService.java | 13 ++++++++++--- .../ext/ExtApiScenarioReportDetailMapper.java | 10 ++++++++++ .../mapper/ext/ExtApiScenarioReportDetailMapper.xml | 7 +++++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportDetailMapper.java create mode 100644 backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportDetailMapper.xml 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 e4e337d031..157a0ae86a 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportService.java @@ -23,6 +23,7 @@ import io.metersphere.base.mapper.ApiScenarioMapper; import io.metersphere.base.mapper.ApiScenarioReportDetailMapper; import io.metersphere.base.mapper.ApiScenarioReportMapper; import io.metersphere.base.mapper.TestPlanApiScenarioMapper; +import io.metersphere.base.mapper.ext.ExtApiScenarioReportDetailMapper; import io.metersphere.base.mapper.ext.ExtApiScenarioReportMapper; import io.metersphere.commons.constants.*; import io.metersphere.commons.exception.MSException; @@ -63,6 +64,9 @@ public class ApiScenarioReportService { private ApiScenarioReportMapper apiScenarioReportMapper; @Resource private ApiScenarioReportDetailMapper apiScenarioReportDetailMapper; + @Resource + private ExtApiScenarioReportDetailMapper extApiScenarioReportDetailMapper; + @Resource private ApiScenarioMapper apiScenarioMapper; @Resource @@ -443,9 +447,12 @@ public class ApiScenarioReportService { if (CollectionUtils.isNotEmpty(reportIds)) { TestResult testResult = new TestResult(); testResult.setTestId(UUID.randomUUID().toString()); - ApiScenarioReportDetailExample example = new ApiScenarioReportDetailExample(); - example.createCriteria().andReportIdIn(reportIds); - List details = apiScenarioReportDetailMapper.selectByExampleWithBLOBs(example); + + StringBuilder idStr = new StringBuilder(); + reportIds.forEach(item -> { + idStr.append("\"").append(item).append("\"").append(","); + }); + List details = extApiScenarioReportDetailMapper.selectByIds(idStr.toString().substring(0, idStr.toString().length() - 1), "\"" + StringUtils.join(reportIds, ",") + "\""); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); // 记录单场景通过率 diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportDetailMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportDetailMapper.java new file mode 100644 index 0000000000..658ca11c31 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportDetailMapper.java @@ -0,0 +1,10 @@ +package io.metersphere.base.mapper.ext; + +import io.metersphere.base.domain.ApiScenarioReportDetail; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ExtApiScenarioReportDetailMapper { + List selectByIds(@Param("ids") String ids, @Param("oderId") String oderId); +} diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportDetailMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportDetailMapper.xml new file mode 100644 index 0000000000..acf334b037 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportDetailMapper.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file