package com.gci.boot.modules.system.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.gci.boot.common.dict.annotation.Dict;
import com.gci.boot.common.dict.annotation.ExcelEnum;
import com.gci.boot.common.dict.excel.DictConverter;
import com.gci.boot.common.dict.excel.EnumConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author chenzhiwei
 * @since 2023-08-22
 */
@Getter
@Setter
@TableName("sys_user")
@ApiModel(value = "SysUser对象", description = "用户表")
public class SysUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    @ApiModelProperty("登录账号")
    @ExcelProperty("登录账号")
    private String username;

    @ApiModelProperty("真实姓名")
    @ExcelProperty("真实姓名")
    private String realname;

    @ApiModelProperty("密码")
    @ExcelIgnore
    private String password;

    @ApiModelProperty("md5密码盐")
    @ExcelIgnore
    private String salt;

    @ApiModelProperty("头像")
    @ExcelIgnore
    private String avatar;

    @ApiModelProperty("生日")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @ExcelProperty("生日")
    private Date birthday;

    @ApiModelProperty("性别(0-默认未知,1-男,2-女)")
    @ExcelEnum("0_未知,1_男,2_女")
    @ExcelProperty(value = "性别", converter = EnumConverter.class)
    private Integer sex;

    @ApiModelProperty("电子邮件")
    @ExcelProperty("电子邮件")
    private String email;

    @ApiModelProperty("电话")
    @ExcelProperty("电话")
    private String phone;

    @ApiModelProperty("状态(1-正常,2-冻结)")
    @ExcelEnum("1_正常,2_冻结")
    @ExcelProperty(value = "状态", converter = EnumConverter.class)
    private Integer status;

    @ApiModelProperty("工号，唯一键")
    @ExcelProperty("工号")
    private String workNo;

    @ApiModelProperty("职务，关联职务表")
    @ExcelProperty("职务")
    private String post;

    @ApiModelProperty("座机号")
    @ExcelProperty("座机号")
    private String telephone;

    @ApiModelProperty("创建人")
    @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname")
    @ExcelProperty(value = "创建人", converter = DictConverter.class)
    private String createBy;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("创建时间")
    @ExcelProperty("创建时间")
    private Date createTime;

    @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname")
    @ApiModelProperty("更新人")
    @ExcelProperty(value = "更新人",converter = DictConverter.class)
    private String updateBy;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("更新时间")
    @ExcelProperty("更新时间")
    private Date updateTime;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("密码修改时间")
    @ExcelIgnore
    private Date passwordUpdateTime;

    @ApiModelProperty("加密手机")
    @ExcelIgnore
    private String encryptPhone;

    @ApiModelProperty("密保手机")
    @ExcelIgnore
    private String secretPhone;


    @ApiModelProperty("部门编号")
    @Dict(dictTable = "sys_depart", dicCode = "org_code", dicText = "depart_name")
    private String orgCode;
    
    @ApiModelProperty("微信openid")
    @ExcelIgnore
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String openid;

    @ApiModelProperty("用户机构")
    @TableField(exist = false)
    @ExcelIgnore
    @Dict(dictTable = "sys_depart",dicCode = "id",dicText = "depart_name")
    private String depIds;

    @ApiModelProperty("用户角色")
    @TableField(exist = false)
    @ExcelIgnore
    @Dict(dictTable = "sys_role",dicCode = "id",dicText = "role_name")
    private String roleIds;
}
