refactor(通用功能): 版本置新最新版本不允许设置最新版本

--bug=1020898 --user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001020898
This commit is contained in:
guoyuqi 2022-12-16 10:56:18 +08:00 committed by 刘瑞斌
parent 0f4cfcc821
commit fc292d686b
4 changed files with 17 additions and 4 deletions

View File

@ -782,7 +782,10 @@ public class ApiDefinitionService {
apiTestCaseService.updateByApiDefinitionId(ids, test, request.getTriggerUpdate()); apiTestCaseService.updateByApiDefinitionId(ids, test, request.getTriggerUpdate());
} }
ApiDefinitionWithBLOBs result = apiDefinitionMapper.selectByPrimaryKey(test.getId()); 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()); extFileAssociationService.saveApi(test.getId(), request.getRequest(), FileAssociationTypeEnums.API.name());

View File

@ -409,7 +409,10 @@ public class ApiScenarioService {
if (relationshipEdgeService != null) { if (relationshipEdgeService != null) {
relationshipEdgeService.initRelationshipEdge(beforeScenario, scenario); 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()); extFileAssociationService.saveScenario(scenario.getId(), request.getScenarioDefinition());
return scenario; return scenario;

View File

@ -325,7 +325,10 @@ public class PerformanceTestService {
copyLoadTestFiles(testId, loadTest.getId()); copyLoadTestFiles(testId, loadTest.getId());
loadTestMapper.insertSelective(loadTest); loadTestMapper.insertSelective(loadTest);
} }
//checkAndSetLatestVersion(loadTest.getRefId()); String defaultVersion = baseProjectVersionMapper.getDefaultVersion(request.getProjectId());
if (StringUtils.equalsIgnoreCase(request.getVersionId(), defaultVersion)) {
checkAndSetLatestVersion(loadTest.getRefId());
}
return loadTest; return loadTest;
} }

View File

@ -463,7 +463,11 @@ public class TestCaseService {
dealWithOtherInfoOfNewVersion(testCase, oldTestCase.getId()); dealWithOtherInfoOfNewVersion(testCase, oldTestCase.getId());
testCaseMapper.insertSelective(testCase); testCaseMapper.insertSelective(testCase);
} }
//checkAndSetLatestVersion(testCase.getRefId()); String defaultVersion = baseProjectVersionMapper.getDefaultVersion(testCase.getProjectId());
if (StringUtils.equalsIgnoreCase(testCase.getVersionId(), defaultVersion)) {
checkAndSetLatestVersion(testCase.getRefId());
}
} }
/** /**