package com.zhitan.model.domain; import com.fasterxml.jackson.annotation.JsonInclude; import java.io.Serializable; import java.util.List; import java.util.stream.Collectors; /** * Treeselect树结构实体类 * * @author ruoyi */ public class TreeObject implements Serializable { private static final long serialVersionUID = 1L; /** * 节点ID */ private String id; /** * 节点名称 */ private String label; private String nodeCategory; /** * 子节点 */ @JsonInclude(JsonInclude.Include.NON_EMPTY) private List children; public TreeObject() { } public TreeObject(ModelNode modelNode) { this.id = modelNode.getNodeId(); this.label = modelNode.getName(); this.nodeCategory= modelNode.getNodeCategory(); this.children = modelNode.getChildren().stream().map(TreeObject::new).collect(Collectors.toList()); } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public List getChildren() { return children; } public void setChildren(List children) { this.children = children; } public String getNodeCategory() { return nodeCategory; } public void setNodeCategory(String nodeCategory) { this.nodeCategory = nodeCategory; } }