fix(sql): 修复未登录MyBatis拦截器报错导致启动失败的bug

This commit is contained in:
胡少翔
2024-12-05 11:34:26 +08:00
parent 7bd17b5a18
commit 13cd408a97

View File

@@ -37,6 +37,12 @@ public class MyDataPermissionHandler implements DataPermissionHandler {
if(SecurityUtils.isRoot()){
return where;
}
// 如果是未登录或者是定时任务执行的SQL直接返回
Long userId = SecurityUtils.getUserId();
if(userId == null){
return where;
}
// 获取当前用户的数据权限
Integer dataScope = SecurityUtils.getDataScope();
DataScopeEnum dataScopeEnum = IBaseEnum.getEnumByValue(dataScope, DataScopeEnum.class);