package com.ruoyi.common.core.domain.entity;

import java.util.Date;
import java.util.List;
import javax.validation.constraints.*;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excel.ColumnType;
import com.ruoyi.common.annotation.Excel.Type;
import com.ruoyi.common.annotation.Excels;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.xss.Xss;

/**
 * 用户对象 sys_user
 * 
 * @author ruoyi
 */
public class SysUser extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 用户ID */
    @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
    private Long userId;

    /** 部门ID */
    @Excel(name = "部门编号", type = Type.IMPORT)
    private Long deptId;

    /** 用户账号 */
//    @Excel(name = "登录名称")
    private String userName;

    /** 用户昵称 */
    @Excel(name = "用户名称")
    private String nickName;

    /** 用户拼音 */
    private String pinyin;

    /** 用户邮箱 */
//    @Excel(name = "用户邮箱")
    private String email;

    /** 手机号码 */
    @Excel(name = "手机号码")
    private String phonenumber;

    /** 用户性别 */
    @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
    private String sex;

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

    /** 密码 */
    private String password;

    /** 帐号状态（0正常 1停用） */
    @Excel(name = "帐号状态", readConverterExp = "0=在职,1=离职,2=退休,3=试用,4=返聘")
    private String status;

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

    /** 最后登录IP */
//    @Excel(name = "最后登录IP", type = Type.EXPORT)
    private String loginIp;

    /** 最后登录时间 */
