Search in sources :

Example 16 with SysPermissionDataRuleModel

use of org.jeecg.common.system.vo.SysPermissionDataRuleModel in project kykms 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();
}
Also used : SysPermissionDataRuleModel(org.jeecg.common.system.vo.SysPermissionDataRuleModel)

Example 17 with SysPermissionDataRuleModel

use of org.jeecg.common.system.vo.SysPermissionDataRuleModel in project kykms by mahonelau.

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);
}
Also used : SysPermissionDataRuleModel(org.jeecg.common.system.vo.SysPermissionDataRuleModel) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

SysPermissionDataRuleModel (org.jeecg.common.system.vo.SysPermissionDataRuleModel)17 PropertyDescriptor (java.beans.PropertyDescriptor)3 Method (java.lang.reflect.Method)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 Around (org.aspectj.lang.annotation.Around)3 MethodSignature (org.aspectj.lang.reflect.MethodSignature)3 PermissionData (org.jeecg.common.aspect.annotation.PermissionData)3 SysUserCacheInfo (org.jeecg.common.system.vo.SysUserCacheInfo)3