package com.sunyard.ssp.modules.user.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sunyard.ssp.common.enums.UserHeaderTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.Transient;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author tsz
 * @since 2020-03-11
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("SC_USER")
public class ScUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableField("ID")
    private Long id;

    /**
     * 用户名
     */
    @TableField("USERNAME")
    private String username;

    /**
     * 密码
     */
    @TableField("PASSWORD")
    private String password;

    /**
     * 真实姓名
     */
    @TableField("REALNAME")
    private String realname;

    /**
     * 组织机构id
     */
    @TableField("ORGANIZATION_ID")
    private Long organizationId;

    /**
     * 手机号
     */
    @TableField("TEL")
    private String tel;

    /**
     * 邮箱
     */
    @TableField("EMAIL")
    private String email;

    /**
     * 状态：0：可用 1：不可用
     */
    @TableField("STATUS")
    private Integer status;

    @TableField("POSITION_ID")
    private Integer positionId;

    @TableField("UPDATE_TIME")
    private LocalDateTime updateTime;

    @TableField("PASS_UPDATE_TIME")
    private LocalDateTime passUpdateTime;

    @TableField("SEX")
    private Integer sex;

    @TableField("AVATAR")
    private String avatar;

    @TableField(value = "U_PUBLICKEY" )
    @ApiModelProperty(value = "用户绑定U盾公钥")
    private String uPublickey;

    @Transient
    @TableField(exist=false)
    @ApiModelProperty(value = "职位名称")
    private String positionName;

    @Transient
    @TableField(exist=false)
    private String departmentTitle;

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

    @Transient
    @TableField(exist=false)
    private List<ScPermission> permissions;

    @Transient
    @TableField(exist=false)
    @ApiModelProperty(value = "负责人类型")
    private Integer headerTypeKey = UserHeaderTypeEnum.HEADER_TYPE_NONE.getKey();

    @Transient
    @TableField(exist=false)
    @ApiModelProperty(value = "负责人类型名")
    private String headerTypeName = UserHeaderTypeEnum.HEADER_TYPE_NONE.getName();

    @Transient
    @TableField(exist=false)
    @ApiModelProperty(value = "导入数据时使用")
    private Integer defaultRole;

    public Long getId() {
        return id;
    }

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