package com.zd.system.api.domain;

import com.zd.common.core.annotation.Excel;
import com.zd.common.core.annotation.Excel.Type;
import com.zd.common.core.utils.StringUtils;
import org.springframework.beans.BeanUtils;

import java.text.SimpleDateFormat;

/**
 * 用户对象 sys_user
 *
 * @author zd
 */
public class SysUserStudentByExport {
    private static final long serialVersionUID = 1L;

    /**
     * 姓名
     */
    @Excel(name = "姓名" ,type = Type.EXPORT)
    private String nickName;

    /**
     * 学号
     */
    @Excel(name = "学号" ,type = Type.EXPORT)
    private String userName;

    /**
     * 所属学院
     */
    @Excel(name = "所属学院" ,type = Type.EXPORT)
    private String deptName;

    /**
     * 专业
     */
    @Excel(name = "专业",type = Type.EXPORT)
    private String major;

    /**
     * 手机号码
     */
    @Excel(name = "手机号码" ,type = Type.EXPORT)
    private String phonenumber;

    /**
     * 邮箱
     */
    @Excel(name = "邮箱" ,type = Type.EXPORT)
    private String email;

    /**
     * 班级
     */
    @Excel(name = "班级" ,type = Type.EXPORT)
    private String grade;


    /**
     * 性别
     */
    @Excel(name = "性别" ,type = Type.EXPORT)
    private String sex;

    /**
     * 出生日期
     */
    @Excel(name = "出生日期" ,type = Type.EXPORT)
    private String dateBirth;

    /**
     * 校园卡号
     */
    @Excel(name = "校园卡号" ,type = Type.EXPORT)
    private String cardNum;

    /**
     * 导师名称
     */
    @Excel(name = "导师",type = Type.EXPORT)
    private String tutorUserName;

    /**
     * 学籍状态
     */
    @Excel(name = "状态" ,type = Type.EXPORT)
    private String workStatus;

    public SysUserStudentByExport(SysUser sysUser) {
        BeanUtils.copyProperties(sysUser, this);
        if(StringUtils.isNotNull(sysUser.getSex()) && sysUser.getSex().equals("0")){
            this.sex = "男";
        }else if(StringUtils.isNotNull(sysUser.getSex()) && sysUser.getSex().equals("1")){
            this.sex = "女";
        }else{
            this.sex = "未知";
        }
        if(StringUtils.isNotNull(sysUser.getDateBirth())){
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            this.setDateBirth(sdf.format(sysUser.getDateBirth()));
        }
        this.grade = sysUser.getGradeName();
        this.deptName = sysUser.getDept() == null ? null : sysUser.getDept().getDeptName();
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public String getPhonenumber() {
        return phonenumber;
    }

    public void setPhonenumber(String phonenumber) {
        this.phonenumber = phonenumber;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getDateBirth() {
        return dateBirth;
    }

    public void setDateBirth(String dateBirth) {
        this.dateBirth = dateBirth;
    }

    public String getCardNum() {
        return cardNum;
    }

    public void setCardNum(String cardNum) {
        this.cardNum = cardNum;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }

    public String getTutorUserName() {
        return tutorUserName;
    }

    public void setTutorUserName(String tutorUserName) {
        this.tutorUserName = tutorUserName;
    }

    public String getWorkStatus() {
        return workStatus;
    }

    public void setWorkStatus(String workStatus) {
        this.workStatus = workStatus;
    }
}
