新乡12356心理咨询热线

TreeSelect.java 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package api.entity.view;
  2. import api.entity.database.system.Dept;
  3. import api.entity.database.system.MainProblem;
  4. import api.entity.database.system.Menu;
  5. import api.entity.database.system.WorkOrderType;
  6. import com.fasterxml.jackson.annotation.JsonInclude;
  7. import lombok.Data;
  8. import java.io.Serializable;
  9. import java.util.List;
  10. import java.util.Map;
  11. import java.util.stream.Collectors;
  12. /**
  13. * Treeselect树结构实体类
  14. *
  15. * @author jiayi
  16. */
  17. @Data
  18. public class TreeSelect implements Serializable
  19. {
  20. private static final long serialVersionUID = 1L;
  21. /** 节点ID */
  22. private Long id;
  23. /** 节点名称 */
  24. private String label;
  25. /** 节点编码 */
  26. private String code;
  27. /** 子节点 */
  28. @JsonInclude(JsonInclude.Include.NON_EMPTY)
  29. private List<TreeSelect> children;
  30. /** 子节点 */
  31. // @JsonInclude(JsonInclude.Include.NON_EMPTY)
  32. private List<Map> user;
  33. public TreeSelect() {}
  34. public TreeSelect(Dept dept)
  35. {
  36. this.id = dept.getDeptId();
  37. this.label = dept.getDeptName();
  38. this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
  39. this.user= dept.getUserchildren();
  40. //.stream().map(User::getUserId,User::getUserName,User::getNickName).collect(Collectors.toList());
  41. }
  42. public TreeSelect(Menu menu) {
  43. this.id=menu.getMenuId();
  44. this.label=menu.getMenuName();
  45. this.children=menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
  46. }
  47. public TreeSelect(WorkOrderType Type) {
  48. this.id=Type.getId();
  49. this.label=Type.getTypeName();
  50. this.code=Type.getTypeCode();
  51. this.children=Type.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
  52. }
  53. public TreeSelect(MainProblem Type) {
  54. this.id=Type.getId();
  55. this.label=Type.getTypeName();
  56. this.code=Type.getTypeCode();
  57. this.children=Type.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
  58. }
  59. }