提交 | 用户 | 时间
|
e57a89
|
1 |
package com.jcdm.common.core.domain.entity; |
懒 |
2 |
|
|
3 |
import java.util.Date; |
|
4 |
import java.util.List; |
|
5 |
import javax.validation.constraints.*; |
|
6 |
import org.apache.commons.lang3.builder.ToStringBuilder; |
|
7 |
import org.apache.commons.lang3.builder.ToStringStyle; |
|
8 |
import com.jcdm.common.annotation.Excel; |
|
9 |
import com.jcdm.common.annotation.Excel.ColumnType; |
|
10 |
import com.jcdm.common.annotation.Excel.Type; |
|
11 |
import com.jcdm.common.annotation.Excels; |
|
12 |
import com.jcdm.common.core.domain.BaseEntity; |
|
13 |
import com.jcdm.common.xss.Xss; |
|
14 |
|
|
15 |
/** |
|
16 |
* 用户对象 sys_user |
|
17 |
* |
|
18 |
* @author jc |
|
19 |
*/ |
|
20 |
public class SysUser extends BaseEntity |
|
21 |
{ |
|
22 |
private static final long serialVersionUID = 1L; |
|
23 |
|
|
24 |
/** 用户ID */ |
|
25 |
@Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号") |
|
26 |
private Long userId; |
|
27 |
|
|
28 |
/** 部门ID */ |
|
29 |
@Excel(name = "部门编号", type = Type.IMPORT) |
|
30 |
private Long deptId; |
|
31 |
|
|
32 |
/** 用户账号 */ |
|
33 |
@Excel(name = "登录名称") |
|
34 |
private String userName; |
|
35 |
|
|
36 |
/** 用户昵称 */ |
|
37 |
@Excel(name = "用户名称") |
|
38 |
private String nickName; |
|
39 |
|
|
40 |
/** 用户邮箱 */ |
|
41 |
@Excel(name = "用户邮箱") |
|
42 |
private String email; |
|
43 |
|
|
44 |
/** 手机号码 */ |
|
45 |
@Excel(name = "手机号码") |
|
46 |
private String phonenumber; |
|
47 |
|
|
48 |
/** 用户性别 */ |
|
49 |
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") |
|
50 |
private String sex; |
|
51 |
|
|
52 |
/** 用户头像 */ |
|
53 |
private String avatar; |
|
54 |
|
|
55 |
/** 密码 */ |
|
56 |
private String password; |
|
57 |
|
|
58 |
/** 帐号状态(0正常 1停用) */ |
|
59 |
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") |
|
60 |
private String status; |
|
61 |
|
|
62 |
/** 删除标志(0代表存在 2代表删除) */ |
|
63 |
private String delFlag; |
|
64 |
|
|
65 |
/** 最后登录IP */ |
|
66 |
@Excel(name = "最后登录IP", type = Type.EXPORT) |
|
67 |
private String loginIp; |
|
68 |
|
|
69 |
/** 最后登录时间 */ |
|
70 |
@Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT) |
|
71 |
private Date loginDate; |
|
72 |
|
|
73 |
/** 部门对象 */ |
|
74 |
@Excels({ |
|
75 |
@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT), |
|
76 |
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT) |
|
77 |
}) |
|
78 |
private SysDept dept; |
|
79 |
|
|
80 |
/** 角色对象 */ |
|
81 |
private List<SysRole> roles; |
|
82 |
|
|
83 |
/** 角色组 */ |
|
84 |
private Long[] roleIds; |
|
85 |
|
|
86 |
/** 岗位组 */ |
|
87 |
private Long[] postIds; |
|
88 |
|
|
89 |
/** 角色ID */ |
|
90 |
private Long roleId; |
|
91 |
|
|
92 |
public SysUser() |
|
93 |
{ |
|
94 |
|
|
95 |
} |
|
96 |
|
|
97 |
public SysUser(Long userId) |
|
98 |
{ |
|
99 |
this.userId = userId; |
|
100 |
} |
|
101 |
|
|
102 |
public Long getUserId() |
|
103 |
{ |
|
104 |
return userId; |
|
105 |
} |
|
106 |
|
|
107 |
public void setUserId(Long userId) |
|
108 |
{ |
|
109 |
this.userId = userId; |
|
110 |
} |
|
111 |
|
|
112 |
public boolean isAdmin() |
|
113 |
{ |
|
114 |
return isAdmin(this.userId); |
|
115 |
} |
|
116 |
|
|
117 |
public static boolean isAdmin(Long userId) |
|
118 |
{ |
|
119 |
return userId != null && 1L == userId; |
|
120 |
} |
|
121 |
|
|
122 |
public Long getDeptId() |
|
123 |
{ |
|
124 |
return deptId; |
|
125 |
} |
|
126 |
|
|
127 |
public void setDeptId(Long deptId) |
|
128 |
{ |
|
129 |
this.deptId = deptId; |
|
130 |
} |
|
131 |
|
|
132 |
@Xss(message = "用户昵称不能包含脚本字符") |
|
133 |
@Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") |
|
134 |
public String getNickName() |
|
135 |
{ |
|
136 |
return nickName; |
|
137 |
} |
|
138 |
|
|
139 |
public void setNickName(String nickName) |
|
140 |
{ |
|
141 |
this.nickName = nickName; |
|
142 |
} |
|
143 |
|
|
144 |
@Xss(message = "用户账号不能包含脚本字符") |
|
145 |
@NotBlank(message = "用户账号不能为空") |
|
146 |
@Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符") |
|
147 |
public String getUserName() |
|
148 |
{ |
|
149 |
return userName; |
|
150 |
} |
|
151 |
|
|
152 |
public void setUserName(String userName) |
|
153 |
{ |
|
154 |
this.userName = userName; |
|
155 |
} |
|
156 |
|
|
157 |
@Email(message = "邮箱格式不正确") |
|
158 |
@Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") |
|
159 |
public String getEmail() |
|
160 |
{ |
|
161 |
return email; |
|
162 |
} |
|
163 |
|
|
164 |
public void setEmail(String email) |
|
165 |
{ |
|
166 |
this.email = email; |
|
167 |
} |
|
168 |
|
|
169 |
@Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") |
|
170 |
public String getPhonenumber() |
|
171 |
{ |
|
172 |
return phonenumber; |
|
173 |
} |
|
174 |
|
|
175 |
public void setPhonenumber(String phonenumber) |
|
176 |
{ |
|
177 |
this.phonenumber = phonenumber; |
|
178 |
} |
|
179 |
|
|
180 |
public String getSex() |
|
181 |
{ |
|
182 |
return sex; |
|
183 |
} |
|
184 |
|
|
185 |
public void setSex(String sex) |
|
186 |
{ |
|
187 |
this.sex = sex; |
|
188 |
} |
|
189 |
|
|
190 |
public String getAvatar() |
|
191 |
{ |
|
192 |
return avatar; |
|
193 |
} |
|
194 |
|
|
195 |
public void setAvatar(String avatar) |
|
196 |
{ |
|
197 |
this.avatar = avatar; |
|
198 |
} |
|
199 |
|
|
200 |
public String getPassword() |
|
201 |
{ |
|
202 |
return password; |
|
203 |
} |
|
204 |
|
|
205 |
public void setPassword(String password) |
|
206 |
{ |
|
207 |
this.password = password; |
|
208 |
} |
|
209 |
|
|
210 |
public String getStatus() |
|
211 |
{ |
|
212 |
return status; |
|
213 |
} |
|
214 |
|
|
215 |
public void setStatus(String status) |
|
216 |
{ |
|
217 |
this.status = status; |
|
218 |
} |
|
219 |
|
|
220 |
public String getDelFlag() |
|
221 |
{ |
|
222 |
return delFlag; |
|
223 |
} |
|
224 |
|
|
225 |
public void setDelFlag(String delFlag) |
|
226 |
{ |
|
227 |
this.delFlag = delFlag; |
|
228 |
} |
|
229 |
|
|
230 |
public String getLoginIp() |
|
231 |
{ |
|
232 |
return loginIp; |
|
233 |
} |
|
234 |
|
|
235 |
public void setLoginIp(String loginIp) |
|
236 |
{ |
|
237 |
this.loginIp = loginIp; |
|
238 |
} |
|
239 |
|
|
240 |
public Date getLoginDate() |
|
241 |
{ |
|
242 |
return loginDate; |
|
243 |
} |
|
244 |
|
|
245 |
public void setLoginDate(Date loginDate) |
|
246 |
{ |
|
247 |
this.loginDate = loginDate; |
|
248 |
} |
|
249 |
|
|
250 |
public SysDept getDept() |
|
251 |
{ |
|
252 |
return dept; |
|
253 |
} |
|
254 |
|
|
255 |
public void setDept(SysDept dept) |
|
256 |
{ |
|
257 |
this.dept = dept; |
|
258 |
} |
|
259 |
|
|
260 |
public List<SysRole> getRoles() |
|
261 |
{ |
|
262 |
return roles; |
|
263 |
} |
|
264 |
|
|
265 |
public void setRoles(List<SysRole> roles) |
|
266 |
{ |
|
267 |
this.roles = roles; |
|
268 |
} |
|
269 |
|
|
270 |
public Long[] getRoleIds() |
|
271 |
{ |
|
272 |
return roleIds; |
|
273 |
} |
|
274 |
|
|
275 |
public void setRoleIds(Long[] roleIds) |
|
276 |
{ |
|
277 |
this.roleIds = roleIds; |
|
278 |
} |
|
279 |
|
|
280 |
public Long[] getPostIds() |
|
281 |
{ |
|
282 |
return postIds; |
|
283 |
} |
|
284 |
|
|
285 |
public void setPostIds(Long[] postIds) |
|
286 |
{ |
|
287 |
this.postIds = postIds; |
|
288 |
} |
|
289 |
|
|
290 |
public Long getRoleId() |
|
291 |
{ |
|
292 |
return roleId; |
|
293 |
} |
|
294 |
|
|
295 |
public void setRoleId(Long roleId) |
|
296 |
{ |
|
297 |
this.roleId = roleId; |
|
298 |
} |
|
299 |
|
|
300 |
@Override |
|
301 |
public String toString() { |
|
302 |
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|
303 |
.append("userId", getUserId()) |
|
304 |
.append("deptId", getDeptId()) |
|
305 |
.append("userName", getUserName()) |
|
306 |
.append("nickName", getNickName()) |
|
307 |
.append("email", getEmail()) |
|
308 |
.append("phonenumber", getPhonenumber()) |
|
309 |
.append("sex", getSex()) |
|
310 |
.append("avatar", getAvatar()) |
|
311 |
.append("password", getPassword()) |
|
312 |
.append("status", getStatus()) |
|
313 |
.append("delFlag", getDelFlag()) |
|
314 |
.append("loginIp", getLoginIp()) |
|
315 |
.append("loginDate", getLoginDate()) |
|
316 |
.append("createBy", getCreateBy()) |
|
317 |
.append("createTime", getCreateTime()) |
|
318 |
.append("updateBy", getUpdateBy()) |
|
319 |
.append("updateTime", getUpdateTime()) |
|
320 |
.append("remark", getRemark()) |
|
321 |
.append("dept", getDept()) |
|
322 |
.toString(); |
|
323 |
} |
|
324 |
} |