fix: 修复接口定义导入时case版本不一致的问题
--bug=1009804 --user=刘瑞斌 【接口测试】ms格式的接口,不覆盖,导入后用例版本不是所选版本 https://www.tapd.cn/55049933/s/1095093
This commit is contained in:
parent
126da29186
commit
b8edfe2532
|
@ -712,6 +712,11 @@ public class ApiDefinitionService {
|
|||
}
|
||||
batchMapper.insert(apiDefinition);
|
||||
String requestStr = setImportHashTree(apiDefinition);
|
||||
|
||||
// case 设置版本
|
||||
cases.forEach(c -> {
|
||||
c.setVersionId(apiDefinition.getVersionId());
|
||||
});
|
||||
reSetImportCasesApiId(cases, originId, apiDefinition.getId());
|
||||
reSetImportMocksApiId(mocks, originId, apiDefinition.getId(), apiDefinition.getNum());
|
||||
apiDefinition.setRequest(requestStr);
|
||||
|
@ -759,6 +764,10 @@ public class ApiDefinitionService {
|
|||
} else {
|
||||
apiDefinition.setVersionId(defaultVersion);
|
||||
}
|
||||
// case 设置版本
|
||||
cases.forEach(c -> {
|
||||
c.setVersionId(apiDefinition.getVersionId());
|
||||
});
|
||||
apiDefinition.setOrder(getImportNextOrder(apiTestImportRequest.getProjectId()));
|
||||
reSetImportCasesApiId(cases, originId, apiDefinition.getId());
|
||||
reSetImportMocksApiId(mocks, originId, apiDefinition.getId(), apiDefinition.getNum());
|
||||
|
@ -798,7 +807,10 @@ public class ApiDefinitionService {
|
|||
apiDefinition.setNum(existApi.getNum()); //id 不变
|
||||
apiDefinition.setRefId(existApi.getRefId());
|
||||
apiDefinition.setVersionId(apiTestImportRequest.getUpdateVersionId());
|
||||
|
||||
// case 设置版本
|
||||
cases.forEach(c -> {
|
||||
c.setVersionId(apiDefinition.getVersionId());
|
||||
});
|
||||
if (!StringUtils.equalsIgnoreCase(apiTestImportRequest.getPlatform(), ApiImportPlatform.Metersphere.name())) {
|
||||
apiDefinition.setTags(existApi.getTags()); // 其他格式 tag 不变,MS 格式替换
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue