package easydo.technology.system.domain;

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 easydo.technology.base.CommonEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @author jinjin
 * @date 2020-09-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_user")
public class User extends CommonEntity {
    private static final long serialVersionUID = 1L;

    @TableId(value = "user_id", type = IdType.AUTO)
    @NotNull(groups = Update.class)
    private Long id;

    private Long deptId;

    @NotBlank
    private String username;

    private String nickName;

    private String gender;

    @NotBlank
    private String phone;

    @NotBlank
    private String email;

    private String avatarName;

    private String avatarPath;

    private String password;

    private Boolean isAdmin;

    private Boolean enabled;

    private Date pwdResetTime;

    private Integer projectFpiId;

    private String projectUserType;

    private String features;

    private String originPassword;
    /**
     * sys-user用户表的id
     */
    @TableField(exist = false)
    private Long doId;

    public <T> void copyFrom(T source) {
        BeanUtils.copyProperties(source, this);
    }
}
