Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
aserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
15所TongWeb
aserver
Commits
d1c486e7
Commit
d1c486e7
authored
Dec 11, 2020
by
李德才
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
从Redis中获取用户信息
parent
5df5c176
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
MenuController.java
...n/java/com/archser/aserver/controller/MenuController.java
+4
-2
InfoSystem.java
src/main/java/com/archser/aserver/util/redis/InfoSystem.java
+19
-0
No files found.
src/main/java/com/archser/aserver/controller/MenuController.java
View file @
d1c486e7
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.HashMap
;
import
java.util.LinkedHashMap
;
...
...
@@ -178,13 +180,13 @@ public class MenuController extends Controller {
}
public
void
getMenuGroup
()
{
Integer
userId
=
Db
.
queryInt
(
Db
.
getSql
(
"getUserId"
),
this
.
getAttrForStr
(
"username"
));
String
userName
=
this
.
getAttrForStr
(
"username"
);
Integer
userId
=
InfoUser
.
getUser
(
userName
).
getId
();
List
<
Menu
>
allMenuList
=
null
;
if
(
"admin"
.
equals
(
userName
))
{
allMenuList
=
new
Menu
().
dao
().
template
(
"getMenuAll"
).
find
();
}
else
{
allMenuList
=
new
Menu
().
dao
().
template
(
"getMenuGroup"
,
Kv
.
by
(
"userId"
,
userId
)).
find
();
allMenuList
=
new
Menu
().
dao
().
template
(
"getMenuGroup"
,
Kv
.
by
(
"userId"
,
userId
)).
find
();
}
List
<
System
>
systems
=
System
.
dao
.
template
(
"getSystems"
).
find
();
Map
<
Integer
,
System
>
systemMap
=
systems
.
stream
().
collect
(
Collectors
.
toMap
(
System:
:
getId
,
System
->
System
));
...
...
src/main/java/com/archser/aserver/util/redis/InfoSystem.java
View file @
d1c486e7
...
...
@@ -2,6 +2,11 @@ package com.archser.aserver.util.redis;
import
com.alibaba.fastjson.JSONObject
;
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
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment