From 77afd855ba84e725ad1f72f8908c78cc3744ce3c Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 21 Jul 2021 16:40:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=84=91=E5=9B=BE=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E8=87=AA=E5=AE=9A=E4=B9=89ID=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/service/TestCaseService.java | 20 ++++++++++++------- .../template/CustomFieldFormList.vue | 4 ++++ .../case/components/TestCaseIssueRelate.vue | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 1d7726b6f5..a09148f949 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -24,8 +24,6 @@ import io.metersphere.excel.domain.ExcelResponse; import io.metersphere.excel.domain.TestCaseExcelData; import io.metersphere.excel.domain.TestCaseExcelDataFactory; import io.metersphere.excel.handler.FunctionCaseTemplateWriteHandler; -import io.metersphere.excel.listener.TestCaseDataIgnoreErrorListener; -import io.metersphere.excel.listener.TestCaseDataListener; import io.metersphere.excel.listener.TestCaseNoModelDataListener; import io.metersphere.excel.utils.EasyExcelExporter; import io.metersphere.excel.utils.FunctionCaseImportEnum; @@ -146,6 +144,9 @@ public class TestCaseService { testCase.setUpdateTime(System.currentTimeMillis()); checkTestCustomNum(testCase); testCase.setNum(getNextNum(testCase.getProjectId())); + if (StringUtils.isBlank(testCase.getCustomNum())) { + testCase.setCustomNum(testCase.getNum().toString()); + } testCase.setReviewStatus(TestCaseReviewStatus.Prepare.name()); testCase.setDemandId(testCase.getDemandId()); testCase.setDemandName(testCase.getDemandName()); @@ -1209,14 +1210,19 @@ public class TestCaseService { return; } - TestCaseExample example = new TestCaseExample(); List editIds = data.stream() .filter(t -> StringUtils.isNotBlank(t.getId()) && t.getId().length() > 20) .map(TestCaseWithBLOBs::getId).collect(Collectors.toList()); - example.createCriteria().andIdIn(editIds); - List testCaseWithBLOBs = testCaseMapper.selectByExampleWithBLOBs(example); - Map testCaseMap = testCaseWithBLOBs.stream().collect(Collectors.toMap(TestCaseWithBLOBs::getId, t -> t)); + Map testCaseMap = new HashMap<>(); + if (CollectionUtils.isNotEmpty(editIds)) { + TestCaseExample example = new TestCaseExample(); + example.createCriteria().andIdIn(editIds); + List testCaseWithBLOBs = testCaseMapper.selectByExampleWithBLOBs(example); + testCaseMap = testCaseWithBLOBs.stream().collect(Collectors.toMap(TestCaseWithBLOBs::getId, t -> t)); + } + + Map finalTestCaseMap = testCaseMap; data.forEach(item -> { if (StringUtils.isBlank(item.getNodeId()) || item.getNodeId().equals("root")) { item.setNodeId(""); @@ -1227,7 +1233,7 @@ public class TestCaseService { item.setMaintainer(SessionUtils.getUserId()); addTestCase(item); } else { - TestCaseWithBLOBs dbCase = testCaseMap.get(item.getId()); + TestCaseWithBLOBs dbCase = finalTestCaseMap.get(item.getId()); if (editCustomFieldsPriority(dbCase, item.getPriority())) { item.setCustomFields(dbCase.getCustomFields()); }; diff --git a/frontend/src/business/components/settings/workspace/template/CustomFieldFormList.vue b/frontend/src/business/components/settings/workspace/template/CustomFieldFormList.vue index 70c0fb001c..e6daa5aabb 100644 --- a/frontend/src/business/components/settings/workspace/template/CustomFieldFormList.vue +++ b/frontend/src/business/components/settings/workspace/template/CustomFieldFormList.vue @@ -149,4 +149,8 @@ export default { diff --git a/frontend/src/business/components/track/case/components/TestCaseIssueRelate.vue b/frontend/src/business/components/track/case/components/TestCaseIssueRelate.vue index 9597031eb7..cbf80e71d4 100644 --- a/frontend/src/business/components/track/case/components/TestCaseIssueRelate.vue +++ b/frontend/src/business/components/track/case/components/TestCaseIssueRelate.vue @@ -65,7 +65,7 @@ -