use of org.jeecg.common.system.vo.SysPermissionDataRuleModel in project jeecg-boot by jeecgboot.
the class QueryGenerator method getRuleMap.
/**
* 获取请求对应的数据权限规则 TODO 相同列权限多个 有问题
* @return
*/
public static Map<String, SysPermissionDataRuleModel> getRuleMap() {
Map<String, SysPermissionDataRuleModel> ruleMap = new HashMap<String, SysPermissionDataRuleModel>();
List<SysPermissionDataRuleModel> list = JeecgDataAutorUtils.loadDataSearchConditon();
if (list != null && list.size() > 0) {
if (list.get(0) == null) {
return ruleMap;
}
for (SysPermissionDataRuleModel rule : list) {
String column = rule.getRuleColumn();
if (QueryRuleEnum.SQL_RULES.getValue().equals(rule.getRuleConditions())) {
column = SQL_RULES_COLUMN + rule.getId();
}
ruleMap.put(column, rule);
}
}
return ruleMap;
}
use of org.jeecg.common.system.vo.SysPermissionDataRuleModel in project jeecg-boot by jeecgboot.
the class JeecgDataAutorUtils method installDataSearchConditon.
/**
* 往链接请求里面,传入数据查询条件
*
* @param request
* @param dataRules
*/
public static synchronized void installDataSearchConditon(HttpServletRequest request, List<SysPermissionDataRuleModel> dataRules) {
@SuppressWarnings("unchecked") List<SysPermissionDataRuleModel> // 1.先从request获取MENU_DATA_AUTHOR_RULES,如果存则获取到LIST
list = (List<SysPermissionDataRuleModel>) loadDataSearchConditon();
if (list == null) {
// 2.如果不存在,则new一个list
list = new ArrayList<SysPermissionDataRuleModel>();
}
for (SysPermissionDataRuleModel tsDataRule : dataRules) {
list.add(tsDataRule);
}
// 3.往list里面增量存指
request.setAttribute(MENU_DATA_AUTHOR_RULES, list);
}
use of org.jeecg.common.system.vo.SysPermissionDataRuleModel in project kms by mahonelau.
the class QueryGenerator method getRuleMap.
/**
* 获取请求对应的数据权限规则
* @return
*/
public static Map<String, SysPermissionDataRuleModel> getRuleMap() {
Map<String, SysPermissionDataRuleModel> ruleMap = new HashMap<String, SysPermissionDataRuleModel>();
List<SysPermissionDataRuleModel> list = JeecgDataAutorUtils.loadDataSearchConditon();
if (list != null && list.size() > 0) {
if (list.get(0) == null) {
return ruleMap;
}
for (SysPermissionDataRuleModel rule : list) {
String column = rule.getRuleColumn();
if (QueryRuleEnum.SQL_RULES.getValue().equals(rule.getRuleConditions())) {
column = SQL_RULES_COLUMN + rule.getId();
}
ruleMap.put(column, rule);
}
}
return ruleMap;
}
use of org.jeecg.common.system.vo.SysPermissionDataRuleModel in project kms by mahonelau.
the class QueryGenerator method getAllConfigAuth.
/**
* 获取所有配置的权限 返回sql字符串 不受字段限制 配置什么就拿到什么
* @return
*/
public static String getAllConfigAuth() {
StringBuffer sb = new StringBuffer();
// 权限查询
Map<String, SysPermissionDataRuleModel> ruleMap = getRuleMap();
String sql_and = " and ";
for (String c : ruleMap.keySet()) {
SysPermissionDataRuleModel dataRule = ruleMap.get(c);
String ruleValue = dataRule.getRuleValue();
if (oConvertUtils.isEmpty(ruleValue)) {
continue;
}
if (oConvertUtils.isNotEmpty(c) && c.startsWith(SQL_RULES_COLUMN)) {
sb.append(sql_and + getSqlRuleValue(ruleValue));
} else {
boolean isString = false;
ruleValue = ruleValue.trim();
if (ruleValue.startsWith("'") && ruleValue.endsWith("'")) {
isString = true;
ruleValue = ruleValue.substring(1, ruleValue.length() - 1);
}
QueryRuleEnum rule = QueryRuleEnum.getByValue(dataRule.getRuleConditions());
String value = converRuleValue(ruleValue);
String filedSql = getSingleSqlByRule(rule, c, value, isString);
sb.append(sql_and + filedSql);
}
}
log.debug("query auth sql is = " + sb.toString());
return sb.toString();
}
use of org.jeecg.common.system.vo.SysPermissionDataRuleModel in project kms by mahonelau.
the class QueryGenerator method getRuleMap.
/**
* 获取请求对应的数据权限规则
* @return
*/
public static Map<String, SysPermissionDataRuleModel> getRuleMap(List<SysPermissionDataRuleModel> list) {
Map<String, SysPermissionDataRuleModel> ruleMap = new HashMap<String, SysPermissionDataRuleModel>();
if (list == null) {
list = JeecgDataAutorUtils.loadDataSearchConditon();
}
if (list != null && list.size() > 0) {
if (list.get(0) == null) {
return ruleMap;
}
for (SysPermissionDataRuleModel rule : list) {
String column = rule.getRuleColumn();
if (QueryRuleEnum.SQL_RULES.getValue().equals(rule.getRuleConditions())) {
column = SQL_RULES_COLUMN + rule.getId();
}
ruleMap.put(column, rule);
}
}
return ruleMap;
}
Aggregations