fix(接口测试): 场景复制接口版本显示错误问题

--bug=1019921 --user=赵勇 【接口测试】场景复制的api,版本显示成了项目名称 https://www.tapd.cn/55049933/s/1299112
This commit is contained in:
fit2-zhao 2022-11-21 11:00:23 +08:00 committed by fit2-zhao
parent 01d9072787
commit 2c520503c2
2 changed files with 3 additions and 5 deletions

View File

@ -18,8 +18,6 @@ import org.python.util.PythonInterpreter;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner; import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;

View File

@ -1,9 +1,9 @@
package io.metersphere.service; package io.metersphere.service;
import io.metersphere.api.dto.automation.ApiScenarioDTO; 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.ApiTestCaseInfo;
import io.metersphere.api.dto.definition.request.ElementUtil; 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.ApiScenarioWithBLOBs;
import io.metersphere.base.domain.ApiTestCaseWithBLOBs; import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import io.metersphere.base.domain.Project; import io.metersphere.base.domain.Project;
@ -174,11 +174,11 @@ public class MsHashTreeService {
this.setElement(element, apiTestCase.getNum(), enable, apiTestCase.getVersionName(), apiTestCase.getVersionEnable()); this.setElement(element, apiTestCase.getNum(), enable, apiTestCase.getVersionName(), apiTestCase.getVersionEnable());
} }
} else if (StringUtils.equalsIgnoreCase(element.optString(REFERENCED), COPY)) { } 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) { if (definition != null) {
Project project = projectMapper.selectByPrimaryKey(definition.getProjectId()); Project project = projectMapper.selectByPrimaryKey(definition.getProjectId());
element.put(ID, definition.getId()); 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; isExist = true;
} }
} }