Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bill-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
bill-platform
Commits
9faae60a
Commit
9faae60a
authored
8 months ago
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加菜单资源配置
parent
9e26c8a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
4 deletions
+27
-4
bill-manager/src/main/java/com/mortals/xhx/base/system/role/service/impl/RoleAuthServiceImpl.java
...hx/base/system/role/service/impl/RoleAuthServiceImpl.java
+27
-4
No files found.
bill-manager/src/main/java/com/mortals/xhx/base/system/role/service/impl/RoleAuthServiceImpl.java
View file @
9faae60a
...
...
@@ -8,6 +8,7 @@
package
com.mortals.xhx.base.system.role.service.impl
;
import
cn.hutool.core.util.StrUtil
;
import
com.mortals.framework.exception.AppException
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.service.ICacheService
;
...
...
@@ -109,10 +110,26 @@ public class RoleAuthServiceImpl extends AbstractCRUDServiceImpl<RoleAuthDao, Ro
List
<
RoleAuthEntity
>
list
=
new
ArrayList
<>();
for
(
Long
menuId
:
query
.
getMenuIdList
())
{
RoleAuthEntity
entity
=
new
RoleAuthEntity
();
entity
.
setRoleId
(
roleId
);
entity
.
setMenuId
(
menuId
);
list
.
add
(
entity
);
//todo 一个菜单可以对应多个资源
MenuEntity
menuEntity
=
menuService
.
get
(
menuId
,
context
);
if
(!
ObjectUtils
.
isEmpty
(
menuEntity
)){
String
perms
=
menuEntity
.
getPerms
();
if
(!
ObjectUtils
.
isEmpty
(
perms
)){
List
<
String
>
split
=
StrUtil
.
split
(
perms
,
","
);
for
(
String
s
:
split
)
{
RoleAuthEntity
entity
=
new
RoleAuthEntity
();
entity
.
setRoleId
(
roleId
);
entity
.
setMenuId
(
menuId
);
entity
.
setResourceId
(
DataUtil
.
converStr2Long
(
s
,
0L
));
list
.
add
(
entity
);
}
}
else
{
RoleAuthEntity
entity
=
new
RoleAuthEntity
();
entity
.
setRoleId
(
roleId
);
entity
.
setMenuId
(
menuId
);
list
.
add
(
entity
);
}
}
}
this
.
dao
.
insertBatch
(
list
);
List
<
Long
>
userIdList
=
roleUserService
.
find
(
new
RoleUserQuery
().
roleId
(
query
.
getRoleId
())).
stream
()
...
...
@@ -149,4 +166,10 @@ public class RoleAuthServiceImpl extends AbstractCRUDServiceImpl<RoleAuthDao, Ro
}
}
public
static
void
main
(
String
[]
args
)
{
String
s
=
"1"
;
System
.
out
.
println
(
StrUtil
.
split
(
s
,
","
));
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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