fix(接口测试): 解决多个版本一起显示的问题

--user=郭雨琦
This commit is contained in:
guoyuqi 2022-07-13 16:08:26 +08:00 committed by xiaomeinvG
parent 4a5348976d
commit d5e2da7440
3 changed files with 9 additions and 1 deletions

View File

@ -1233,6 +1233,8 @@ public class ApiAutomationService {
checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper);
batchMapper.insert(scenarioWithBLOBs);
apiScenarioReferenceIdService.saveApiAndScenarioRelation(scenarioWithBLOBs);
extApiScenarioMapper.clearLatestVersion(scenarioWithBLOBs.getRefId());
extApiScenarioMapper.addLatestVersion(scenarioWithBLOBs.getRefId());
} else {
//如果存在则修改
if (StringUtils.isEmpty(apiTestImportRequest.getUpdateVersionId())) {
@ -1342,6 +1344,8 @@ public class ApiAutomationService {
relationshipEdgeService.initRelationshipEdge(null, scenarioWithBLOBs);
}
apiScenarioReferenceIdService.saveApiAndScenarioRelation(scenarioWithBLOBs);
extApiScenarioMapper.clearLatestVersion(scenarioWithBLOBs.getRefId());
extApiScenarioMapper.addLatestVersion(scenarioWithBLOBs.getRefId());
}
} else {

View File

@ -830,6 +830,8 @@ public class ApiDefinitionService {
apiDefinition.setRequest(requestStr);
importCase(apiDefinition, apiTestCaseMapper, caseList);
extApiDefinitionMapper.clearLatestVersion(apiDefinition.getRefId());
extApiDefinitionMapper.addLatestVersion(apiDefinition.getRefId());
} else {
//不覆盖的接口如果没有sameRequest则不导入此时清空mock信息
mocks.clear();
@ -936,6 +938,8 @@ public class ApiDefinitionService {
batchMapper.insert(apiDefinition);
}
importCase(apiDefinition, apiTestCaseMapper, caseList);
extApiDefinitionMapper.clearLatestVersion(apiDefinition.getRefId());
extApiDefinitionMapper.addLatestVersion(apiDefinition.getRefId());
} else { //如果存在则修改
if (StringUtils.isEmpty(apiTestImportRequest.getUpdateVersionId())) {
apiTestImportRequest.setUpdateVersionId(apiTestImportRequest.getDefaultVersion());

View File

@ -763,7 +763,7 @@
JOIN project_version
ON tmp.project_id = project_version.project_id AND
tmp.version_id = project_version.id AND project_version.latest = TRUE
WHERE ref_id = #{refId,jdbcType=VARCHAR}
WHERE ref_id = #{refId,jdbcType=VARCHAR} and tmp.status != 'Trash'
LIMIT 1
)
UNION ALL