fix: 修改模块名称报错

This commit is contained in:
chenjianxing 2021-01-06 16:31:27 +08:00
parent 9cb5c64925
commit 1566f8c79b
1 changed files with 12 additions and 10 deletions

View File

@ -213,9 +213,10 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
public int editNode(DragModuleRequest request) {
request.setUpdateTime(System.currentTimeMillis());
checkApiModuleExist(request);
List<ApiDefinitionResult> apiModule = queryByModuleIds(request.getNodeIds());
List<ApiDefinitionResult> apiDefinitionResults = queryByModuleIds(request.getNodeIds());
apiModule.forEach(apiDefinition -> {
apiDefinitionResults.forEach(apiDefinition -> {
if (StringUtils.isNotBlank(apiDefinition.getModulePath())) {
StringBuilder path = new StringBuilder(apiDefinition.getModulePath());
List<String> pathLists = Arrays.asList(path.toString().split("/"));
pathLists.set(request.getLevel(), request.getName());
@ -224,9 +225,10 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
path = path.append("/").append(pathLists.get(i));
}
apiDefinition.setModulePath(path.toString());
}
});
batchUpdateApiDefinition(apiModule);
batchUpdateApiDefinition(apiDefinitionResults);
return apiModuleMapper.updateByPrimaryKeySelective(request);
}