package cn.reghao.autodop.dmaster.rbac.model.vo;

import cn.reghao.autodop.dmaster.rbac.model.constant.UserGender;
import cn.reghao.autodop.dmaster.rbac.model.po.User;
import cn.reghao.jdkutil.converter.DateTimeConverter;
import lombok.Data;

/**
 * @author reghao
 * @date 2021-07-14 10:28:47
 */
@Data
public class UserVO {
    private Integer userId;
    private String username;
    private String nickname;
    private String gender;
    private String mobilePhone;
    private String email;
    private String createTime;
    private String status;

    public UserVO(User user) {
        this.userId = user.getId();
        this.username = user.getUsername();
        this.nickname = user.getNickname();
        this.gender = UserGender.getDescByCode(user.getGender());
        this.mobilePhone = user.getMobilePhone();
        this.email = user.getEmail();
        this.createTime = DateTimeConverter.format(user.getCreateTime());
        this.status = user.getIsEnabled() ? "启用" : "禁用";
    }
}
