From cb784da8e8543ef707c6af765c19a39868e17b07 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Thu, 14 Jul 2022 11:25:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E5=AF=BC=E5=85=A5order=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 --bug=1014731 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001014731 --- .../api/service/ApiAutomationService.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) 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 7efccc77ad..5b16069e98 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -1232,6 +1232,12 @@ public class ApiAutomationService { } checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper); + if (scenarioWithBLOBs.getOrder() == null) { + scenarioWithBLOBs.setOrder(getImportNextOrder(scenarioWithBLOBs.getProjectId())); + } + if (scenarioWithBLOBs.getNum() == null) { + scenarioWithBLOBs.setNum(getNextNum(scenarioWithBLOBs.getProjectId())); + } batchMapper.insert(scenarioWithBLOBs); apiScenarioReferenceIdService.saveApiAndScenarioRelation(scenarioWithBLOBs); extApiScenarioMapper.clearLatestVersion(scenarioWithBLOBs.getRefId()); @@ -1256,6 +1262,12 @@ public class ApiAutomationService { scenarioWithBLOBs.setNum(sameRequest.get(0).getNum()); // 使用第一个num当作本次的num scenarioWithBLOBs.setOrder(sameRequest.get(0).getOrder()); } + if (scenarioWithBLOBs.getOrder() == null) { + scenarioWithBLOBs.setOrder(getImportNextOrder(scenarioWithBLOBs.getProjectId())); + } + if (scenarioWithBLOBs.getNum() == null) { + scenarioWithBLOBs.setNum(getNextNum(scenarioWithBLOBs.getProjectId())); + } batchMapper.insert(scenarioWithBLOBs); } else { ApiScenarioWithBLOBs existScenario = scenarioOp.get(); @@ -1264,6 +1276,12 @@ public class ApiAutomationService { scenarioWithBLOBs.setVersionId(apiTestImportRequest.getUpdateVersionId()); scenarioWithBLOBs.setOrder(existScenario.getOrder()); scenarioWithBLOBs.setNum(existScenario.getNum()); + if (scenarioWithBLOBs.getOrder() == null) { + scenarioWithBLOBs.setOrder(getImportNextOrder(scenarioWithBLOBs.getProjectId())); + } + if (scenarioWithBLOBs.getNum() == null) { + scenarioWithBLOBs.setNum(getNextNum(scenarioWithBLOBs.getProjectId())); + } batchMapper.updateByPrimaryKeyWithBLOBs(scenarioWithBLOBs); } checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper); @@ -1338,6 +1356,12 @@ public class ApiAutomationService { scenarioWithBLOBs.setVersionId(apiTestImportRequest.getDefaultVersion()); } checkReferenceCase(scenarioWithBLOBs, apiTestCaseMapper, apiDefinitionMapper); + if (scenarioWithBLOBs.getOrder() == null) { + scenarioWithBLOBs.setOrder(getImportNextOrder(request.getProjectId())); + } + if (scenarioWithBLOBs.getNum() == null) { + scenarioWithBLOBs.setNum(getNextNum(scenarioWithBLOBs.getProjectId())); + } batchMapper.insert(scenarioWithBLOBs); // 存储依赖关系 ApiAutomationRelationshipEdgeService relationshipEdgeService = CommonBeanFactory.getBean(ApiAutomationRelationshipEdgeService.class);