src/main/java/com/ruoyi/framework/security/LoginUser.java
@@ -4,7 +4,7 @@
import java.util.Set;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson2.annotation.JSONField;
import com.ruoyi.project.system.domain.SysUser;
/**
@@ -24,7 +24,7 @@
    /**
     * 部门ID
     */
    private Long deptId;
    private Long [] deptIds;
    /**
     * 用户唯一标识
@@ -71,6 +71,64 @@
     */
    private SysUser user;
    /**
     * 租户ID
     */
    private Long tenantId;
    /**
     * 当前部门id
     */
    private Long currentDeptId;
    /**
     * 是否开通AI功能(0否 1是)
     */
    private Integer aiEnabled;
    private String dataScope;
    public LoginUser()
    {
    }
    public LoginUser(SysUser user, Set<String> permissions)
    {
        this.user = user;
        this.permissions = permissions;
        this.aiEnabled = user == null ? null : user.getAiEnabled();
    }
    public LoginUser(Long userId, Long [] deptId, SysUser user, Set<String> permissions)
    {
        this.userId = userId;
        this.deptIds = deptId;
        this.user = user;
        this.permissions = permissions;
        this.aiEnabled = user == null ? null : user.getAiEnabled();
    }
    public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId, Set<String> permissions)
    {
        this.userId = userId;
        this.deptIds = deptIds;
        this.user = user;
        this.permissions = permissions;
        this.tenantId = tenantId;
        this.aiEnabled = user == null ? null : user.getAiEnabled();
    }
    public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId,Long currentDeptId, Set<String> permissions)
    {
        this.userId = userId;
        this.deptIds = deptIds;
        this.user = user;
        this.permissions = permissions;
        this.tenantId = tenantId;
        this.currentDeptId = currentDeptId;
        this.aiEnabled = user == null ? null : user.getAiEnabled();
    }
    public Long getUserId()
    {
        return userId;
@@ -81,14 +139,14 @@
        this.userId = userId;
    }
    public Long getDeptId()
    public Long [] getDeptIds()
    {
        return deptId;
        return deptIds;
    }
    public void setDeptId(Long deptId)
    public void setDeptId(Long [] deptIds)
    {
        this.deptId = deptId;
        this.deptIds = deptIds;
    }
    public String getToken()
@@ -99,24 +157,6 @@
    public void setToken(String token)
    {
        this.token = token;
    }
    public LoginUser()
    {
    }
    public LoginUser(SysUser user, Set<String> permissions)
    {
        this.user = user;
        this.permissions = permissions;
    }
    public LoginUser(Long userId, Long deptId, SysUser user, Set<String> permissions)
    {
        this.userId = userId;
        this.deptId = deptId;
        this.user = user;
        this.permissions = permissions;
    }
    @JSONField(serialize = false)
@@ -130,6 +170,11 @@
    public String getUsername()
    {
        return user.getUserName();
    }
    public String getNickName()
    {
        return user.getNickName();
    }
    /**
@@ -253,14 +298,57 @@
        return user;
    }
    public void setUser(SysUser user)
    {
        this.user = user;
    }
    public void setUser(SysUser user)
    {
        this.user = user;
        this.aiEnabled = user == null ? null : user.getAiEnabled();
    }
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities()
    {
        return null;
    }
}
    public Long getTenantId() {
        return tenantId;
    }
    public void setTenantId(Long tenantId) {
        this.tenantId = tenantId;
    }
    public void setDeptIds(Long[] deptIds) {
        this.deptIds = deptIds;
    }
    public Long getCurrentDeptId() {
        return currentDeptId;
    }
    public void setCurrentDeptId(Long currentDeptId) {
        this.currentDeptId = currentDeptId;
    }
    public Integer getAiEnabled() {
        if (aiEnabled != null) {
            return aiEnabled;
        }
        if (user != null && user.getAiEnabled() != null) {
            return user.getAiEnabled();
        }
        return 0;
    }
    public void setAiEnabled(Integer aiEnabled) {
        this.aiEnabled = aiEnabled;
    }
    public String getDataScope() {
        return dataScope;
    }
    public void setDataScope(String dataScope) {
        this.dataScope = dataScope;
    }
}