From cf1f36e7eed6e9f3685540e6c06bd30e7eb8d2a1 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 20 Sep 2022 17:23:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8=E5=8C=96=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8E=E6=9F=A5=E7=9C=8B=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E6=98=BE=E7=A4=BAid=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BB=A5=E5=8F=8A=E8=A6=86=E7=9B=96=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=87=AA=E5=8A=A8=E5=8C=96=E7=94=A8=E4=BE=8B=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001016870 --- .../io/metersphere/api/service/ApiAutomationService.java | 5 +++-- .../metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml | 9 ++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index f33e7f945a..4fa97a6308 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -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); // 存储依赖关系 diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml index d21522477c..a82761e88a 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiTestCaseMapper.xml @@ -880,19 +880,18 @@ select * from api_test_case (api_test_case.status is null or api_test_case.status != 'Trash') - + and name =#{request.name} - + and api_definition_id =#{request.apiDefinitionId} - + and id !=#{request.id} - + and version_id =#{request.versionId} -