SysRole.java 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. package com.bizmatics.model.system;
  2. import com.bizmatics.model.base.BaseEntity;
  3. import org.apache.commons.lang3.builder.ToStringBuilder;
  4. import org.apache.commons.lang3.builder.ToStringStyle;
  5. import javax.validation.constraints.NotBlank;
  6. import javax.validation.constraints.Size;
  7. /**
  8. * 角色表 sys_role
  9. *
  10. * @author yq
  11. */
  12. public class SysRole extends BaseEntity
  13. {
  14. private static final long serialVersionUID = 1L;
  15. /** 角色ID */
  16. private Long roleId;
  17. /** 角色名称 */
  18. private String roleName;
  19. /** 角色权限 */
  20. private String roleKey;
  21. /** 角色排序 */
  22. private String roleSort;
  23. /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
  24. private String dataScope;
  25. /** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */
  26. private boolean menuCheckStrictly;
  27. /** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */
  28. private boolean deptCheckStrictly;
  29. /** 角色状态(0正常 1停用) */
  30. private String status;
  31. /** 删除标志(0代表存在 2代表删除) */
  32. private String delFlag;
  33. /** 用户是否存在此角色标识 默认不存在 */
  34. private boolean flag = false;
  35. /** 菜单组 */
  36. private Long[] menuIds;
  37. /** 部门组(数据权限) */
  38. private Long[] deptIds;
  39. /** 创建用户 */
  40. private String createByOne;
  41. /**
  42. * 租户ID
  43. */
  44. private Integer tenantId;
  45. public SysRole()
  46. {
  47. }
  48. public SysRole(Long roleId)
  49. {
  50. this.roleId = roleId;
  51. }
  52. public Long getRoleId()
  53. {
  54. return roleId;
  55. }
  56. public void setRoleId(Long roleId)
  57. {
  58. this.roleId = roleId;
  59. }
  60. public boolean isAdmin()
  61. {
  62. return isAdmin(this.roleId);
  63. }
  64. public static boolean isAdmin(Long roleId)
  65. {
  66. return roleId != null && 1L == roleId;
  67. }
  68. @NotBlank(message = "角色名称不能为空")
  69. @Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
  70. public String getRoleName()
  71. {
  72. return roleName;
  73. }
  74. public void setRoleName(String roleName)
  75. {
  76. this.roleName = roleName;
  77. }
  78. @NotBlank(message = "权限字符不能为空")
  79. @Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
  80. public String getRoleKey()
  81. {
  82. return roleKey;
  83. }
  84. public void setRoleKey(String roleKey)
  85. {
  86. this.roleKey = roleKey;
  87. }
  88. @NotBlank(message = "显示顺序不能为空")
  89. public String getRoleSort()
  90. {
  91. return roleSort;
  92. }
  93. public void setRoleSort(String roleSort)
  94. {
  95. this.roleSort = roleSort;
  96. }
  97. public String getDataScope()
  98. {
  99. return dataScope;
  100. }
  101. public void setDataScope(String dataScope)
  102. {
  103. this.dataScope = dataScope;
  104. }
  105. public boolean isMenuCheckStrictly()
  106. {
  107. return menuCheckStrictly;
  108. }
  109. public void setMenuCheckStrictly(boolean menuCheckStrictly)
  110. {
  111. this.menuCheckStrictly = menuCheckStrictly;
  112. }
  113. public boolean isDeptCheckStrictly()
  114. {
  115. return deptCheckStrictly;
  116. }
  117. public void setDeptCheckStrictly(boolean deptCheckStrictly)
  118. {
  119. this.deptCheckStrictly = deptCheckStrictly;
  120. }
  121. public String getStatus()
  122. {
  123. return status;
  124. }
  125. public void setStatus(String status)
  126. {
  127. this.status = status;
  128. }
  129. public String getDelFlag()
  130. {
  131. return delFlag;
  132. }
  133. public void setDelFlag(String delFlag)
  134. {
  135. this.delFlag = delFlag;
  136. }
  137. public boolean isFlag()
  138. {
  139. return flag;
  140. }
  141. public void setFlag(boolean flag)
  142. {
  143. this.flag = flag;
  144. }
  145. public Long[] getMenuIds()
  146. {
  147. return menuIds;
  148. }
  149. public void setMenuIds(Long[] menuIds)
  150. {
  151. this.menuIds = menuIds;
  152. }
  153. public Long[] getDeptIds()
  154. {
  155. return deptIds;
  156. }
  157. public void setDeptIds(Long[] deptIds)
  158. {
  159. this.deptIds = deptIds;
  160. }
  161. public void setCreateByOne(String createByOne)
  162. {
  163. this.createByOne = createByOne;
  164. }
  165. public String getCreateByOne()
  166. {
  167. return createByOne;
  168. }
  169. public void setTenantId(Integer tenantId)
  170. {
  171. this.tenantId = tenantId;
  172. }
  173. public Integer getTenantId()
  174. {
  175. return tenantId;
  176. }
  177. @Override
  178. public String toString() {
  179. return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
  180. .append("roleId", getRoleId())
  181. .append("roleName", getRoleName())
  182. .append("roleKey", getRoleKey())
  183. .append("roleSort", getRoleSort())
  184. .append("dataScope", getDataScope())
  185. .append("menuCheckStrictly", isMenuCheckStrictly())
  186. .append("deptCheckStrictly", isDeptCheckStrictly())
  187. .append("status", getStatus())
  188. .append("delFlag", getDelFlag())
  189. .append("createBy", getCreateBy())
  190. .append("createTime", getCreateTime())
  191. .append("updateBy", getUpdateBy())
  192. .append("updateTime", getUpdateTime())
  193. .append("remark", getRemark())
  194. .toString();
  195. }
  196. }