From d86fe66d2602f5b703ec309f44defcc44caaa3dc Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Wed, 23 Oct 2024 10:20:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E4=BB=BB=E5=8A=A1=E4=B8=AD=E5=BF=83):=20?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E9=9B=86=E5=90=88=E6=8A=A5=E5=91=8A=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E7=8E=AF=E5=A2=83=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/definition/ApiReportService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiReportService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiReportService.java index ab6f6ab758..39b9c843a5 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiReportService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiReportService.java @@ -390,9 +390,11 @@ public class ApiReportService { private void setEnvironment(String reportId, ApiTaskReportDTO apiTaskReportDTO) { ApiReport apiReport = apiReportMapper.selectByPrimaryKey(reportId); - Environment environment = environmentMapper.selectByPrimaryKey(apiReport.getEnvironmentId()); - apiTaskReportDTO.setEnvironmentId(apiReport.getEnvironmentId()); - apiTaskReportDTO.setEnvironmentName(environment.getName()); + if (StringUtils.isNotBlank(apiReport.getEnvironmentId())) { + Environment environment = environmentMapper.selectByPrimaryKey(apiReport.getEnvironmentId()); + apiTaskReportDTO.setEnvironmentId(environment.getName()); + apiTaskReportDTO.setEnvironmentName(environment.getName()); + } } private String getStepId(String reportId) {