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

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
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;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

/**
 * 用户对象 sys_user
 *
 * @author ruoyi
 */
@Data
@TableName(value = "sys_user")
@Accessors(chain = true)
public class SysUser extends BaseEntity {
    private static final long serialVersionUID = 1L;

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

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

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

    @Excel(name = "用户名称")
    @Xss(message = "用户昵称不能包含脚本字符")
    @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符")
    private String nickName;

    @Excel(name = "用户邮箱")
    @Email(message = "邮箱格式不正确")
    @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符")
    private String email;

    @Excel(name = "手机号码")
    @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
    private String phonenumber;

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

    private String avatar;

    private String introduce;

    private String brief;

    private String password;

    private Integer shows;

    private Integer views;

    @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
    private String status;

    private String delFlag;

    @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;

    @Excels({
            @Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
            @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
    })
    @TableField(exist = false)
    private SysDept dept;
    /**
     * 角色对象
     */
    @TableField(exist = false)
    private List<SysRole> roles;

    /**
     * 角色组
     */
    @TableField(exist = false)
    private Long[] roleIds;

    /**
     * 岗位组
     */
    @TableField(exist = false)
    private Long[] postIds;

    /**
     * 角色ID
     */
    @TableField(exist = false)
    private Long roleId;

    @TableField(exist = false)
    private String rolesGroup;

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

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

    private String orgCode;
    private String employeeId;
    private String employeeName;
    private String py;
    private String wb;
    private String inputCode;
    private Integer genderCode;
    private String genderName;
    private String birthDate;
    private Integer maritalStatusCode;
    private Integer idTypeCode;
    private String idNo;
    private String deptCode;
    private String deptName;
    private String adminDeptCode;
    private String adminDeptName;
    private String wardCode;
    private String wardName;
    private Integer employeeTypeCode;
    private Integer techPositionCode;
    private String techPositionName;
    private String telephone;
    private String supDoctorCode;
    private String supDoctorName;
    private String medDocCode;
    private String dirDocSign;
    private String presRightSign;
    private String anesPresRightSign;
    private String specRegFee;
    private Integer limitNumber;
    private String presChapterNo;
    private String memo;
    private Integer amLimitNo;
    private Integer pmLimitNo;
    private String modifiedPresSign;
    private String elecPresRight;
    private String noonLimitNo;
    private String emergencyRegFee;
    private String emergencyMedFee;
    private String emergencyTreatFee;
    private Long degreeCode;
    private String photoUrl;
    private String signatureGraph;
    private String validStartDTime;
    private String validEndDTime;
    private String activeSign;
    private String verNo;
    private String employeePassword;
    private String bmjb;
    private String gwdm;
    private String gwmc;
    private String ghf;
    private String zlf;
    private String wzzxbz;
    private String ysjb;
    private String ismsg;
    private String sszcId;
    private String sszcMc;
    private String czry;
    private String zxysdm;
    private String mzTfbz;
    private String ssfl;
    private String zxksdm;
    private String ipaddress;
    private String sfyy;
    private String yxj;
    private String iszkhs;
    private String zzghbz;
    private String sfxh;
    private String txbz;
    private String ksscfq;
    private String zyzz;
    private String sjdpbbz;
    private String mxpbbz;
    private String fzhxqz;
    private String lsgbz;
    private String kzlywcfq;
    private String cwyyywcfq;
    private String sqxtypbz;
    private String zkxtypbz;
    private String ssyzqx;
    private String zgkh;
    private String isdbrqx;
    private String jsry1;
    private String zgjj;
    private String jylcfq;
    private String jelcfq;
    private String jdlcfq;
    private String bmcfzxysdm;
    private String jsypcfq;
    private String xcfsyq;
    private String fzyyspq;
    private String szyzq;
    private String qkysq;
    private String xgbjxhtyxq;
    private String yzfsq;
    private String yzfscxq;
    private String blbjq;
    private String hzq;
    private String gbys;
    private String zycfq;
    private String mzcfq;
    private String fsypcfq;
    private String jhsyypcfq;
    private String ckfsgbqx;
    private String pxyxj;
    private String gbysbz;
    private String mfhs;
    private String xlMc;
    private String xwId;
    private String xwMc;
    private String sfzzyy;
    private String wjztxbz;
    private String ybysbz;
    private String gjycfq;
    private String isscpt;
    private String dbcfq;
    private String rzrq;
    private String lzrq;
    private String kxgypzd;
    private Integer bkxgypzd;
    private String yszgzbm;
    private String yszyzbm;
    private String zwId;
    private String zwMc;
    private String mdmphoto;
    private String dlhsbz;
    private String yszcbh;
    private String yszyfw;
    private String hszybh;
    private String zgsc;
    private String zglx;
    private String cfqz;
    private String mzlycfqz;
    private String xycflrqz;
    private String zycflrqz;
    private String cycflrqz;
    private String jslycfqz;
    private String jdlycfqz;
    private String fzyyspqz;
    private String xcfsyqxz;
    private String szyzqxz;
    private String qkysqxz;
    private String xgbjxhtyxqxz;
    private String yssfyyzfsqxz;
    private String xghqxzdbrsbqz;
    private String fyxxdydcqz;
    private String dbybcfqz;
    private String jylyfqz;
    private String gjycfqz;
    private String zzrsyycfqz;
    private String cplyycfqz;
    private String tpsjsyycfqz;
    private String xyzjyycfqz;
    private String yyjsyycfqz;
    private String myzqyycfqz;
    private String kzlywcfqz;
    private String ylqtcfqz;
    private String yzfscxqz;
    private String blbjqz;
    private String hzqz;
    private String blzhcxdydcqz;
    private String emrblcxqz;
    private String bltjqz;
    private String csqz;
    private String ksscfqz;
    private String dbrqxz;
    private String cwyyycfqz;
    private String jelycfqz;
    private String mzcfqz;
    private String zycfqz;
    private String fsypcfqz;
    private String ckfsgbqz;
    private String sfnkssyzz;
    private String jhsyypcfqz;
    private String zlxmcfqz;
    private String tbcfq;
    private String yjkscxq;
    private String ejkscxq;
    private String ywsyq;
    private String ybcfq;
    private String yydxyqcfq;
    private String ylqtlcfq;
    private String hzyqq;
    private String hzchq;
    private String sqyxqx;
    private String ksxdfwhqx;
    private String qyxdfwhqx;
    private String qygmxxzfqx;
    private String bkysdmjsjdxgqx;
    private String qyysdmjsjdxgqx;
    private String bmfglqx;
    private String kszpglwhqx;
    private String qyzpglwhqx;
    private String qydzblmbbjq;
    private String dzysbz;
    private String kzrshqx;
    private String kfcfq;

}
