|
1
2
|
package com.huaheng.pc.system.user.domain;
|
|
3
4
5
6
|
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
|
|
7
8
9
|
import com.fasterxml.jackson.annotation.JsonFormat;
import com.huaheng.framework.aspectj.lang.annotation.Excel;
import com.huaheng.pc.system.dept.domain.Dept;
|
huhai
authored
|
10
11
12
13
14
15
16
|
import lombok.Data;
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
|
|
17
18
19
20
21
22
|
/**
* 用户对象 sys_user
*
* @author huaheng
*/
|
|
23
24
|
@Data
@TableName(value = "sys_user")
|
|
25
|
public class User implements Serializable
|
|
26
27
|
{
|
|
28
29
|
private static final long serialVersionUID = 3875676767702L;
|
|
30
31
|
/** 用户ID */
@Excel(name = "用户序号")
|
|
32
|
@TableId(value = "id", type = IdType.AUTO)
|
|
33
34
35
|
private Integer id;
/** 部门ID */
|
|
36
|
@TableField(value = "deptId")
|
|
37
38
39
|
private Integer deptId;
/** 部门父ID */
|
|
40
|
@TableField(value = "parentId")
|
|
41
42
43
44
|
private Integer parentId;
/** 登录名称 */
@Excel(name = "登录名称")
|
|
45
|
@TableField(value = "loginName")
|
|
46
47
48
49
|
private String loginName;
/** 用户名称 */
@Excel(name = "用户名称")
|
|
50
|
@TableField(value = "userName")
|
|
51
52
53
54
|
private String userName;
/** 用户邮箱 */
@Excel(name = "用户邮箱")
|
|
55
|
@TableField(value = "email")
|
|
56
57
58
59
|
private String email;
/** 手机号码 */
@Excel(name = "手机号码")
|
|
60
|
@TableField(value = "phoneNumber")
|
|
61
62
63
64
|
private String phoneNumber;
/** 用户性别 */
@Excel(name = "用户性别")
|
|
65
|
@TableField(value = "sex")
|
|
66
67
68
|
private String sex;
/** 用户头像 */
|
|
69
|
@TableField(value = "avatar")
|
|
70
71
72
|
private String avatar;
/** 密码 */
|
|
73
|
@TableField(value = "password")
|
|
74
75
76
|
private String password;
/** 盐加密 */
|
|
77
|
@TableField(value = "salt")
|
|
78
79
80
81
|
private String salt;
/** 启用状态 */
@Excel(name = "启用状态")
|
|
82
|
@TableField(value = "enable")
|
|
83
84
85
86
|
private Boolean enable;
/** 删除状态 */
@Excel(name = "删除状态")
|
|
87
|
@TableField(value = "deleted")
|
|
88
89
90
91
|
private Boolean deleted;
/** 最后登陆IP */
@Excel(name = "最后登陆IP")
|
|
92
|
@TableField(value = "loginIp")
|
|
93
94
95
96
|
private String loginIp;
/** 最后登陆时间 */
@Excel(name = "最后登陆时间")
|
|
97
|
@TableField(value = "loginDate")
|
|
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
private Date loginDate;
/** 部门对象 */
private Dept dept;
/** 仓库ID */
private Integer warehouseId;
/** 仓库编码 */
private String warehouseCode;
/** 角色列表 */
private List<Integer> roleIds;
/** 货主id列表 */
private List<Integer> companyIdList;
/** 货主编码列表 */
private List<String> companyCodeList;
|
|
118
119
120
|
/** 仓库编码列表 */
private List<String> warehouseCodeList;
|
|
121
122
123
124
|
/** 搜索值 */
private String searchValue;
/** 创建者 */
|
|
125
|
@TableField(value = "createBy")
|
|
126
127
128
129
|
private String createBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
130
|
@TableField(value = "createTime")
|
|
131
132
133
|
private Date createTime;
/** 更新者 */
|
|
134
|
@TableField(value = "updateBy")
|
|
135
136
137
138
|
private String updateBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
139
|
@TableField(value = "updateTime")
|
|
140
141
142
|
private Date updateTime;
/** 备注 */
|
|
143
|
@TableField(value = "remark")
|
|
144
145
|
private String remark;
|
|
146
147
148
149
|
/** 默认登录仓库 */
@TableField(value = "loginWarehouse")
private String loginWarehouse;
|
|
150
151
152
|
@TableField(exist = false)
private Boolean admin;
|
|
153
154
155
|
/** 请求参数 */
private Map<String, Object> params;
|
|
156
157
|
private List<Integer> supplierIds;
|
|
158
159
160
|
@TableField(exist = false)
private boolean findAllWarehouse;
|
|
161
162
163
164
165
166
167
168
169
170
171
|
/**
* 生成随机盐
*/
public void randomSalt()
{
// 一个Byte占两个字节,此处生成的3字节,字符串长度为6
SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator();
String hex = secureRandom.nextBytes(3).toHex();
setSalt(hex);
}
|
|
172
|
public boolean unAdmin()
|
|
173
|
{
|
|
174
|
return unAdmin(this.id);
|
|
175
176
|
}
|
|
177
|
public static boolean unAdmin(Integer id)
|
|
178
|
{
|
|
179
|
return id != null && 1L == id;
|
|
180
181
|
}
|
|
182
|
public static boolean unAdmin(String loginName)
|
|
183
|
{
|
|
184
|
return "superAdmin".equals(loginName);
|
|
185
186
187
188
189
190
191
192
193
194
195
196
197
|
}
@Override
public String toString()
{
return "User [id=" + id + ", deptId=" + deptId + ", parentId=" + parentId + ", loginName=" + loginName
+ ", userName=" + userName + ", email=" + email + ", phoneNumber=" + phoneNumber + ", sex=" + sex
+ ", avatar=" + avatar + ", password=" + password + ", salt=" + salt + ", enable=" + enable
+ ", deleted=" + deleted + ", loginIp=" + loginIp + ", loginDate=" + loginDate + ", dept=" + dept + "]";
// + ", roleIds=" + String.join(",", roleIds) + ", companyIds=" + Arrays.toString(companyIds.toArray()) + "]";
}
}
|