#
Junjie
2 天以前 d9411a6692197efabcf132d61c051e51cb85e219
src/main/java/com/zy/system/entity/User.java
@@ -1,13 +1,14 @@
package com.zy.system.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.zy.system.service.HostService;
import com.zy.system.service.RoleService;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.text.SimpleDateFormat;
@@ -48,6 +49,31 @@
    private String password;
    /**
     * 是否允许使用 MFA
     */
    @TableField("mfa_allow")
    private Integer mfaAllow;
    /**
     * 是否已启用 MFA
     */
    @TableField("mfa_enabled")
    private Integer mfaEnabled;
    /**
     * MFA 密钥
     */
    @TableField(value = "mfa_secret", select = false)
    private String mfaSecret;
    /**
     * MFA 绑定时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @TableField("mfa_bound_time")
    private Date mfaBoundTime;
    /**
     * 角色
     */
    @TableField("role_id")
@@ -56,6 +82,7 @@
    /**
     * 注册时间
     */
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @TableField("create_time")
    private Date createTime;
@@ -82,7 +109,7 @@
    public String getHostName() {
        HostService service = SpringUtils.getBean(HostService.class);
        Host host = service.selectById(this.hostId);
        Host host = service.getById(this.hostId);
        if (!Cools.isEmpty(host)){
            return host.getName();
        }
@@ -113,13 +140,66 @@
        this.password = password;
    }
    public Integer getMfaAllow() {
        return mfaAllow;
    }
    public String getMfaAllow$() {
        if (null == this.mfaAllow) {
            return null;
        }
        return Integer.valueOf(1).equals(this.mfaAllow) ? "是" : "否";
    }
    public void setMfaAllow(Integer mfaAllow) {
        this.mfaAllow = mfaAllow;
    }
    public Integer getMfaEnabled() {
        return mfaEnabled;
    }
    public String getMfaEnabled$() {
        if (null == this.mfaEnabled) {
            return null;
        }
        return Integer.valueOf(1).equals(this.mfaEnabled) ? "是" : "否";
    }
    public void setMfaEnabled(Integer mfaEnabled) {
        this.mfaEnabled = mfaEnabled;
    }
    public String getMfaSecret() {
        return mfaSecret;
    }
    public void setMfaSecret(String mfaSecret) {
        this.mfaSecret = mfaSecret;
    }
    public Date getMfaBoundTime() {
        return mfaBoundTime;
    }
    public String getMfaBoundTime$() {
        if (Cools.isEmpty(this.mfaBoundTime)) {
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.mfaBoundTime);
    }
    public void setMfaBoundTime(Date mfaBoundTime) {
        this.mfaBoundTime = mfaBoundTime;
    }
    public Long getRoleId() {
        return roleId;
    }
    public String getRoleName(){
        RoleService service = SpringUtils.getBean(RoleService.class);
        Role role = service.selectById(this.roleId);
        Role role = service.getById(this.roleId);
        if (!Cools.isEmpty(role)){
            return role.getName();
        }