feat(data): 支持通过参数跳过数据权限

用法:
DataScope dataScope = new DataScope();
dataScope.setSkip(true);
baseMapper.selectPageByScope(page, wrapper, dataScope);
This commit is contained in:
冷冷 committed 2024-12-25 09:36:18 +08:00
1 parent 31f41db931
commit cc0f1cda67
2 files changed
+10

No files matched your search

@@ -32,6 +32,11 @@ import java.util.List;
@EqualsAndHashCode(callSuper = true)
public class DataScope extends HashMap {
/**
* 跳过数据权限,直接在参数设置 skip
*/
private boolean skip = false;
/**
* 限制范围的字段名称
*/
@@ -37,6 +37,11 @@ public class DataScopeInnerInterceptor implements DataScopeInterceptor {
return;
}
// 是否强制跳过数据权限
if (dataScope.isSkip()) {
return;
}
// 返回true 不拦截直接返回原始 SQL (只针对 * 查询)
if (DataScopeFuncEnum.ALL.equals(dataScope.getFunc()) && dataScopeHandle.calcScope(dataScope)) {
return;