diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index 4c37bf1ae3..311a3a2002 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -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 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(); }