package com.qxueyou.scc.msg.model;
|
|
import java.io.Serializable;
|
import java.sql.Timestamp;
|
import java.util.Date;
|
import java.util.List;
|
|
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.NamedQuery;
|
import javax.persistence.Table;
|
|
import org.hibernate.annotations.CollectionId;
|
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.Type;
|
|
import com.qxueyou.scc.base.util.UUIDUtils;
|
import com.qxueyou.scc.notice.model.Notice;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
/**
|
* 消息用户表 实体
|
* @author ody.yuan
|
*
|
*/
|
@Entity
|
@Table(name="msg_user")
|
@NamedQuery(name="MsgUser.findAll", query="SELECT m FROM MsgUser m")
|
public class MsgUser implements Serializable , com.qxueyou.scc.base.model.ITrace{
|
private static final long serialVersionUID = 1L;
|
|
/** 主键 */
|
@Id
|
@Column(name="USER_ID", unique=true, nullable=false, length=32)
|
private String userId;
|
|
/** 账号 */
|
@Column(name="ACCOUNT",length=64)
|
private String account;
|
|
/** 年龄 */
|
@Column(name="AGE")
|
private int age;
|
|
/** 昵称 */
|
@Column(name="ALIAS",length=64)
|
private String alias;
|
|
/** 生日,暂时默认数据生成时间 */
|
@Column(name="BIRTHDAY")
|
private Date birthday;
|
|
/** 创建人ID */
|
@Column(name="CREATE_ID", nullable=false, length=32)
|
private String createId;
|
|
/** 创建时间 */
|
@Column(name="CREATE_TIME", nullable=false)
|
private Date createTime;
|
|
/** 创建人 */
|
@Column(name="CREATOR", nullable=false, length=100)
|
private String creator;
|
|
/** 删除标志 */
|
@Column(name="DELETE_FLAG", nullable=false)
|
private boolean deleteFlag;
|
|
/** 密码 */
|
@Column(name="PASSWORD", length=2048)
|
private String password;
|
|
/** 头像 */
|
@Column(name="PORTRAIT", length=512)
|
private String portrait;
|
|
/** 用户名 */
|
@Column(name="REAL_NAME", length=32)
|
private String realName;
|
|
/** 性别 */
|
@Column(name="SEX")
|
private boolean sex;
|
|
/** 修改人ID */
|
@Column(name="UPDATE_ID", length=32)
|
private String updateId;
|
|
/** 修改时间 */
|
@Column(name="UPDATE_TIME", nullable=false)
|
private Date updateTime;
|
|
/** 修改人 */
|
@Column(name="UPDATOR", length=100)
|
private String updator;
|
|
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
|
@JoinTable(name = "MSG_FRIEND", joinColumns = {
|
@JoinColumn(name = "USER_ID_FROM") },
|
inverseJoinColumns = { @JoinColumn(name = "USER_ID_TO") })
|
@GeneratedValue(generator = "hibernate-uuid")
|
@GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
|
@CollectionId(
|
columns = @Column(name="FRIEND_ID"),
|
type=@Type(type="string"),
|
generator = "hibernate-uuid"
|
)
|
@JsonIgnore
|
private List<MsgUser> friends;
|
|
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "friends")
|
@JsonIgnore
|
private List<MsgUser> friendsOf;
|
|
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "users")
|
@JsonIgnore
|
private List<MsgGroup> groups;
|
|
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "admins")
|
@JsonIgnore
|
private List<MsgGroup> adminGroups;
|
|
public String getAliasInitial(){
|
if(Notice.NOTICE_ORG_MSG_USER_ID.equals(userId)){//学校通知
|
return "#0";
|
}else if(Notice.NOTICE_CLASS_MSG_USER_ID.equals(userId)){//班级通知
|
return "#1";
|
}else if(Notice.NOTICE_SYS_MSG.equals(userId)){//系统通知
|
return "#2";
|
}else if("qxueyou_assistant".equals(userId)){//智能客服
|
return "#3";
|
}
|
|
return alias!=null?UUIDUtils.generateShortUuid():"";
|
}
|
|
public List<MsgGroup> getGroups() {
|
return groups;
|
}
|
|
public void setGroups(List<MsgGroup> groups) {
|
this.groups = groups;
|
}
|
|
public List<MsgUser> getFriends() {
|
return friends;
|
}
|
|
public void setFriends(List<MsgUser> friends) {
|
this.friends = friends;
|
}
|
|
public List<MsgUser> getFriendsOf() {
|
return friendsOf;
|
}
|
|
public void setFriendsOf(List<MsgUser> friendsOf) {
|
this.friendsOf = friendsOf;
|
}
|
|
public void setBirthday(Date birthday) {
|
this.birthday = birthday;
|
}
|
|
public void setCreateTime(Date createTime) {
|
this.createTime = createTime;
|
}
|
|
public MsgUser() {
|
}
|
|
public String getUserId() {
|
return this.userId;
|
}
|
|
public void setUserId(String userId) {
|
this.userId = userId;
|
}
|
|
public String getAccount() {
|
return this.account;
|
}
|
|
public void setAccount(String account) {
|
this.account = account;
|
}
|
|
public int getAge() {
|
return this.age;
|
}
|
|
public void setAge(int age) {
|
this.age = age;
|
}
|
|
public String getAlias() {
|
return this.alias;
|
}
|
|
public void setAlias(String alias) {
|
this.alias = alias;
|
}
|
|
public Date getBirthday() {
|
return this.birthday;
|
}
|
|
public String getCreateId() {
|
return this.createId;
|
}
|
|
public void setCreateId(String createId) {
|
this.createId = createId;
|
}
|
|
public Date getCreateTime() {
|
return this.createTime;
|
}
|
|
public void setCreateTime(Timestamp createTime) {
|
this.createTime = createTime;
|
}
|
|
public String getCreator() {
|
return this.creator;
|
}
|
|
public void setCreator(String creator) {
|
this.creator = creator;
|
}
|
|
public boolean getDeleteFlag() {
|
return this.deleteFlag;
|
}
|
|
public String getPassword() {
|
return this.password;
|
}
|
|
public void setPassword(String password) {
|
this.password = password;
|
}
|
|
public String getPortrait() {
|
return this.portrait;
|
}
|
|
public void setPortrait(String portrait) {
|
this.portrait = portrait;
|
}
|
|
public String getRealName() {
|
return this.realName;
|
}
|
|
public void setRealName(String realName) {
|
this.realName = realName;
|
}
|
|
public boolean getSex() {
|
return sex;
|
}
|
|
public void setSex(boolean sex) {
|
this.sex = sex;
|
}
|
|
public String getUpdateId() {
|
return this.updateId;
|
}
|
|
public void setUpdateId(String updateId) {
|
this.updateId = updateId;
|
}
|
|
public Date getUpdateTime() {
|
return this.updateTime;
|
}
|
|
public void setUpdateTime(Date updateTime) {
|
this.updateTime = updateTime;
|
}
|
|
public String getUpdator() {
|
return this.updator;
|
}
|
|
public void setUpdator(String updator) {
|
this.updator = updator;
|
}
|
|
public void setDeleteFlag(boolean deleteFlag) {
|
this.deleteFlag=deleteFlag;
|
}
|
|
public String getImgUrl() {
|
return this.portrait;
|
}
|
|
public void setImgImgUrl(String imgPath) {
|
this.portrait = imgPath;
|
}
|
|
}
|