fix(接口测试): 修复场景步骤api没有显示版本数据问题

https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001018778
--user=郭雨琦
This commit is contained in:
guoyuqi 2022-10-24 21:00:03 +08:00 committed by xiaomeinvG
parent f14000fb42
commit 53c18d2fdc
1 changed files with 8 additions and 0 deletions

View File

@ -4,6 +4,8 @@ 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.Project;
import io.metersphere.base.mapper.ProjectMapper;
import io.metersphere.service.definition.ApiDefinitionService;
import io.metersphere.service.definition.ApiTestCaseService;
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
@ -36,6 +38,9 @@ public class MsHashTreeService {
@Resource
private ExtApiScenarioMapper extApiScenarioMapper;
@Resource
private ProjectMapper projectMapper;
public static final String CASE = "CASE";
public static final String REFERENCED = "referenced";
public static final String REF = "REF";
@ -163,6 +168,9 @@ public class MsHashTreeService {
} else {
if (StringUtils.equalsIgnoreCase(element.optString(REFERENCED), "Copy")) {
ApiDefinitionResult definitionWithBLOBs = apiDefinitionService.getById(element.optString(ID));
Project project = projectMapper.selectByPrimaryKey(definitionWithBLOBs.getProjectId());
definitionWithBLOBs.setProjectName(project.getName());
definitionWithBLOBs.setVersionEnable(project.getVersionEnable());
if (definitionWithBLOBs != null) {
element.put(ID, definitionWithBLOBs.getId());
this.setElement(element, definitionWithBLOBs.getNum(), enable, definitionWithBLOBs.getVersionName(), definitionWithBLOBs.getVersionEnable());