package api.entity.view; import api.entity.database.system.Dept; import api.entity.database.system.MainProblem; import api.entity.database.system.Menu; import api.entity.database.system.WorkOrderType; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.Data; import java.io.Serializable; import java.util.List; import java.util.Map; import java.util.stream.Collectors; /** * Treeselect树结构实体类 * * @author jiayi */ @Data public class TreeSelect implements Serializable { private static final long serialVersionUID = 1L; /** 节点ID */ private Long id; /** 节点名称 */ private String label; /** 节点编码 */ private String code; /** 子节点 */ @JsonInclude(JsonInclude.Include.NON_EMPTY) private List children; /** 子节点 */ // @JsonInclude(JsonInclude.Include.NON_EMPTY) private List user; public TreeSelect() {} public TreeSelect(Dept dept) { this.id = dept.getDeptId(); this.label = dept.getDeptName(); this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); this.user= dept.getUserchildren(); //.stream().map(User::getUserId,User::getUserName,User::getNickName).collect(Collectors.toList()); } public TreeSelect(Menu menu) { this.id=menu.getMenuId(); this.label=menu.getMenuName(); this.children=menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); } public TreeSelect(WorkOrderType Type) { this.id=Type.getId(); this.label=Type.getTypeName(); this.code=Type.getTypeCode(); this.children=Type.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); } public TreeSelect(MainProblem Type) { this.id=Type.getId(); this.label=Type.getTypeName(); this.code=Type.getTypeCode(); this.children=Type.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); } }