fix: 导入测试用例报错
This commit is contained in:
parent
0171d1ece0
commit
8912941bea
|
@ -252,7 +252,7 @@
|
||||||
<if test="request.orders != null and request.orders.size() > 0">
|
<if test="request.orders != null and request.orders.size() > 0">
|
||||||
order by
|
order by
|
||||||
<foreach collection="request.orders" separator="," item="order">
|
<foreach collection="request.orders" separator="," item="order">
|
||||||
${order.name} ${order.type}
|
`${order.name}` ${order.type}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -598,11 +598,12 @@ public class TestCaseService {
|
||||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||||
Project project = projectService.getProjectById(projectId);
|
Project project = projectService.getProjectById(projectId);
|
||||||
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
|
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
|
||||||
|
Long nextOrder = ServiceUtils.getNextOrder(projectId, extTestCaseMapper::getLastOrder);
|
||||||
if (!testCases.isEmpty()) {
|
if (!testCases.isEmpty()) {
|
||||||
AtomicInteger sort = new AtomicInteger();
|
AtomicInteger sort = new AtomicInteger();
|
||||||
AtomicInteger num = new AtomicInteger();
|
AtomicInteger num = new AtomicInteger();
|
||||||
num.set(getNextNum(projectId) + testCases.size());
|
num.set(getNextNum(projectId) + testCases.size());
|
||||||
testCases.forEach(testcase -> {
|
for (TestCaseWithBLOBs testcase: testCases) {
|
||||||
testcase.setId(UUID.randomUUID().toString());
|
testcase.setId(UUID.randomUUID().toString());
|
||||||
testcase.setCreateUser(SessionUtils.getUserId());
|
testcase.setCreateUser(SessionUtils.getUserId());
|
||||||
testcase.setCreateTime(System.currentTimeMillis());
|
testcase.setCreateTime(System.currentTimeMillis());
|
||||||
|
@ -615,8 +616,10 @@ public class TestCaseService {
|
||||||
testcase.setCustomNum(String.valueOf(number));
|
testcase.setCustomNum(String.valueOf(number));
|
||||||
}
|
}
|
||||||
testcase.setReviewStatus(TestCaseReviewStatus.Prepare.name());
|
testcase.setReviewStatus(TestCaseReviewStatus.Prepare.name());
|
||||||
|
testcase.setOrder(nextOrder);
|
||||||
mapper.insert(testcase);
|
mapper.insert(testcase);
|
||||||
});
|
nextOrder += 5000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sqlSession.flushStatements();
|
sqlSession.flushStatements();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue