fix: 修改模块名称报错
This commit is contained in:
parent
9cb5c64925
commit
1566f8c79b
|
@ -213,20 +213,22 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
||||||
public int editNode(DragModuleRequest request) {
|
public int editNode(DragModuleRequest request) {
|
||||||
request.setUpdateTime(System.currentTimeMillis());
|
request.setUpdateTime(System.currentTimeMillis());
|
||||||
checkApiModuleExist(request);
|
checkApiModuleExist(request);
|
||||||
List<ApiDefinitionResult> apiModule = queryByModuleIds(request.getNodeIds());
|
List<ApiDefinitionResult> apiDefinitionResults = queryByModuleIds(request.getNodeIds());
|
||||||
|
|
||||||
apiModule.forEach(apiDefinition -> {
|
apiDefinitionResults.forEach(apiDefinition -> {
|
||||||
StringBuilder path = new StringBuilder(apiDefinition.getModulePath());
|
if (StringUtils.isNotBlank(apiDefinition.getModulePath())) {
|
||||||
List<String> pathLists = Arrays.asList(path.toString().split("/"));
|
StringBuilder path = new StringBuilder(apiDefinition.getModulePath());
|
||||||
pathLists.set(request.getLevel(), request.getName());
|
List<String> pathLists = Arrays.asList(path.toString().split("/"));
|
||||||
path.delete(0, path.length());
|
pathLists.set(request.getLevel(), request.getName());
|
||||||
for (int i = 1; i < pathLists.size(); i++) {
|
path.delete(0, path.length());
|
||||||
path = path.append("/").append(pathLists.get(i));
|
for (int i = 1; i < pathLists.size(); i++) {
|
||||||
|
path = path.append("/").append(pathLists.get(i));
|
||||||
|
}
|
||||||
|
apiDefinition.setModulePath(path.toString());
|
||||||
}
|
}
|
||||||
apiDefinition.setModulePath(path.toString());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
batchUpdateApiDefinition(apiModule);
|
batchUpdateApiDefinition(apiDefinitionResults);
|
||||||
|
|
||||||
return apiModuleMapper.updateByPrimaryKeySelective(request);
|
return apiModuleMapper.updateByPrimaryKeySelective(request);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue