package com.rf.psychological.user.dao.model;

import com.rf.psychological.base.model.BaseEntity;
import lombok.*;

import javax.persistence.*;

/**
 * @author zsy
 * @description:用户信息表
 * @date 2021/6/17 15:55
 */
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "t_user_info", indexes = {
        @Index(columnList = "phone,institution_no")
})
@EqualsAndHashCode(callSuper=true)
@org.hibernate.annotations.Table(appliesTo = "t_user_info", comment = "用户信息表")
public class UserEntity extends BaseEntity {

    public UserEntity(String institutionNo,String institutionName,String phone,String petName,String password,String birthday,String gender,String userStatus ,String roleType){
        this.institutionNo = institutionNo;
        this.institutionName = institutionName;
        this.phone = phone;
        this.petName = petName;
        this.password = password;
        this.birthday = birthday;
        this.gender = gender;
        this.userStatus = userStatus;
        this.roleType = roleType;
    }

    @Column(name = "phone", columnDefinition = "varchar(50) not null comment '同一机构下登录账号'")
    private String phone;

    @Column(name = "model_phone", columnDefinition = "varchar(11) default 0  comment '用户手机号：0->用户不填手机号 1->不在弹出手机框'")
    private String modelPhone;

    @Column(name = "pet_name", columnDefinition = "varchar(10) not null comment '昵称'")
    private String petName;

    @Column(name = "password", columnDefinition = "varchar(32) not null comment '密码'")
    private String password;

    @Column(name = "gender", columnDefinition = "varchar(2) not null comment '性别(0-男；1-女)'")
    private String gender;

    @Column(name = "birthday", columnDefinition = "varchar(15) not null comment '出生日期'")
    private String birthday;

    @Column(name = "profession", columnDefinition = "varchar(50) comment '职业'")
    private String profession;

    @Column(name = "institution_name", columnDefinition = "varchar(50) comment '所属机构名称'")
    private String institutionName;

    @Column(name = "institution_no", columnDefinition = "varchar(50) comment '所属机构编码'")
    private String institutionNo;

    @Column(name = "user_status", columnDefinition = "varchar(2) comment '用户状态，1-待审核 2-审核通过 3--密码被重置需要重新登录 4--批量导入用户需完善信息'")
    private String userStatus = "1";

    @Column(name = "addition_info", columnDefinition = "varchar(500) comment '附加信息'")
    private String additionInfo;

    @Column(name = "g_id", columnDefinition = "varchar(36) default '0' comment  '组id(未分组设为0)'")
    private String gId;

    @Column(name = "role_type", columnDefinition = "varchar(2) default '1' comment  '角色(默认为1 1普通用户、2管理员、3机构超级管理员)'")
    private String roleType;

    @Transient
    private String avatarUrl;//用户头像地址

}
