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 af50472fa9
commit 559b3140bf
4 changed files with 17 additions and 4 deletions

View File

@ -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());

View File

@ -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;

View File

@ -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;
}

View File

@ -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());
}
}
/**