refactor(接口测试): 接口管理模块接口定义优化代码
This commit is contained in:
parent
1cf3517c8d
commit
e89b978c8d
|
@ -676,8 +676,9 @@ public class ApiDefinitionService {
|
||||||
handleMultipleVersions(apiDefinition);
|
handleMultipleVersions(apiDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ApiDefinitionModule apiDefinitionModule = apiDefinitionModuleMapper.selectByPrimaryKey(apiDefinition.getModuleId());
|
||||||
// 判断接口的模块 ID 是否存在,不存在修改模块 ID 为未规划模块 ID
|
// 判断接口的模块 ID 是否存在,不存在修改模块 ID 为未规划模块 ID
|
||||||
if (!ModuleConstants.DEFAULT_NODE_ID.equals(apiDefinition.getModuleId()) && moduleNeedsUpdate(apiDefinition.getModuleId()) == null) {
|
if (!ModuleConstants.DEFAULT_NODE_ID.equals(apiDefinition.getModuleId()) && apiDefinitionModule == null) {
|
||||||
updateApiIds.add(apiDefinition.getId());
|
updateApiIds.add(apiDefinition.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,12 +689,6 @@ public class ApiDefinitionService {
|
||||||
recoverApiRelatedData(apiIds, userId, projectId);
|
recoverApiRelatedData(apiIds, userId, projectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApiDefinitionModule moduleNeedsUpdate(String moduleId) {
|
|
||||||
ApiDefinitionModule apiDefinitionModule;
|
|
||||||
apiDefinitionModule = apiDefinitionModuleMapper.selectByPrimaryKey(moduleId);
|
|
||||||
return apiDefinitionModule;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleModule(List<String> updateApiIds) {
|
private void handleModule(List<String> updateApiIds) {
|
||||||
if(!updateApiIds.isEmpty()){
|
if(!updateApiIds.isEmpty()){
|
||||||
ApiDefinition updateApiDefinition = new ApiDefinition();
|
ApiDefinition updateApiDefinition = new ApiDefinition();
|
||||||
|
@ -838,7 +833,7 @@ public class ApiDefinitionService {
|
||||||
if(ApiDefinitionDocType.ALL.name().equals(request.getType())){
|
if(ApiDefinitionDocType.ALL.name().equals(request.getType())){
|
||||||
apiDefinitionDocDTO.setDocTitle(Translator.get(ALL_API));
|
apiDefinitionDocDTO.setDocTitle(Translator.get(ALL_API));
|
||||||
} else {
|
} else {
|
||||||
ApiDefinitionModule apiDefinitionModule = moduleNeedsUpdate(first.getModuleId());
|
ApiDefinitionModule apiDefinitionModule = apiDefinitionModuleMapper.selectByPrimaryKey(first.getModuleId());
|
||||||
if (apiDefinitionModule != null) {
|
if (apiDefinitionModule != null) {
|
||||||
apiDefinitionDocDTO.setDocTitle(apiDefinitionModule.getName());
|
apiDefinitionDocDTO.setDocTitle(apiDefinitionModule.getName());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue