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

import cn.reghao.oss.console.account.model.po.Role;
import cn.reghao.jutil.jdk.converter.DateTimeConverter;
import lombok.Data;

import java.util.Locale;

/**
 * @author reghao
 * @date 2021-07-14 14:14:07
 */
@Data
public class RoleVO {
    private Integer roleId;
    private String name;
    private String description;
    private String createTime;
    private String updateTime;

    public RoleVO(Role role) {
        this.roleId = role.getId();
        this.name = role.getName().split("ROLE_")[1].toLowerCase(Locale.ROOT);
        this.description = role.getDescription();
        this.createTime = DateTimeConverter.format(role.getCreateTime());
        this.updateTime = DateTimeConverter.format(role.getUpdateTime());
    }
}
