From ec407bbe25ce8e387fa7adc98afd62171340f0dd Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 3 Jun 2020 13:00:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=8C=83=E5=9B=B4=E8=BF=87?= =?UTF-8?q?=E6=BB=A4=E5=B1=9E=E6=80=A7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/framework/aspectj/DataScopeAspect.java | 7 ++++++- .../com/ruoyi/framework/web/domain/BaseEntity.java | 13 ------------- .../main/resources/mybatis/system/SysDeptMapper.xml | 2 +- .../main/resources/mybatis/system/SysRoleMapper.xml | 2 +- .../main/resources/mybatis/system/SysUserMapper.xml | 2 +- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java b/ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java index 634f0ed6..e28e9680 100644 --- a/ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java +++ b/ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java @@ -52,6 +52,11 @@ public class DataScopeAspect */ public static final String DATA_SCOPE_SELF = "5"; + /** + * 数据权限过滤关键字 + */ + public static final String DATA_SCOPE = "dataScope"; + // 配置织入点 @Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.DataScope)") public void dataScopePointCut() @@ -138,7 +143,7 @@ public class DataScopeAspect if (StringUtils.isNotBlank(sqlString.toString())) { BaseEntity baseEntity = (BaseEntity) joinPoint.getArgs()[0]; - baseEntity.setDataScope(" AND (" + sqlString.substring(4) + ")"); + baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); } } diff --git a/ruoyi/src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java b/ruoyi/src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java index 6ed760cb..08f4f902 100644 --- a/ruoyi/src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java +++ b/ruoyi/src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java @@ -36,9 +36,6 @@ public class BaseEntity implements Serializable /** 备注 */ private String remark; - /** 数据权限 */ - private String dataScope; - /** 开始时间 */ @JsonIgnore private String beginTime; @@ -110,16 +107,6 @@ public class BaseEntity implements Serializable this.remark = remark; } - public String getDataScope() - { - return dataScope; - } - - public void setDataScope(String dataScope) - { - this.dataScope = dataScope; - } - public String getBeginTime() { return beginTime; diff --git a/ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml b/ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml index c546dee1..33380463 100644 --- a/ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml +++ b/ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml @@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND status = #{status} - ${dataScope} + ${params.dataScope} order by d.parent_id, d.order_num diff --git a/ruoyi/src/main/resources/mybatis/system/SysRoleMapper.xml b/ruoyi/src/main/resources/mybatis/system/SysRoleMapper.xml index a5e7be0b..82524b82 100644 --- a/ruoyi/src/main/resources/mybatis/system/SysRoleMapper.xml +++ b/ruoyi/src/main/resources/mybatis/system/SysRoleMapper.xml @@ -47,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and date_format(r.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') - ${dataScope} + ${params.dataScope} order by r.role_sort diff --git a/ruoyi/src/main/resources/mybatis/system/SysUserMapper.xml b/ruoyi/src/main/resources/mybatis/system/SysUserMapper.xml index 2e6969cb..99c0d50e 100644 --- a/ruoyi/src/main/resources/mybatis/system/SysUserMapper.xml +++ b/ruoyi/src/main/resources/mybatis/system/SysUserMapper.xml @@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) )) - ${dataScope} + ${params.dataScope}