fix(接口测试): 接口自动化导入文件后查看用例存在显示id重复问题以及覆盖接口自动化用例导入问题

--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001016870
This commit is contained in:
guoyuqi 2022-09-20 17:23:16 +08:00 committed by 刘瑞斌
parent 727c7159b2
commit cf1f36e7ee
2 changed files with 7 additions and 7 deletions

View File

@ -1330,6 +1330,7 @@ public class ApiAutomationService {
scenarioWithBLOBs.setRefId(sameRequest.get(0).getRefId() == null ? sameRequest.get(0).getId() : sameRequest.get(0).getRefId());
scenarioWithBLOBs.setNum(sameRequest.get(0).getNum()); // 使用第一个num当作本次的num
scenarioWithBLOBs.setOrder(sameRequest.get(0).getOrder());
checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper);
sendImportScenarioCreateNotice(scenarioWithBLOBs);
batchMapper.insert(scenarioWithBLOBs);
} else {
@ -1339,10 +1340,10 @@ public class ApiAutomationService {
scenarioWithBLOBs.setVersionId(apiTestImportRequest.getUpdateVersionId());
scenarioWithBLOBs.setOrder(existScenario.getOrder());
scenarioWithBLOBs.setNum(existScenario.getNum());
checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper);
sendImportScenarioUpdateNotice(scenarioWithBLOBs);
batchMapper.updateByPrimaryKeyWithBLOBs(scenarioWithBLOBs);
}
checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper);
apiScenarioReferenceIdService.saveApiAndScenarioRelation(scenarioWithBLOBs);
extApiScenarioMapper.clearLatestVersion(scenarioWithBLOBs.getRefId());
extApiScenarioMapper.addLatestVersion(scenarioWithBLOBs.getRefId());
@ -1414,7 +1415,6 @@ public class ApiAutomationService {
} else {
scenarioWithBLOBs.setVersionId(apiTestImportRequest.getDefaultVersion());
}
checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper);
if (scenarioWithBLOBs.getOrder() == null) {
scenarioWithBLOBs.setOrder(getImportNextOrder(request.getProjectId()));
}
@ -1424,6 +1424,7 @@ public class ApiAutomationService {
if (scenarioWithBLOBs.getRefId() == null) {
scenarioWithBLOBs.setRefId(scenarioWithBLOBs.getId());
}
checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper);
sendImportScenarioCreateNotice(scenarioWithBLOBs);
batchMapper.insert(scenarioWithBLOBs);
// 存储依赖关系

View File

@ -880,19 +880,18 @@
select * from api_test_case
<where>
(api_test_case.status is null or api_test_case.status != 'Trash')
<if test="request.name !='' || request.name != null">
<if test="request.name !='' and request.name != null">
and name =#{request.name}
</if>
<if test="request.apiDefinitionId !='' || request.apiDefinitionId != null">
<if test="request.apiDefinitionId !='' and request.apiDefinitionId != null">
and api_definition_id =#{request.apiDefinitionId}
</if>
<if test="request.id !='' || request.id != null">
<if test="request.id !='' and request.id != null">
and id !=#{request.id}
</if>
<if test="request.versionId !='' || request.versionId != null">
<if test="request.versionId !='' and request.versionId != null">
and version_id =#{request.versionId}
</if>
</where>
</select>
<update id="deleteToGc" parameterType="io.metersphere.api.dto.definition.ApiTestCaseRequest">