refactor(项目设置): 模块树返回值增加parentId字段

This commit is contained in:
song-tianyang 2023-10-20 14:25:40 +08:00 committed by f2c-ci-robot[bot]
parent bcc408abce
commit efd0f47d3d
2 changed files with 11 additions and 11 deletions

View File

@ -23,8 +23,8 @@ public class BaseTreeNode {
@Schema(description = "是否是叶子节点")
private boolean leafNode = false;
// @Schema(description = "排序单位")
// private int pos;
@Schema(description = "父节点ID")
private String parentId;
@Schema(description = "子节点")
private List<BaseTreeNode> children = new ArrayList<>();
@ -35,12 +35,12 @@ public class BaseTreeNode {
this.type = type;
}
// public BaseTreeNode(String id, String name, String type, int pos) {
// this.id = id;
// this.name = name;
// this.type = type;
// this.pos = pos;
// }
public BaseTreeNode(String id, String name, String type, String parentId) {
this.id = id;
this.name = name;
this.type = type;
this.parentId = parentId;
}
public void addChild(BaseTreeNode node) {
this.leafNode = false;

View File

@ -51,12 +51,12 @@ public class FileModuleService extends ModuleTreeService implements CleanupProje
List<FileModule> notMatchedList = new ArrayList<>();
for (FileModule fileModule : fileModuleList) {
if (StringUtils.equals(fileModule.getParentId(), ModuleConstants.ROOT_NODE_PARENT_ID)) {
BaseTreeNode node = new BaseTreeNode(fileModule.getId(), fileModule.getName(), ModuleConstants.NODE_TYPE_DEFAULT);
BaseTreeNode node = new BaseTreeNode(fileModule.getId(), fileModule.getName(), ModuleConstants.NODE_TYPE_DEFAULT, fileModule.getParentId());
baseTreeNodeList.add(node);
baseTreeNodeMap.put(fileModule.getId(), node);
} else {
if (baseTreeNodeMap.containsKey(fileModule.getParentId())) {
BaseTreeNode node = new BaseTreeNode(fileModule.getId(), fileModule.getName(), ModuleConstants.NODE_TYPE_DEFAULT);
BaseTreeNode node = new BaseTreeNode(fileModule.getId(), fileModule.getName(), ModuleConstants.NODE_TYPE_DEFAULT, fileModule.getParentId());
baseTreeNodeMap.get(fileModule.getParentId()).addChild(node);
baseTreeNodeMap.put(fileModule.getId(), node);
} else {
@ -226,7 +226,7 @@ public class FileModuleService extends ModuleTreeService implements CleanupProje
@Override
public void cleanReportResources(String projectId) {
// nothing to do
}
}