From dbc6c24a0bdee7ca9becddbf60a64d3c53478bc7 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 2 Aug 2022 12:10:05 +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=E5=AF=BC=E5=85=A5=E7=94=A8=E4=BE=8BID?= =?UTF-8?q?=E7=94=9F=E6=88=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --user=郭雨琦 --- .../io/metersphere/api/service/ApiDefinitionService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 2e29deee3d..4ea8bcf962 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -989,7 +989,8 @@ public class ApiDefinitionService { if (caseList == null || caseList.isEmpty()) { return; } - for (ApiTestCaseWithBLOBs apiTestCaseWithBLOBs : caseList) { + for (int i = 0; i < caseList.size(); i++) { + ApiTestCaseWithBLOBs apiTestCaseWithBLOBs = caseList.get(i); apiTestCaseWithBLOBs.setApiDefinitionId(apiDefinition.getId()); if (apiDefinition.getToBeUpdated() != null && !apiTestCaseWithBLOBs.getVersionId().equals("cover")) { apiTestCaseWithBLOBs.setToBeUpdated(true); @@ -1013,7 +1014,7 @@ public class ApiDefinitionService { apiTestCaseWithBLOBs.setOrder(getImportNextCaseOrder(apiDefinition.getProjectId())); } if (apiTestCaseWithBLOBs.getNum() == null) { - apiTestCaseWithBLOBs.setNum(testCaseService.getNextNum(apiDefinition.getId())); + apiTestCaseWithBLOBs.setNum(apiTestCaseService.getNextNum(apiDefinition.getId(), apiDefinition.getNum() + i, apiDefinition.getProjectId())); } if (apiDefinition.getToBeUpdateTime() != null) {