//    @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Type.EXPORT)
    private Date loginDate;

    @Excel(name = "岗位")
    private String postNames;

    /** 项目经理级别 */
    @Excel(name = "项目经理级别", readConverterExp = "0=一级,1=二级,2=三级")
    private String pmLevel;

    /** 工程师岗级 */
    @Excel(name = "工程师岗级", readConverterExp = "0=一级,1=二级,2=三级,3=四级,4=五级,5=六级")
    private String engineerLevel;

    /** 技工等级 */
    @Excel(name = "技工等级", readConverterExp = "0=一级,1=二级,2=三级")
    private String operatorLevel;

    /** 岗级 */
    @Excel(name = "岗级", readConverterExp = "0=一岗,1=二岗,2=三岗,3=四岗,4=五岗,5=六岗,6=七岗,7=八岗")
    private String postLevel;

    /** 薪档 */
    @Excel(name = "薪档", readConverterExp = "0=一档,1=二档,2=三档,3=四档,4=五档,5=六档,6=七档,7=八档")
    private String salaryLevel;

    /** 技术职称 */
    @Excel(name = "技术职称", readConverterExp = "0=正高级工程师,1=高级工程师,2=中级工程师,3=助理工程师,4=高级会计师,5=会计师,6=助理会计师,7=高级经济师,8=经济师,9=助理经济师,10=工人高级工,11=工人中级工,12=工人初级工,13=无职称")
    private String titles;

    /** 职称专业 */
    @Excel(name = "职称专业")
    private String titleProfession;

    /** 职业资格 */
    @Excel(name = "职业资格", readConverterExp = "0=注册测绘师,1=注册城乡规划师,2=注册岩土工程师,3=注册安全工程师,4=注册会计师")
    private String certificates;

    /** 更新原因 */
    @Excel(name = "更新原因", readConverterExp = "0=误录修改,1=正常调整）")
    private String updateReason;

    /** 入职时间 */
    @Excel(name = "入职时间", width = 30, dateFormat = "yyyy-MM-dd", type = Type.EXPORT)
    private Date entryDate;

    /** 出生时间 */
    @Excel(name = "出生时间", width = 30, dateFormat = "yyyy-MM-dd", type = Type.EXPORT)
    private Date birthday;

    /** 年龄 */
    @Excel(name = "年龄")
    private Integer age;

    /** 身份证号码 */
    @Excel(name = "身份证号码")
    private String idCard;

    /** 籍贯 */
    @Excel(name = "籍贯")
    private String nativePlace;

    /** 政治面貌 */
    @Excel(name = "政治面貌", readConverterExp = "0=党总支书记,1=党总支干事,2=党总支委员,3=第一党支部书记,4=第二党支部书记,5=第一党支部组织委员,6=第二党支部组织委员,7=第一党支部宣传委员,8=第二党支部宣传委员,9=第一党支部党员,10=第二党支部党员,11=预备党员,12=共青团员,13=群众")
    private String politicalAffiliation;

    /** 民族 */
    @Excel(name = "民族")
    private String ethnic;

    /** 最高学历院校 */
    @Excel(name = "最高学历院校")
    private String graduateSchool;

    /** 最高学历专业 */
    @Excel(name = "最高学历专业")
    private String major;

    /** 最高学历 */
    @Excel(name = "最高学历", readConverterExp = "0=博士,1=硕士,2=本科,3=专科,4=高中,5=中专,6=初中")
    private String degree;

    /** 初始学历院校 */
    @Excel(name = "初始学历院校")
    private String initialSchool;

    /** 初始学历专业 */
    @Excel(name = "初始学历专业")
    private String initialMajor;

    /** 初始学历 */
    @Excel(name = "初始学历", readConverterExp = "0=博士,1=硕士,2=本科,3=专科,4=高中,5=中专,6=初中")
    private String initialDegree;

    /** 合同签订 */
    @Excel(name = "合同签订", width = 30, dateFormat = "yyyy-MM-dd")
    private Date contractSign;

    /** 合同期满 */
    @Excel(name = "合同期满", width = 30, dateFormat = "yyyy-MM-dd")
    private Date contractExpire;

    /** 家庭住址 */
    @Excel(name = "家庭住址")
    private String homePlace;

    /** 紧急联系人 */
    @Excel(name = "紧急联系人")
    private String contact;

    /** 紧急联系电话 */
    @Excel(name = "紧急联系电话")
    private String telephone;

    /** 部门对象 */
    @Excels({
        @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
//        @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
    })
    private SysDept dept;

    @Excel(name = "备注")
    private String remark;

    private CmcPostSalary salary;

    /** 角色对象 */
    private List<SysRole> roles;

    /** 角色组 */
    private Long[] roleIds;

    /** 岗位组 */
    private Long[] postIds;

    /** 角色ID */
    private Long roleId;

    public SysUser()
    {

    }

    public SysUser(Long userId)
    {
        this.userId = userId;
    }

    public Long getUserId()
    {
        return userId;
    }

    public void setUserId(Long userId)
    {
        this.userId = userId;
    }

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

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

    public Long getDeptId()
    {
        return deptId;
    }

    public void setDeptId(Long deptId)
    {
        this.deptId = deptId;
    }

    @Xss(message = "用户昵称不能包含脚本字符")
    @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
    public String getNickName()
    {
        return nickName;
    }

    public void setNickName(String nickName)
    {
        this.nickName = nickName;
    }

    public String getPinyin()
    {
        return pinyin;
    }

    public void setPinyin(String pinyin)
    {
        this.pinyin = pinyin;
    }

    @Xss(message = "用户账号不能包含脚本字符")
    @NotBlank(message = "用户账号不能为空")
    @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
    public String getUserName()
    {
        return userName;
    }

    public void setUserName(String userName)
    {
        this.userName = userName;
    }

    @Email(message = "邮箱格式不正确")
    @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
    public String getEmail()
    {
        return email;
    }

    public void setEmail(String email)
    {
        this.email = email;
    }

    @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
    public String getPhonenumber()
    {
        return phonenumber;
    }

    public void setPhonenumber(String phonenumber)
    {
        this.phonenumber = phonenumber;
    }

    public String getSex()
    {
        return sex;
    }

    public void setSex(String sex)
    {
        this.sex = sex;
    }

    public String getAvatar()
    {
        return avatar;
    }

    public void setAvatar(String avatar)
    {
        this.avatar = avatar;
    }

    public String getPassword()
    {
        return password;
    }

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

    public String getStatus()
    {
        return status;
    }

    public void setStatus(String status)
    {
        this.status = status;
    }

    public String getDelFlag()
    {
        return delFlag;
    }

    public void setDelFlag(String delFlag)
    {
        this.delFlag = delFlag;
    }

    public String getLoginIp()
    {
        return loginIp;
    }

    public void setLoginIp(String loginIp)
    {
        this.loginIp = loginIp;
    }

    public Date getLoginDate()
    {
        return loginDate;
    }

    public void setLoginDate(Date loginDate)
    {
        this.loginDate = loginDate;
    }

    public String getPmLevel()
    {
        return pmLevel;
    }

    public void setPmLevel(String pmLevel)
    {
        this.pmLevel = pmLevel;
    }

    public String getEngineerLevel()
    {
        return engineerLevel;
    }

    public void setEngineerLevel(String engineerLevel)
    {
        this.engineerLevel = engineerLevel;
    }
    public String getPostLevel()
    {
        return postLevel;
    }

    public void setPostLevel(String postLevel)
    {
        this.postLevel = postLevel;
    }
    public String getSalaryLevel()
    {
        return salaryLevel;
    }

    public void setSalaryLevel(String salaryLevel)
    {
        this.salaryLevel = salaryLevel;
    }

    public void setOperatorLevel(String operatorLevel)
    {
        this.operatorLevel = operatorLevel;
    }

    public String getOperatorLevel()
    {
        return operatorLevel;
    }

    public String getTitles()
    {
        return titles;
    }

    public void setTitles(String titles)
    {
        this.titles = titles;
    }

    public String getCertificates()
    {
        return certificates;
    }

    public void setCertificates(String certificates)
    {
        this.certificates = certificates;
    }

    public String getUpdateReason()
    {
        return updateReason;
    }

    public void setUpdateReason(String updateReason)
    {
        this.updateReason = updateReason;
    }

    public Date getEntryDate()
    {
        return entryDate;
    }

    public void setEntryDate(Date entryDate)
    {
        this.entryDate = entryDate;
    }

    public Date getBirthday()
    {
        return birthday;
    }

    public void setBirthday(Date birthday)
    {
        this.birthday = birthday;
    }

    public Integer getAge()
    {
        return age;
    }

    public void setAge(Integer age) { this.age = age; }

    public SysDept getDept()
    {
        return dept;
    }

    public void setDept(SysDept dept)
    {
        this.dept = dept;
    }

    public CmcPostSalary getSalary()
    {
        return salary;
    }

    public void setSalary(CmcPostSalary salary)
    {
        this.salary = salary;
    }

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

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

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

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

    public Long[] getPostIds()
    {
        return postIds;
    }

    public void setPostIds(Long[] postIds)
    {
        this.postIds = postIds;
    }

    public Long getRoleId()
    {
        return roleId;
    }

    public void setRoleId(Long roleId)
    {
        this.roleId = roleId;
    }

    public void setIdCard(String idCard)
    {
        this.idCard = idCard;
    }

    public String getIdCard()
    {
        return idCard;
    }
    public void setNativePlace(String nativePlace)
    {
        this.nativePlace = nativePlace;
    }

    public String getNativePlace()
    {
        return nativePlace;
    }
    public void setPoliticalAffiliation(String politicalAffiliation)
    {
        this.politicalAffiliation = politicalAffiliation;
    }

    public String getPoliticalAffiliation()
    {
        return politicalAffiliation;
    }
    public void setEthnic(String ethnic)
    {
        this.ethnic = ethnic;
    }

    public String getEthnic()
    {
        return ethnic;
    }
    public void setGraduateSchool(String graduateSchool)
    {
        this.graduateSchool = graduateSchool;
    }

    public String getGraduateSchool()
    {
        return graduateSchool;
    }
    public void setMajor(String major)
    {
        this.major = major;
    }

    public String getMajor()
    {
        return major;
    }
    public void setDegree(String degree)
    {
        this.degree = degree;
    }

    public String getDegree()
    {
        return degree;
    }
    public void setContractSign(Date contractSign)
    {
        this.contractSign = contractSign;
    }

    public Date getContractSign()
    {
        return contractSign;
    }
    public void setContractExpire(Date contractExpire)
    {
        this.contractExpire = contractExpire;
    }

    public Date getContractExpire()
    {
        return contractExpire;
    }
    public void setHomePlace(String homePlace)
    {
        this.homePlace = homePlace;
    }

    public String getHomePlace()
    {
        return homePlace;
    }
    public void setPostNames(String postNames)
    {
        this.postNames = postNames;
    }

    public String getPostNames()
    {
        return postNames;
    }
    public void setInitialDegree(String initialDegree)
    {
        this.initialDegree = initialDegree;
    }

    public String getInitialDegree()
    {
        return initialDegree;
    }
    public void setInitialMajor(String initialMajor)
    {
        this.initialMajor = initialMajor;
    }

    public String getInitialMajor()
    {
        return initialMajor;
    }
    public void setInitialSchool(String initialSchool)
    {
        this.initialSchool = initialSchool;
    }

    public String getInitialSchool()
    {
        return initialSchool;
    }
    public void setTitleProfession(String titleProfession)
    {
        this.titleProfession = titleProfession;
    }

    public String getTitleProfession()
    {
        return titleProfession;
    }
    public void setContact(String contact)
    {
        this.contact = contact;
    }

    public String getContact()
    {
        return contact;
    }
    public void setTelephone(String telephone)
    {
        this.telephone = telephone;
    }

    public String getTelephone()
    {
        return telephone;
    }
    public String getRemark()
    {
        return remark;
    }

    public void setRemark(String remark)
    {
        this.remark = remark;
    }


    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("userId", getUserId())
            .append("deptId", getDeptId())
            .append("userName", getUserName())
            .append("nickName", getNickName())
            .append("email", getEmail())
            .append("phonenumber", getPhonenumber())
            .append("sex", getSex())
            .append("avatar", getAvatar())
            .append("password", getPassword())
            .append("status", getStatus())
            .append("delFlag", getDelFlag())
            .append("loginIp", getLoginIp())
            .append("loginDate", getLoginDate())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("remark", getRemark())
            .append("dept", getDept())
            .toString();
    }
}
