From 8912941beaedd7cd9bc8e1152c03c94c8982305a Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 17 Sep 2021 10:39:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=BC=E5=85=A5=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml | 2 +- .../java/io/metersphere/track/service/TestCaseService.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml index 4692b75385..f5365a7133 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml @@ -252,7 +252,7 @@ order by - ${order.name} ${order.type} + `${order.name}` ${order.type} 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 bcac6946a1..7c3ae14328 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -598,11 +598,12 @@ public class TestCaseService { SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); Project project = projectService.getProjectById(projectId); TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class); + Long nextOrder = ServiceUtils.getNextOrder(projectId, extTestCaseMapper::getLastOrder); if (!testCases.isEmpty()) { AtomicInteger sort = new AtomicInteger(); AtomicInteger num = new AtomicInteger(); num.set(getNextNum(projectId) + testCases.size()); - testCases.forEach(testcase -> { + for (TestCaseWithBLOBs testcase: testCases) { testcase.setId(UUID.randomUUID().toString()); testcase.setCreateUser(SessionUtils.getUserId()); testcase.setCreateTime(System.currentTimeMillis()); @@ -615,8 +616,10 @@ public class TestCaseService { testcase.setCustomNum(String.valueOf(number)); } testcase.setReviewStatus(TestCaseReviewStatus.Prepare.name()); + testcase.setOrder(nextOrder); mapper.insert(testcase); - }); + nextOrder += 5000; + } } sqlSession.flushStatements(); }