Commit ec407bbe25ce8e387fa7adc98afd62171340f0dd
1 parent
b4b3ff88
数据范围过滤属性调整
Showing
5 changed files
with
9 additions
and
17 deletions
ruoyi/src/main/java/com/ruoyi/framework/aspectj/DataScopeAspect.java
| ... | ... | @@ -52,6 +52,11 @@ public class DataScopeAspect |
| 52 | 52 | */ |
| 53 | 53 | public static final String DATA_SCOPE_SELF = "5"; |
| 54 | 54 | |
| 55 | + /** | |
| 56 | + * 数据权限过滤关键字 | |
| 57 | + */ | |
| 58 | + public static final String DATA_SCOPE = "dataScope"; | |
| 59 | + | |
| 55 | 60 | // 配置织入点 |
| 56 | 61 | @Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.DataScope)") |
| 57 | 62 | public void dataScopePointCut() |
| ... | ... | @@ -138,7 +143,7 @@ public class DataScopeAspect |
| 138 | 143 | if (StringUtils.isNotBlank(sqlString.toString())) |
| 139 | 144 | { |
| 140 | 145 | BaseEntity baseEntity = (BaseEntity) joinPoint.getArgs()[0]; |
| 141 | - baseEntity.setDataScope(" AND (" + sqlString.substring(4) + ")"); | |
| 146 | + baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); | |
| 142 | 147 | } |
| 143 | 148 | } |
| 144 | 149 | ... | ... |
ruoyi/src/main/java/com/ruoyi/framework/web/domain/BaseEntity.java
| ... | ... | @@ -36,9 +36,6 @@ public class BaseEntity implements Serializable |
| 36 | 36 | /** 备注 */ |
| 37 | 37 | private String remark; |
| 38 | 38 | |
| 39 | - /** 数据权限 */ | |
| 40 | - private String dataScope; | |
| 41 | - | |
| 42 | 39 | /** 开始时间 */ |
| 43 | 40 | @JsonIgnore |
| 44 | 41 | private String beginTime; |
| ... | ... | @@ -110,16 +107,6 @@ public class BaseEntity implements Serializable |
| 110 | 107 | this.remark = remark; |
| 111 | 108 | } |
| 112 | 109 | |
| 113 | - public String getDataScope() | |
| 114 | - { | |
| 115 | - return dataScope; | |
| 116 | - } | |
| 117 | - | |
| 118 | - public void setDataScope(String dataScope) | |
| 119 | - { | |
| 120 | - this.dataScope = dataScope; | |
| 121 | - } | |
| 122 | - | |
| 123 | 110 | public String getBeginTime() |
| 124 | 111 | { |
| 125 | 112 | return beginTime; | ... | ... |
ruoyi/src/main/resources/mybatis/system/SysDeptMapper.xml
ruoyi/src/main/resources/mybatis/system/SysRoleMapper.xml
ruoyi/src/main/resources/mybatis/system/SysUserMapper.xml
| ... | ... | @@ -78,7 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 78 | 78 | AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) )) |
| 79 | 79 | </if> |
| 80 | 80 | <!-- 数据范围过滤 --> |
| 81 | - ${dataScope} | |
| 81 | + ${params.dataScope} | |
| 82 | 82 | </select> |
| 83 | 83 | |
| 84 | 84 | <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult"> | ... | ... |