mirror of
https://github.com/RemainderTime/spring-boot-base-demo.git
synced 2026-02-19 13:30:53 +08:00
1.引入sa-token权限框架
2.实现RBAC模型相关表结构(用户-权限-菜单-角色)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package cn.xf.basedemo.interceptor;
|
||||
|
||||
import cn.dev33.satoken.stp.StpInterface;
|
||||
import cn.xf.basedemo.common.utils.ApplicationContextUtils;
|
||||
import cn.xf.basedemo.mappers.SysPermissionMapper;
|
||||
import cn.xf.basedemo.mappers.SysRoleMapper;
|
||||
import cn.xf.basedemo.model.domain.SysRole;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 权限加载组件类
|
||||
* @ClassName: StpInterfaceImpl
|
||||
* @Author: xiongfeng
|
||||
* @Date: 2025/8/18 22:51
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Component
|
||||
public class StpInterfaceImpl implements StpInterface {
|
||||
|
||||
private SysPermissionMapper sysPermissionMapper= (SysPermissionMapper) ApplicationContextUtils.getBean("SysPermissionMapper");
|
||||
private SysRoleMapper sysRoleMapper= (SysRoleMapper) ApplicationContextUtils.getBean("SysRoleMapper");
|
||||
|
||||
@Override
|
||||
public List<String> getPermissionList(Object userId, String s) {
|
||||
//获取登录用户权限数据
|
||||
return sysPermissionMapper.getPermissionListByRoleId((Long) userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getRoleList(Object userId, String s) {
|
||||
//获取用户角色数据
|
||||
return sysRoleMapper.getRoleListByUserId((Long) userId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user