🐛 Fixing a bug. #5025 数据权限 COUNT 函数在全部数据权限级别执行错误

This commit is contained in:
lbw committed 2023-07-25 19:41:14 +08:00
1 parent 319597d449
commit 18d1ac8356
1 file changed
+9 -2
@@ -37,8 +37,15 @@ public class DataScopeInnerInterceptor implements DataScopeInterceptor {
return;
}
// 返回true 不拦截直接返回原始 SQL
if (dataScopeHandle.calcScope(dataScope)) {
// 返回true 不拦截直接返回原始 SQL (只针对 * 查询)
if (dataScopeHandle.calcScope(dataScope) && DataScopeFuncEnum.ALL.equals(dataScope.getFunc())) {
return;
}
// 返回true 不拦截直接返回原始 SQL (只针对 COUNT 查询)
if (dataScopeHandle.calcScope(dataScope) && DataScopeFuncEnum.COUNT.equals(dataScope.getFunc())) {
mpBs.sql(String.format("SELECT %s FROM (%s) temp_data_scope",
dataScope.getFunc().getType(), originalSql));
return;
}