Commit d1c486e7 authored by 李德才's avatar 李德才

从Redis中获取用户信息

parent 5df5c176
package com.archser.aserver.controller; package com.archser.aserver.controller;
import com.archser.aserver.util.redis.InfoSystem;
import com.archser.aserver.util.redis.InfoUser;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
...@@ -178,8 +180,8 @@ public class MenuController extends Controller { ...@@ -178,8 +180,8 @@ public class MenuController extends Controller {
} }
public void getMenuGroup() { public void getMenuGroup() {
Integer userId = Db.queryInt(Db.getSql("getUserId"), this.getAttrForStr("username"));
String userName = this.getAttrForStr("username"); String userName = this.getAttrForStr("username");
Integer userId = InfoUser.getUser(userName).getId();
List<Menu> allMenuList=null ; List<Menu> allMenuList=null ;
if("admin".equals(userName)) { if("admin".equals(userName)) {
allMenuList = new Menu().dao().template("getMenuAll").find(); allMenuList = new Menu().dao().template("getMenuAll").find();
......
...@@ -2,6 +2,11 @@ package com.archser.aserver.util.redis; ...@@ -2,6 +2,11 @@ package com.archser.aserver.util.redis;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.archser.aserver.model.System; import com.archser.aserver.model.System;
import com.jfinal.plugin.redis.Redis;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/** /**
* 获取系统信息 20201126 lidecai * 获取系统信息 20201126 lidecai
...@@ -40,6 +45,20 @@ public class InfoSystem { ...@@ -40,6 +45,20 @@ public class InfoSystem {
/** /**
* 获取所有系统
* @return
*/
public static List<System> getAllSystem() {
Set<String> keys = Redis.use().keys(SYSTEM + "*");
List<System> systemList = new ArrayList<System>();
keys.forEach(system -> {
systemList.add(JSONObject
.parseObject(JSONObject.toJSONString(Redis.use().hgetAll(system)), System.class));
});
return systemList;
}
/**
* 保存系统信息 * 保存系统信息
* *
* @param system * @param system
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment