Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
ba4819f3
"sql/ry_20220808.sql" did not exist on "eab1b450d52782737aad6b0d1bed3e6884ec3a2f"
Commit
ba4819f3
authored
May 18, 2021
by
季圣华
Browse files
权限控制
parent
b2f5ef03
Changes
2
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/controller/UserController.java
View file @
ba4819f3
...
...
@@ -140,8 +140,11 @@ public class UserController {
logService
.
insertLogWithUserId
(
user
.
getId
(),
user
.
getTenantId
(),
"用户"
,
new
StringBuffer
(
BusinessConstants
.
LOG_OPERATION_TYPE_LOGIN
).
append
(
user
.
getLoginName
()).
toString
(),
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
JSONArray
btnStrArr
=
userService
.
getBtnStrArrById
(
user
.
getId
());
data
.
put
(
"token"
,
token
);
data
.
put
(
"user"
,
user
);
//用户的按钮权限
data
.
put
(
"userBtn"
,
btnStrArr
);
}
res
.
code
=
200
;
res
.
data
=
data
;
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/user/UserService.java
View file @
ba4819f3
...
...
@@ -754,4 +754,29 @@ public class UserService {
}
return
userId
;
}
/**
* 用户的按钮权限
* @param userId
* @return
* @throws Exception
*/
public
JSONArray
getBtnStrArrById
(
Long
userId
)
throws
Exception
{
JSONArray
btnStrArr
=
new
JSONArray
();
List
<
UserBusiness
>
userRoleList
=
userBusinessService
.
getBasicData
(
userId
.
toString
(),
"UserRole"
);
if
(
userRoleList
!=
null
&&
userRoleList
.
size
()>
0
)
{
String
roleValue
=
userRoleList
.
get
(
0
).
getValue
();
if
(
StringUtil
.
isNotEmpty
(
roleValue
)
&&
roleValue
.
indexOf
(
"["
)>-
1
&&
roleValue
.
indexOf
(
"]"
)>-
1
){
roleValue
=
roleValue
.
replace
(
"["
,
""
).
replace
(
"]"
,
""
);
//角色id-单个
List
<
UserBusiness
>
roleFunctionsList
=
userBusinessService
.
getBasicData
(
roleValue
,
"RoleFunctions"
);
if
(
roleFunctionsList
!=
null
&&
roleFunctionsList
.
size
()>
0
)
{
String
btnStr
=
roleFunctionsList
.
get
(
0
).
getBtnStr
();
if
(
StringUtil
.
isNotEmpty
(
btnStr
)){
btnStrArr
=
JSONArray
.
parseArray
(
btnStr
);
}
}
}
}
return
btnStrArr
;
}
}
Write
Preview
Supports
Markdown
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