From 4e8dd706d568d1276ad82a0bf8f4ba13c5dac5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0=E6=85=95=E5=AE=B9=E9=9B=AA0?= Date: Fri, 10 Mar 2023 08:22:35 +0000 Subject: [PATCH] =?UTF-8?q?update=20ruoyi-framework/src/main/java/com/ruoy?= =?UTF-8?q?i/framework/aspectj/DataScopeAspect.java.=20DataScopeAspect,?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=E5=88=87=E9=9D=A2=E5=A4=84?= =?UTF-8?q?=E7=90=86=E7=B1=BB=E4=B8=AD=EF=BC=8C=E7=94=A8=E6=88=B7=E5=A4=9A?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C=E8=8B=A5?= =?UTF-8?q?=E6=89=80=E6=9C=89=E8=A7=92=E8=89=B2=E9=83=BD=E4=B8=8D=E5=8C=85?= =?UTF-8?q?=E5=90=AB=E4=BC=A0=E9=80=92=E8=BF=87=E6=9D=A5=E7=9A=84=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=AD=97=E7=AC=A6=EF=BC=8C=E8=BF=99=E4=B8=AA=E6=97=B6?= =?UTF-8?q?=E5=80=99sqlString=E4=B9=9F=E4=BC=9A=E4=B8=BA=E7=A9=BA=EF=BC=8C?= =?UTF-8?q?=E4=BC=9A=E5=AF=BC=E8=87=B4=E7=94=A8=E6=88=B7=E6=8B=A5=E6=9C=89?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90=EF=BC=8C?= =?UTF-8?q?=E6=89=80=E4=BB=A5=E8=A6=81=E9=99=90=E5=88=B6=E4=B8=80=E4=B8=8B?= =?UTF-8?q?,=20=E5=8F=AF=E4=BB=A5=E6=A0=B9=E6=8D=AEconditions=E9=9B=86?= =?UTF-8?q?=E5=90=88=E6=98=AF=E5=90=A6=E4=B8=BA=E7=A9=BA=EF=BC=8C=E6=9D=A5?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E5=BE=AA=E7=8E=AF=E6=97=B6=E6=89=80=E6=9C=89?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=98=AF=E5=90=A6=E9=83=BD=E6=98=AF=E5=9C=A8?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=9D=83=E9=99=90=E5=AD=97=E7=AC=A6=E6=97=B6?= =?UTF-8?q?continue=E4=BA=86=E3=80=82=20=E5=A4=8D=E7=8E=B0=E6=96=B9?= =?UTF-8?q?=E6=B3=95:=20=E5=9C=A8=E4=BD=BF=E7=94=A8@DataScope=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=E6=97=B6permission=E5=AE=9A=E4=B9=89=E4=BA=86?= =?UTF-8?q?=E5=80=BC,=E8=BF=99=E4=B8=AA=E5=80=BC=E6=89=80=E6=9C=89?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E4=B8=8D=E5=8C=85=E5=90=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 0慕容雪0 --- .../java/com/ruoyi/framework/aspectj/DataScopeAspect.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java index 6e4bc381..ddf5e60f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java @@ -141,6 +141,12 @@ public class DataScopeAspect conditions.add(dataScope); } + // 多角色情况下,所有角色都不包含传递过来的权限字符,这个时候sqlString也会为空,所以要限制一下,不查询任何数据 + if (StringUtils.isEmpty(conditions)) + { + sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias)); + } + if (StringUtils.isNotBlank(sqlString.toString())) { Object params = joinPoint.getArgs()[0];