package com.xunmei.system.api.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xunmei.common.core.web.domain.BaseEntity;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 *机构人员信息
 */
@TableName(value = "sys_user")
public class User extends BaseEntity{
    private static final long serialVersionUID = 1L;

    /** 用户ID */
    @TableId
    private Long id;

    /** 机构ID */
    private Long orgId;

    /** 用户账号 */
    private String username;

    /** 姓名 */
    private String name;

    /** 身份证 */
    private String card;

    /** 手机号码 */
    private String phone;

    /** 用户性别 */
    private Integer gender;

    /** 用户头像 */
    private String image;

    /** 密码 */
    private String password;

    /** 盐值 */
    private String salt;

    /** 帐号状态（0正常 1停用） */
    private Integer isLock;

    /** 删除标志（0代表存在 2代表删除） */
    private Integer deleted;

    /** 最后登录IP */
    private String lastIp;

    /** 最后登录时间 */
    private Date lastTime;

    /** 机构对象 */
    @TableField(exist = false)
    private Org org;

    @TableField(exist = false)
    private Long[] roleIds;

    @TableField(exist = false)
    private List<Role> roles;


    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public List<Role> getRoles() {
        return roles;
    }

    public void setRoles(List<Role> roles) {
        this.roles = roles;
    }

    public Long[] getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(Long[] roleIds) {
        this.roleIds = roleIds;
    }

    public boolean isAdmin()
    {
        return isAdmin(this.getId());
    }

    public static boolean isAdmin(Long userId)
    {
        return userId != null && 1L == userId;
    }

    public Long getOrgId() {
        return orgId;
    }

    public void setOrgId(Long orgId) {
        this.orgId = orgId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCard() {
        return card;
    }

    public void setCard(String card) {
        this.card = card;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public Integer getIsLock() {
        return isLock;
    }

    public void setIsLock(Integer isLock) {
        this.isLock = isLock;
    }

    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }

    public String getLastIp() {
        return lastIp;
    }

    public void setLastIp(String lastIp) {
        this.lastIp = lastIp;
    }

    public Date getLastTime() {
        return lastTime;
    }

    public void setLastTime(Date lastTime) {
        this.lastTime = lastTime;
    }

    public Org getOrg() {
        return org;
    }

    public void setOrg(Org org) {
        this.org = org;
    }
}
