package cn.reghao.oss.console.account.model.vo;

import cn.reghao.oss.console.account.model.constant.UserGender;
import cn.reghao.oss.console.account.model.po.User;
import cn.reghao.jutil.jdk.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 screenName;
    private String gender;
    private String mobile;
    private String email;
    private String createTime;
    private String lastAccess;
    private String status;

    public UserVO(User user) {
        this.userId = user.getId();
        this.username = user.getUsername();
        this.screenName = user.getScreenName();
        this.gender = UserGender.getDescByCode(user.getGender());
        this.mobile = user.getMobile();
        this.email = user.getEmail();
        this.createTime = DateTimeConverter.format(user.getCreateTime());
        this.status = user.getEnabled() ? "启用" : "禁用";
        this.lastAccess = "N/A";
    }
}
