From 2c520503c2603d5460eac14849f2a9a4a43f5b6e Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 21 Nov 2022 11:00:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E5=A4=8D=E5=88=B6=E6=8E=A5=E5=8F=A3=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1019921 --user=赵勇 【接口测试】场景复制的api,版本显示成了项目名称 https://www.tapd.cn/55049933/s/1299112 --- .../java/io/metersphere/listener/ApiAppStartListener.java | 2 -- .../main/java/io/metersphere/service/MsHashTreeService.java | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/listener/ApiAppStartListener.java b/api-test/backend/src/main/java/io/metersphere/listener/ApiAppStartListener.java index e6ce8e66b2..2d9123a011 100644 --- a/api-test/backend/src/main/java/io/metersphere/listener/ApiAppStartListener.java +++ b/api-test/backend/src/main/java/io/metersphere/listener/ApiAppStartListener.java @@ -18,8 +18,6 @@ import org.python.util.PythonInterpreter; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; -import org.springframework.boot.context.event.ApplicationReadyEvent; -import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; import javax.annotation.Resource; diff --git a/api-test/backend/src/main/java/io/metersphere/service/MsHashTreeService.java b/api-test/backend/src/main/java/io/metersphere/service/MsHashTreeService.java index a95fa09e5f..93413e2e6f 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/MsHashTreeService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/MsHashTreeService.java @@ -1,9 +1,9 @@ package io.metersphere.service; import io.metersphere.api.dto.automation.ApiScenarioDTO; +import io.metersphere.api.dto.definition.ApiDefinitionResult; import io.metersphere.api.dto.definition.ApiTestCaseInfo; import io.metersphere.api.dto.definition.request.ElementUtil; -import io.metersphere.base.domain.ApiDefinition; import io.metersphere.base.domain.ApiScenarioWithBLOBs; import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import io.metersphere.base.domain.Project; @@ -174,11 +174,11 @@ public class MsHashTreeService { this.setElement(element, apiTestCase.getNum(), enable, apiTestCase.getVersionName(), apiTestCase.getVersionEnable()); } } else if (StringUtils.equalsIgnoreCase(element.optString(REFERENCED), COPY)) { - ApiDefinition definition = apiDefinitionMapper.selectByPrimaryKey(element.optString(ID)); + ApiDefinitionResult definition = apiDefinitionService.getById(element.optString(ID)); if (definition != null) { Project project = projectMapper.selectByPrimaryKey(definition.getProjectId()); element.put(ID, definition.getId()); - this.setElement(element, definition.getNum(), enable, project.getName(), project.getVersionEnable()); + this.setElement(element, definition.getNum(), enable, definition.getVersionName(), project.getVersionEnable()); isExist = true; } }