All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.haoxuer.discover.user.data.entity.AbstractUser Maven / Gradle / Ivy

There is a newer version: 2.2.2
Show newest version
package com.haoxuer.discover.user.data.entity;

import com.haoxuer.discover.data.entity.AbstractEntity;
import com.haoxuer.discover.data.enums.State;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.MapKeyColumn;
import javax.persistence.MappedSuperclass;

/**
 * Created by ada on 2017/7/21.
 */

@MappedSuperclass
public abstract class AbstractUser extends AbstractEntity {
  
  
  /**
   * 属性
   */
  @ElementCollection(fetch = FetchType.LAZY)
  @CollectionTable(name = "user_info_attribute", joinColumns = {@JoinColumn(name = "user_id")})
  @MapKeyColumn(name = "name", length = 36)
  @Column(name = "attr", length = 100)
  private Map attributes = new HashMap();
  
  /**
   * 用户头像
   */
  private String avatar;
  
  /**
   * 用户类型
   */
  private Integer catalog;
  
  
  /**
   * 手机号码
   */
  @Column(length = 15)
  private String phone;
  
  /**
   * 用户登录次数
   */
  private Integer loginSize = 0;
  
  /**
   * 用户真实姓名
   */
  @Column(length = 20)
  private String name;
  
  


  
  
  /**
   * 用户状态
   */
  @Enumerated()
  private State state;
  
  @ManyToMany(fetch = FetchType.LAZY)
  @JoinTable(name = "user_label_links", joinColumns = {@JoinColumn(name = "user_id")})
  private Set labels = new HashSet();
  
  public Map getAttributes() {
    return attributes;
  }
  
  public String getAvatar() {
    return avatar;
  }
  
  public Integer getCatalog() {
    if (catalog == null) {
      return 0;
    }
    return catalog;
  }
  
  public String getName() {
    return name;
  }
  
  


  
  public void setAttributes(Map attributes) {
    this.attributes = attributes;
  }
  
  public Integer getLoginSize() {
    return loginSize;
  }
  
  public void setLoginSize(Integer loginSize) {
    this.loginSize = loginSize;
  }
  
  public void setAvatar(String avatar) {
    this.avatar = avatar;
  }
  
  public void setCatalog(Integer catalog) {
    this.catalog = catalog;
  }
  
  public void setName(String name) {
    this.name = name;
  }
  

  public State getState() {
    return state;
  }
  
  public void setState(State state) {
    this.state = state;
  }
  
  public String getPhone() {
    return phone;
  }
  
  public void setPhone(String phone) {
    this.phone = phone;
  }
  
  public Set getLabels() {
    return labels;
  }
  
  public void setLabels(Set labels) {
    this.labels = labels;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy