update 优化 DataPermissionHelper 增加 开启/关闭 忽略数据权限功能

2.X
疯狂的狮子li 2 years ago
parent e37810fe54
commit 60418ec32b

@ -3,6 +3,8 @@ package com.ruoyi.common.mybatis.helper;
import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.context.model.SaStorage;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy;
import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@ -44,4 +46,19 @@ public class DataPermissionHelper {
}
throw new NullPointerException("data permission context type exception");
}
/**
* ( {@link #disableIgnore()} )
*/
public static void enableIgnore() {
InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().dataPermission(true).build());
}
/**
*
*/
public static void disableIgnore() {
InterceptorIgnoreHelper.clearIgnoreStrategy();
}
}

Loading…
Cancel
Save