构建Tree对象
@Data
public class Tree<T> {
//节点ID
private String id;
//父ID
private String parentid;
//显示节点文本
private String title;
//是否有父节点
private boolean hasParent = false;
//是否有子节点
private boolean hasChildren = false;
//节点属性
private Map<String, Object> attributes;
//节点的子节点
private List<Tree<T>> children;
//节点是否被选中 true false
private boolean checked = false;
}
存入方式:找到根节点,根据根节点找list子节点,再迭代子节点
网友评论