diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java index 8f5f81b960..ce8caf07a3 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java @@ -782,7 +782,10 @@ public class ApiDefinitionService { apiTestCaseService.updateByApiDefinitionId(ids, test, request.getTriggerUpdate()); } ApiDefinitionWithBLOBs result = apiDefinitionMapper.selectByPrimaryKey(test.getId()); - //checkAndSetLatestVersion(result.getRefId()); + String defaultVersion = baseProjectVersionMapper.getDefaultVersion(request.getProjectId()); + if (StringUtils.equalsIgnoreCase(request.getVersionId(), defaultVersion)) { + checkAndSetLatestVersion(result.getRefId()); + } // 存储附件关系 extFileAssociationService.saveApi(test.getId(), request.getRequest(), FileAssociationTypeEnums.API.name()); diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java index fbd47939ee..e0df117ce0 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java @@ -409,7 +409,10 @@ public class ApiScenarioService { if (relationshipEdgeService != null) { relationshipEdgeService.initRelationshipEdge(beforeScenario, scenario); } - //checkAndSetLatestVersion(beforeScenario.getRefId()); + String defaultVersion = baseProjectVersionMapper.getDefaultVersion(request.getProjectId()); + if (StringUtils.equalsIgnoreCase(request.getVersionId(), defaultVersion)) { + checkAndSetLatestVersion(beforeScenario.getRefId()); + } // 存储附件关系 extFileAssociationService.saveScenario(scenario.getId(), request.getScenarioDefinition()); return scenario; diff --git a/performance-test/backend/src/main/java/io/metersphere/service/PerformanceTestService.java b/performance-test/backend/src/main/java/io/metersphere/service/PerformanceTestService.java index 235bfd33d1..7d7b817084 100644 --- a/performance-test/backend/src/main/java/io/metersphere/service/PerformanceTestService.java +++ b/performance-test/backend/src/main/java/io/metersphere/service/PerformanceTestService.java @@ -325,7 +325,10 @@ public class PerformanceTestService { copyLoadTestFiles(testId, loadTest.getId()); loadTestMapper.insertSelective(loadTest); } - //checkAndSetLatestVersion(loadTest.getRefId()); + String defaultVersion = baseProjectVersionMapper.getDefaultVersion(request.getProjectId()); + if (StringUtils.equalsIgnoreCase(request.getVersionId(), defaultVersion)) { + checkAndSetLatestVersion(loadTest.getRefId()); + } return loadTest; } diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java index 0f85dbc882..83d7481c47 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -463,7 +463,11 @@ public class TestCaseService { dealWithOtherInfoOfNewVersion(testCase, oldTestCase.getId()); testCaseMapper.insertSelective(testCase); } - //checkAndSetLatestVersion(testCase.getRefId()); + String defaultVersion = baseProjectVersionMapper.getDefaultVersion(testCase.getProjectId()); + if (StringUtils.equalsIgnoreCase(testCase.getVersionId(), defaultVersion)) { + checkAndSetLatestVersion(testCase.getRefId()); + } + } /**