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 1/2] =?UTF-8?q?update=20ruoyi-framework/src/main/java/com/?= =?UTF-8?q?ruoyi/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?= =?UTF-8?q?=E5=A4=84=E7=90=86=E7=B1=BB=E4=B8=AD=EF=BC=8C=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=A4=9A=E8=A7=92=E8=89=B2=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C?= =?UTF-8?q?=E8=8B=A5=E6=89=80=E6=9C=89=E8=A7=92=E8=89=B2=E9=83=BD=E4=B8=8D?= =?UTF-8?q?=E5=8C=85=E5=90=AB=E4=BC=A0=E9=80=92=E8=BF=87=E6=9D=A5=E7=9A=84?= =?UTF-8?q?=E6=9D=83=E9=99=90=E5=AD=97=E7=AC=A6=EF=BC=8C=E8=BF=99=E4=B8=AA?= =?UTF-8?q?=E6=97=B6=E5=80=99sqlString=E4=B9=9F=E4=BC=9A=E4=B8=BA=E7=A9=BA?= =?UTF-8?q?=EF=BC=8C=E4=BC=9A=E5=AF=BC=E8=87=B4=E7=94=A8=E6=88=B7=E6=8B=A5?= =?UTF-8?q?=E6=9C=89=E5=85=A8=E9=83=A8=E6=95=B0=E6=8D=AE=E6=9D=83=E9=99=90?= =?UTF-8?q?=EF=BC=8C=E6=89=80=E4=BB=A5=E8=A6=81=E9=99=90=E5=88=B6=E4=B8=80?= =?UTF-8?q?=E4=B8=8B,=20=E5=8F=AF=E4=BB=A5=E6=A0=B9=E6=8D=AEconditions?= =?UTF-8?q?=E9=9B=86=E5=90=88=E6=98=AF=E5=90=A6=E4=B8=BA=E7=A9=BA=EF=BC=8C?= =?UTF-8?q?=E6=9D=A5=E5=88=A4=E6=96=AD=E5=BE=AA=E7=8E=AF=E6=97=B6=E6=89=80?= =?UTF-8?q?=E6=9C=89=E8=A7=92=E8=89=B2=E6=98=AF=E5=90=A6=E9=83=BD=E6=98=AF?= =?UTF-8?q?=E5=9C=A8=E5=88=A4=E6=96=AD=E6=9D=83=E9=99=90=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E6=97=B6continue=E4=BA=86=E3=80=82=20=E5=A4=8D=E7=8E=B0?= =?UTF-8?q?=E6=96=B9=E6=B3=95:=20=E5=9C=A8=E4=BD=BF=E7=94=A8@DataScope?= =?UTF-8?q?=E6=B3=A8=E8=A7=A3=E6=97=B6permission=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E4=BA=86=E5=80=BC,=E8=BF=99=E4=B8=AA=E5=80=BC=E6=89=80?= =?UTF-8?q?=E6=9C=89=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]; From 628bc94a9a629d0b3330e90b6b065c72e25b5577 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0=E6=85=95=E5=AE=B9=E9=9B=AA0?= Date: Sat, 11 Mar 2023 04:31:55 +0000 Subject: [PATCH 2/2] update ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 0慕容雪0 --- .../main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 ddf5e60f..c1c64ece 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 @@ -106,8 +106,9 @@ public class DataScopeAspect continue; } if (DATA_SCOPE_ALL.equals(dataScope)) - { + { sqlString = new StringBuilder(); + conditions.add(dataScope); break; } else if (DATA_SCOPE_CUSTOM.equals(dataScope))