update 优化代码书写格式 使用工具类

feature/model
疯狂的狮子li 4 years ago
parent a961fff69d
commit 7c20d6e28c

@ -8,6 +8,7 @@ import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.reflect.ReflectUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.framework.web.service.TokenService;
import org.aspectj.lang.JoinPoint;
@ -159,7 +160,6 @@ public class DataScopeAspect {
}
}
@SuppressWarnings("unchecked")
private static void putDataScope(JoinPoint joinPoint, String sql) {
Object params = joinPoint.getArgs()[0];
if (Validator.isNotNull(params)) {
@ -167,13 +167,8 @@ public class DataScopeAspect {
BaseEntity baseEntity = (BaseEntity) params;
baseEntity.getParams().put(DATA_SCOPE, sql);
} else {
try {
Method getParams = params.getClass().getDeclaredMethod("getParams");
Map<String, Object> invoke = (Map<String, Object>) getParams.invoke(params);
Map<String, Object> invoke = ReflectUtils.invokeGetter(params, "params");
invoke.put(DATA_SCOPE, sql);
} catch (Exception e) {
// 方法未找到 不处理
}
}
}
}

Loading…
Cancel
Save