From ec407bbe25ce8e387fa7adc98afd62171340f0dd Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期三, 03 六月 2020 13:00:30 +0800
Subject: [PATCH] 数据范围过滤属性调整
---
ruoyi/src/main/resources/mybatis/system/SysUserMapper.xml | 2 +-
ruoyi/src/main/resources/mybatis/system/SysRoleMapper.xml | 2 +-
ruoyi/src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java | 13 -------------
ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml | 2 +-
ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java | 7 ++++++-
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 634f0ed..e28e968 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 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 @@
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 6ed760c..08f4f90 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 @@
/** 澶囨敞 */
private String remark;
- /** 鏁版嵁鏉冮檺 */
- private String dataScope;
-
/** 寮�濮嬫椂闂� */
@JsonIgnore
private String beginTime;
@@ -108,16 +105,6 @@
public void setRemark(String remark)
{
this.remark = remark;
- }
-
- public String getDataScope()
- {
- return dataScope;
- }
-
- public void setDataScope(String dataScope)
- {
- this.dataScope = dataScope;
}
public String getBeginTime()
diff --git a/ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml b/ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml
index c546dee..3338046 100644
--- a/ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml
+++ b/ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml
@@ -40,7 +40,7 @@
AND status = #{status}
</if>
<!-- 鏁版嵁鑼冨洿杩囨护 -->
- ${dataScope}
+ ${params.dataScope}
order by d.parent_id, d.order_num
</select>
diff --git a/ruoyi/src/main/resources/mybatis/system/SysRoleMapper.xml b/ruoyi/src/main/resources/mybatis/system/SysRoleMapper.xml
index a5e7be0..82524b8 100644
--- a/ruoyi/src/main/resources/mybatis/system/SysRoleMapper.xml
+++ b/ruoyi/src/main/resources/mybatis/system/SysRoleMapper.xml
@@ -47,7 +47,7 @@
and date_format(r.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
</if>
<!-- 鏁版嵁鑼冨洿杩囨护 -->
- ${dataScope}
+ ${params.dataScope}
order by r.role_sort
</select>
diff --git a/ruoyi/src/main/resources/mybatis/system/SysUserMapper.xml b/ruoyi/src/main/resources/mybatis/system/SysUserMapper.xml
index 2e6969c..99c0d50 100644
--- a/ruoyi/src/main/resources/mybatis/system/SysUserMapper.xml
+++ b/ruoyi/src/main/resources/mybatis/system/SysUserMapper.xml
@@ -78,7 +78,7 @@
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) ))
</if>
<!-- 鏁版嵁鑼冨洿杩囨护 -->
- ${dataScope}
+ ${params.dataScope}
</select>
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
--
Gitblit v1.9.3