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