【fix sonar】JeroDataAutorUtils文件
This commit is contained in:
+17
-13
@@ -14,28 +14,32 @@ import java.util.List;
|
||||
* @Description: 数据权限查询规则容器工具类
|
||||
* @Author: 张代浩
|
||||
* @Date: 2012-12-15 下午11:27:39
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class JeroDataAutorUtils {
|
||||
|
||||
|
||||
private JeroDataAutorUtils(){
|
||||
|
||||
}
|
||||
|
||||
public static final String MENU_DATA_AUTHOR_RULES = "MENU_DATA_AUTHOR_RULES";
|
||||
|
||||
|
||||
public static final String MENU_DATA_AUTHOR_RULE_SQL = "MENU_DATA_AUTHOR_RULE_SQL";
|
||||
|
||||
|
||||
public static final String SYS_USER_INFO = "SYS_USER_INFO";
|
||||
|
||||
/**
|
||||
* 往链接请求里面,传入数据查询条件
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
* @param dataRules
|
||||
*/
|
||||
public static synchronized void installDataSearchConditon(HttpServletRequest request, List<SysPermissionDataRuleModel> dataRules) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<SysPermissionDataRuleModel> list = (List<SysPermissionDataRuleModel>)loadDataSearchConditon();// 1.先从request获取MENU_DATA_AUTHOR_RULES,如果存则获取到LIST
|
||||
List<SysPermissionDataRuleModel> list = loadDataSearchConditon();// 1.先从request获取MENU_DATA_AUTHOR_RULES,如果存则获取到LIST
|
||||
if (list==null) {
|
||||
// 2.如果不存在,则new一个list
|
||||
list = new ArrayList<SysPermissionDataRuleModel>();
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
for (SysPermissionDataRuleModel tsDataRule : dataRules) {
|
||||
list.add(tsDataRule);
|
||||
@@ -45,18 +49,18 @@ public class JeroDataAutorUtils {
|
||||
|
||||
/**
|
||||
* 获取请求对应的数据权限规则
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static synchronized List<SysPermissionDataRuleModel> loadDataSearchConditon() {
|
||||
return (List<SysPermissionDataRuleModel>) SpringContextUtils.getHttpServletRequest().getAttribute(MENU_DATA_AUTHOR_RULES);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求对应的数据权限SQL
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static synchronized String loadDataSearchConditonSQLString() {
|
||||
@@ -65,12 +69,12 @@ public class JeroDataAutorUtils {
|
||||
|
||||
/**
|
||||
* 往链接请求里面,传入数据查询条件
|
||||
*
|
||||
*
|
||||
* @param request
|
||||
* @param sql
|
||||
*/
|
||||
public static synchronized void installDataSearchConditon(HttpServletRequest request, String sql) {
|
||||
String ruleSql = (String)loadDataSearchConditonSQLString();
|
||||
String ruleSql = loadDataSearchConditonSQLString();
|
||||
if (!StringUtils.hasText(ruleSql)) {
|
||||
request.setAttribute(MENU_DATA_AUTHOR_RULE_SQL,sql);
|
||||
}
|
||||
@@ -99,6 +103,6 @@ public class JeroDataAutorUtils {
|
||||
*/
|
||||
public static synchronized SysUserCacheInfo loadUserInfo() {
|
||||
return (SysUserCacheInfo) SpringContextUtils.getHttpServletRequest().getAttribute(SYS_USER_INFO);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user