MenuTreeVo.java 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. package com.xjrsoft.module.system.vo;
  2. import cn.hutool.core.util.StrUtil;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.fasterxml.jackson.annotation.JsonAutoDetect;
  5. import com.xjrsoft.common.enums.YesOrNoEnum;
  6. import com.xjrsoft.common.model.tree.ITreeNode;
  7. import io.swagger.annotations.ApiModelProperty;
  8. import lombok.Data;
  9. import java.io.Serializable;
  10. import java.util.List;
  11. /**
  12. * <p>
  13. * 获取菜单树vo
  14. * </p>
  15. *
  16. * @author tzx
  17. * @since 2021-09-20
  18. */
  19. @Data
  20. @JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.ANY)
  21. public class MenuTreeVo implements ITreeNode<MenuTreeVo,Long>, Serializable {
  22. private static final long serialVersionUID = 1L;
  23. /**
  24. * 上级Id
  25. */
  26. private Long id;
  27. /**
  28. * 上级Id
  29. */
  30. private Long parentId;
  31. /**
  32. * 组件名(路由名称) -- 与vue代码组件名必须一直 才能做到缓存页面 相关联
  33. */
  34. private String name;
  35. /**
  36. * 菜单名
  37. */
  38. private String title;
  39. /**
  40. * 菜单编号
  41. */
  42. private String code;
  43. /**
  44. * 菜单图标
  45. */
  46. private String icon;
  47. /**
  48. * 图标地址
  49. */
  50. private String iconUrl;
  51. /**
  52. * 地址
  53. */
  54. private String path;
  55. /**
  56. * 组件地址
  57. */
  58. private String component;
  59. /**
  60. * 组件类型 默认组件 0 普通需要注册的组件 1 自定义表单 桌面设计 等已经默认注册进来的组件
  61. */
  62. private Integer componentType;
  63. /**
  64. * 外链地址
  65. */
  66. private String iframeSrc;
  67. /**
  68. * 组件类型
  69. */
  70. private Integer menuType;
  71. /**
  72. * 菜单显示或者隐藏
  73. */
  74. private Integer display;
  75. /**
  76. * 是否允许修改
  77. */
  78. private Integer allowModify;
  79. /**
  80. * 是否允许删除
  81. */
  82. private Integer allowDelete;
  83. /**
  84. * 是否外链
  85. */
  86. private Integer outLink;
  87. /**
  88. * 页面持久化
  89. */
  90. private Integer keepAlive;
  91. /**
  92. * 排序码
  93. */
  94. private Integer sortCode;
  95. /**
  96. * 排序码
  97. */
  98. private String remark;
  99. /**
  100. * 系统主键(主系统默认为0)
  101. */
  102. private Long systemId;
  103. /**
  104. * 系统名称
  105. */
  106. private String systemName;
  107. /**
  108. * 表单id
  109. */
  110. private Long formId;
  111. private Integer enabledMark;
  112. private String deptName;
  113. private String deptId;
  114. private List<MenuTreeVo> children;
  115. private Boolean disabled;
  116. public Boolean getDisabled() {
  117. return this.menuType != null &&this.menuType == 1;
  118. }
  119. private JSONObject meta;
  120. public JSONObject getMeta() {
  121. if (meta == null) {
  122. meta = new JSONObject();
  123. }
  124. meta.put("affix", false);
  125. meta.put("icon", this.icon);
  126. meta.put("orderNo", this.sortCode);
  127. meta.put("title", this.title);
  128. meta.put("outLink", this.outLink);
  129. meta.put("systemId", this.systemId);
  130. meta.put("formId", this.formId);
  131. meta.put("menuId", this.id);
  132. meta.put("menuType", this.menuType);
  133. meta.put("hideMenu", this.display == YesOrNoEnum.NO.getCode());
  134. if (StrUtil.isBlank(this.component)) {
  135. meta.put("ignoreRoute", true);
  136. }
  137. //如果是外部连接 将path 作为 meta 的frameSrc 传递出去
  138. if (this.outLink != null && this.outLink == 1) {
  139. meta.put("frameSrc", this.iframeSrc);
  140. }
  141. return meta;
  142. }
  143. public Long getParentId() {
  144. if (this.parentId == null || this.parentId == 0) {
  145. return null;
  146. }
  147. return parentId;
  148. }
  149. @ApiModelProperty("是否有权限(1:是 0:否)")
  150. private Integer authorized;
  151. }