fix: 导入场景的时候默认latest

This commit is contained in:
CaptainB 2022-01-23 21:49:38 +08:00 committed by zhangdahai112
parent bce71e9648
commit c1df78530e
1 changed files with 5 additions and 1 deletions

View File

@ -1321,6 +1321,7 @@ public class ApiAutomationService {
private void editScenario(ApiTestImportRequest request, ScenarioImport apiImport) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
ApiScenarioMapper batchMapper = sqlSession.getMapper(ApiScenarioMapper.class);
ExtApiScenarioMapper extApiScenarioMapper = sqlSession.getMapper(ExtApiScenarioMapper.class);
List<ApiScenarioWithBLOBs> data = apiImport.getData();
currentScenarioOrder.remove();
int num = 0;
@ -1348,7 +1349,10 @@ public class ApiAutomationService {
if (StringUtils.isBlank(item.getId())) {
item.setId(UUID.randomUUID().toString());
}
importCreate(item, batchMapper, request);
// 导入之后刷新latest
ApiScenarioWithBLOBs result = importCreate(item, batchMapper, request);
extApiScenarioMapper.clearLatestVersion(result.getRefId());
extApiScenarioMapper.addLatestVersion(result.getRefId());
if (i % 300 == 0) {
sqlSession.flushStatements();
}