/**
* <p>
* Title:User.java
*/
package cn.surveystore.smk.entity;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Index;
import cn.surveystore.common.constant.Constant;
@Entity
//表明该类是一个与数据表对应的实体类
@Table(name = "user")
//要映射的数据库表名,要与哪个数据库表建立映射关系
public class User implements Serializable {
private static final long serialVersionUID = 3329289113562169434L;
private final static String tablefix = "u_";
@Id
//表名此字段在数据表中为主键
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid")
@Column(name = "id", columnDefinition = "varchar(32) comment '会员唯一标示'")
//实体类属性与数据表字段建立起联系,并说明字段类型和备注
private String id;
@Column(name = tablefix + "password")
private String password;
@Column(name = tablefix + "salt")
private String salt;
// @NotBlank(message = "邮箱不能为空")
// @Pattern(regexp =
// "\\w[-\\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\\.)+[A-Za-z]{2,14}", message =
// "邮箱格式不正确")
@Index(name = Constant.INDEXFIX + "EMAIL")
@Column(name = tablefix + "email", unique = true)
private String email;
@Index(name = Constant.INDEXFIX + "USERNAME")
@Column(name = tablefix + "user_name", unique = true)
private String userName;
// @NotBlank(message = "手机号码不能为空")
// @Pattern(regexp =
// "(13\\d|14[57]|15[^4,\\D]|17[678]|18\\d)\\d{8}|170[059]\\d{7}", message =
// "手机号码格式有误")
@Index(name = Constant.INDEXFIX + "PHONE")
@Column(name = tablefix + "phone", unique = true)
private String phone = "";
/**
* 激活状态
*/
@Column(name = tablefix
+ "active", columnDefinition = "tinyint(1) not null default '0' comment '账号激活状态{0:未激活1:手机号激活2:邮箱激活3:全部激活}'")
private Integer active = 0;
/**
* 激活字符串
*/
@Column(name = tablefix + "active_id", columnDefinition = "char(32) not null default '0' comment '账号激活字符串'")
private String activeId = "0";
@Column(name = tablefix + "province")
private String province = "";
@Column(name = tablefix + "city")
private String city = "";
@Column(name = tablefix + "district")
private String district = "";
@Column(name = tablefix + "gender")
private Integer gender = 1;
@Column(name = tablefix + "birthday")
private Date birthday;
@Column(name = tablefix + "real_name")
private String realName = "";
@Column(name = tablefix + "company")
private String company = "";
@Column(name = tablefix + "from")
private String from = "xyz";
@Column(name = tablefix + "fromid")
private String fromId = "0";
@Column(name = tablefix + "alipay_num")
private String alipayNum;
@Column(name = tablefix + "check_phone_num")
private Integer checkPhoneNum = 0;
@Column(name = tablefix + "status")
private Integer status = 1;
@Column(name = tablefix + "type")
private Integer type = 0;
@Column(name = tablefix
+ "publish", columnDefinition = "tinyint(1) not null default 0 comment '神秘客是否公开{0:公开,1:私有}'")
private Integer publish = 0;
@Column(name = tablefix + "create_time")
private Timestamp createTime;
@Column(name = tablefix + "head_picture_address", columnDefinition = "varchar(255) default '' comment '头像地址'")
private String headPictureAddress = "";
/**
* 账号密码(明码)
*/
@Column(name = tablefix + "password_plain", columnDefinition = "varchar(32) default '0' comment'账号密码(明码)'")
private String passwordPlain = "0";
@ManyToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
@JoinTable(name = Constant.TABLEFIX + "user_customer", joinColumns = {
@JoinColumn(name = "uc_uid") }, inverseJoinColumns = { @JoinColumn(name = "uc_cid") })
@ForeignKey(name = "null")
private Set<Customer> customerSet;
@ManyToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
@JoinTable(name = Constant.TABLEFIX + "user_role", joinColumns = {
@JoinColumn(name = "u_uid") }, inverseJoinColumns = { @JoinColumn(name = "r_rid") })
@ForeignKey(name = "null")
private Set<Role> roles;
@ManyToMany(cascade = { CascadeType.ALL }, fetch = FetchType.EAGER)
@JoinTable(name = Constant.TABLEFIX + "user_customer_level", joinColumns = {
@JoinColumn(name = "ucl_uid") }, inverseJoinColumns = { @JoinColumn(name = "ucl_clid") })
@ForeignKey(name = "null")
private Set<CustomerLevel> customerLevelSet;
@Transient
private String loginName;
/**
* 账号是否需要限制单点登录
*/
@Column(name = "is_sso", columnDefinition = "tinyint(3) not null default '0' comment '账号是否需要限制单点登录{0:不需要1:需要}'")
private Integer isSso = 0;
// 微信openid
@Column(name = tablefix + "wx_openid", columnDefinition = "char(50) comment '微信openid'")
private String wxOpenId;
/**
* 用户拓展信息
*/
@Transient
private UserInfo userInfo;
/**
* @return the id
*/
public String getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(String id) {
this.id = id;
}
/**
* @return the password
*/
public String getPassword() {
return password;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
/**
* @return the salt
*/
public String getSalt() {
return salt;
}
/**
* @param salt the salt to set
*/
public void setSalt(String salt) {
this.salt = salt;
}
/**
* @return the email
*/
public String getEmail() {
return email;
}
/**
* @param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* @return the phone
*/
public String getPhone() {
return phone;
}
/**
* @param phone the phone to set
*/
public void setPhone(String phone) {
this.phone = phone;
}
/**
* @return the active
*/
public Integer getActive() {
return active;
}
/**
* @param active the active to set
*/
public void setActive(Integer active) {
this.active = active;
}
/**
* @return the activeId
*/
public String getActiveId() {
return activeId;
}
/**
* @param activeId the activeId to set
*/
public void setActiveId(String activeId) {
this.activeId = activeId;
}
/**
* @return the province
*/
public String getProvince() {
return province;
}
/**
* @param province the province to set
*/
public void setProvince(String province) {
this.province = province;
}
/**
* @return the city
*/
public String getCity() {
return city;
}
/**
* @param city the city to set
*/
public void setCity(String city) {
this.city = city;
}
/**
* @return the district
*/
public String getDistrict() {
return district;
}
/**
* @param district the district to set
*/
public void setDistrict(String district) {
this.district = district;
}
/**
* @return the gender
*/
public Integer getGender() {
return gender;
}
/**
* @param gender the gender to set
*/
public void setGender(Integer gender) {
this.gender = gender;
}
/**
* @return the birthday
*/
public Date getBirthday() {
return birthday;
}
/**
* @param birthday the birthday to set
*/
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
/**
* @return the realName
*/
public String getRealName() {
return realName;
}
/**
* @param realName the realName to set
*/
public void setRealName(String realName) {
this.realName = realName;
}
/**
* @return the company
*/
public String getCompany() {
return company;
}
/**
* @param company the company to set
*/
public void setCompany(String company) {
this.company = company;
}
/**
* @return the from
*/
public String getFrom() {
return from;
}
/**
* @param from the from to set
*/
public void setFrom(String from) {
this.from = from;
}
/**
* @return the fromId
*/
public String getFromId() {
return fromId;
}
/**
* @param fromId the fromId to set
*/
public void setFromId(String fromId) {
this.fromId = fromId;
}
/**
* @return the alipayNum
*/
public String getAlipayNum() {
return alipayNum;
}
/**
* @param alipayNum the alipayNum to set
*/
public void setAlipayNum(String alipayNum) {
this.alipayNum = alipayNum;
}
/**
* @return the chackPhoneNum
*/
public Integer getCheckPhoneNum() {
return checkPhoneNum;
}
/**
* @param chackPhoneNum the chackPhoneNum to set
*/
public void setCheckPhoneNum(Integer checkPhoneNum) {
this.checkPhoneNum = checkPhoneNum;
}
/**
* @return the status
*/
public Integer getStatus() {
return status;
}
/**
* @param status the status to set
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* @return the type
*/
public Integer getType() {
return type;
}
/**
* @param type the type to set
*/
public void setType(Integer type) {
this.type = type;
}
/**
* @return the publish
*/
public Integer getPublish() {
return publish;
}
/**
* @param publish the publish to set
*/
public void setPublish(Integer publish) {
this.publish = publish;
}
/**
* @return the createTime
*/
public Timestamp getCreateTime() {
return createTime;
}
/**
* @param createTime the createTime to set
*/
public void setCreateTime(Timestamp createTime) {
this.createTime = createTime;
}
/**
* @return the customerSet
*/
public Set<Customer> getCustomerSet() {
return customerSet;
}
/**
* @param customerSet the customerSet to set
*/
public void setCustomerSet(Set<Customer> customerSet) {
this.customerSet = customerSet;
}
/**
* @return the roles
*/
public Set<Role> getRoles() {
return roles;
}
/**
* @param roles the roles to set
*/
public void setRoles(Set<Role> roles) {
this.roles = roles;
}
/**
* @return the customerLevelSet
*/
public Set<CustomerLevel> getCustomerLevelSet() {
return customerLevelSet;
}
/**
* @param customerLevelSet the customerLevelSet to set
*/
public void setCustomerLevelSet(Set<CustomerLevel> customerLevelSet) {
this.customerLevelSet = customerLevelSet;
}
/**
* @return the loginName
*/
public String getLoginName() {
return loginName;
}
/**
* @param loginName the loginName to set
*/
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getPasswordPlain() {
return passwordPlain;
}
public void setPasswordPlain(String passwordPlain) {
this.passwordPlain = passwordPlain;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
/**
* @return the headPictureAddress
*/
public String getHeadPictureAddress() {
return headPictureAddress;
}
/**
* @param headPictureAddress the headPictureAddress to set
*/
public void setHeadPictureAddress(String headPictureAddress) {
this.headPictureAddress = headPictureAddress;
}
public Integer getIsSso() {
return isSso;
}
public void setIsSso(Integer isSso) {
this.isSso = isSso;
}
/**
* @return the userInfo
*/
public UserInfo getUserInfo() {
return userInfo;
}
/**
* @param userInfo the userInfo to set
*/
public void setUserInfo(UserInfo userInfo) {
this.userInfo = userInfo;
}
/**
* @return the wxOpenId
*/
public String getWxOpenId() {
return wxOpenId;
}
/**
* @param wxOpenId the wxOpenId to set
*/
public void setWxOpenId(String wxOpenId) {
this.wxOpenId = wxOpenId;
}
public User(String id, String password, String salt, String email, String userName, String phone, Integer active,
String activeId, String province, String city, String district, Integer gender, Date birthday,
String realName, String company, String from, String fromId, String alipayNum, Integer checkPhoneNum,
Integer status, Integer type, Integer publish, Timestamp createTime, String passwordPlain,
Set<Customer> customerSet, Set<Role> roles, Set<CustomerLevel> customerLevelSet, String loginName,
String headPictureAddress, Integer isSso, UserInfo userInfo, String wxOpenId) {
super();
this.id = id;
this.password = password;
this.salt = salt;
this.email = email;
this.userName = userName;
this.phone = phone;
this.active = active;
this.activeId = activeId;
this.province = province;
this.city = city;
this.district = district;
this.gender = gender;
this.birthday = birthday;
this.realName = realName;
this.company = company;
this.from = from;
this.fromId = fromId;
this.alipayNum = alipayNum;
this.checkPhoneNum = checkPhoneNum;
this.status = status;
this.type = type;
this.publish = publish;
this.createTime = createTime;
this.passwordPlain = passwordPlain;
this.customerSet = customerSet;
this.roles = roles;
this.customerLevelSet = customerLevelSet;
this.loginName = loginName;
this.headPictureAddress = headPictureAddress;
this.isSso = isSso;
this.userInfo = userInfo;
this.wxOpenId = wxOpenId;
}
public User() {
super();
}
}
还没有评论,来说两句吧...