| | |
| | | import cn.hutool.core.lang.Validator; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.ruoyi.common.annotation.DataScope; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | |
| | | |
| | | if (StrUtil.isNotBlank(sqlString.toString())) |
| | | { |
| | | putDataScope(joinPoint, " AND (" + sqlString.substring(4) + ")"); |
| | | putDataScope(joinPoint, "AND (" + sqlString.substring(4) + ")"); |
| | | } |
| | | } |
| | | |
| | |
| | | Object params = joinPoint.getArgs()[0]; |
| | | if (Validator.isNotNull(params)) |
| | | { |
| | | try { |
| | | Method getParams = params.getClass().getDeclaredMethod("getParams", null); |
| | | Map<String, Object> invoke = (Map<String, Object>) getParams.invoke(params, null); |
| | | invoke.put(DATA_SCOPE, sql); |
| | | } catch (Exception e) { |
| | | // 方法未找到 不处理 |
| | | if(params instanceof BaseEntity) { |
| | | BaseEntity baseEntity = (BaseEntity) params; |
| | | baseEntity.getParams().put(DATA_SCOPE, sql); |
| | | } else { |
| | | try { |
| | | Method getParams = params.getClass().getDeclaredMethod("getParams", null); |
| | | Map<String, Object> invoke = (Map<String, Object>) getParams.invoke(params, null); |
| | | invoke.put(DATA_SCOPE, sql); |
| | | } catch (Exception e) { |
| | | // 方法未找到 不处理 |
| | | } |
| | | } |
| | | } |
| | | } |