!4 同步develop分支
* fix -- 修改获取流程节点信息接口(供前端渲染流程跟踪图着色使用) * fix -- 修复流程跟踪着色问题 * fix -- 采用ProcessViewer组件显示流程跟踪信息 * fix -- 整合表单设计代码 * fix -- 简易实现用户任务选择用户下拉框内容 * fix -- 修改项目介绍及sql文件 * del -- 移除未使用的文件 * fix -- 修复组件无法显示和修改的问题 * add -- 整合 Rtony/RuoYi-flowable 工作流 * add -- 添加process-designer流程设计插件 * !3 同步ruoyi-vue-plus更新 * !2 登录认证用户信息添加nickName字段(流程任务需要使用到)
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
package com.ruoyi.common.helper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据权限助手
|
||||
*
|
||||
* @author Lion Li
|
||||
* @version 3.5.0
|
||||
*/
|
||||
@SuppressWarnings("unchecked cast")
|
||||
public class DataPermissionHelper {
|
||||
|
||||
private static final String DATA_PERMISSION_KEY = "data:permission";
|
||||
|
||||
public static <T> T getVariable(String key) {
|
||||
Map<String, Object> context = getContext();
|
||||
return (T) context.get(key);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void setVariable(String key, Object value) {
|
||||
Map<String, Object> context = getContext();
|
||||
context.put(key, value);
|
||||
}
|
||||
|
||||
public static Map<String, Object> getContext() {
|
||||
HttpServletRequest request = ServletUtils.getRequest();
|
||||
Object attribute = request.getAttribute(DATA_PERMISSION_KEY);
|
||||
if (ObjectUtil.isNull(attribute)) {
|
||||
request.setAttribute(DATA_PERMISSION_KEY, new HashMap<>());
|
||||
attribute = request.getAttribute(DATA_PERMISSION_KEY);
|
||||
}
|
||||
if (attribute instanceof Map) {
|
||||
return (Map<String, Object>) attribute;
|
||||
}
|
||||
throw new NullPointerException("data permission context type exception");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user