package com.example.system.model;

import com.example.system.utils.DateUtil;
import lombok.Data;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Data
@Entity
@Table(name = "user_table")
@EntityListeners(AuditingEntityListener.class)
public class UserTable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "user_id")
    private Long userId;

    @Column(name = "user_name", nullable = false, length = 50)
    private String userName;

    @Column(name = "s_t_id", nullable = false, length = 20)
    private String sTId;

    @Column(name = "user_password", nullable = false)
    private String userPassword;

    @Column(name = "user_privileges", nullable = false, columnDefinition = "INT DEFAULT 2")
    private Integer userPrivileges;

    @Column(name = "email", nullable = false, length = 50)
    private String email;

    @Column(name = "college_id", nullable = false)
    private Integer collegeId;

    @Column(name = "major_table_id")
    private Integer majorTableId;

    @Column(name = "phone", length = 20)
    private String phone;

    @Column(name = "teacher_title", length = 50)
    private String teacherTitle;

    @Column(name = "birthdate")
    @Temporal(TemporalType.DATE)
    private Date birthdate;

    @Column(name = "gender", columnDefinition = "VARCHAR(10) CHECK (gender IN ('男', '女'))")
    private String gender;

    @Column(name = "user_status", columnDefinition = "INT DEFAULT 0")
    private Integer userStatus;

}