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
2a223ab3
Commit
2a223ab3
authored
Sep 09, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加菜单资源配置
parent
c5a16c5f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
8 deletions
+66
-8
bill-manager/src/main/java/com/mortals/xhx/base/system/menu/web/MenuController.java
.../com/mortals/xhx/base/system/menu/web/MenuController.java
+1
-1
bill-manager/src/main/java/com/mortals/xhx/base/system/resource/model/vo/ResourceVo.java
...mortals/xhx/base/system/resource/model/vo/ResourceVo.java
+4
-0
bill-manager/src/main/java/com/mortals/xhx/base/system/resource/web/ResourceController.java
...tals/xhx/base/system/resource/web/ResourceController.java
+61
-7
No files found.
bill-manager/src/main/java/com/mortals/xhx/base/system/menu/web/MenuController.java
View file @
2a223ab3
...
...
@@ -147,7 +147,7 @@ public class MenuController extends BaseCRUDJsonBodyMappingController<MenuServic
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
()
+
"子节点"
;
try
{
List
<
MenuTreeSelect
>
treeList
=
this
.
service
.
getListByParentId
(
parentId
,
getContext
());
model
.
put
(
RESULT_KEY
,
treeList
);
model
.
put
(
KEY_RESULT_DATA
,
treeList
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_DATA
,
model
);
recordSysLog
(
request
,
busiDesc
+
"【成功】"
);
...
...
bill-manager/src/main/java/com/mortals/xhx/base/system/resource/model/vo/ResourceVo.java
View file @
2a223ab3
...
...
@@ -19,5 +19,9 @@ public class ResourceVo extends BaseEntityLong {
/** 菜单ID,主键,自增长列表 */
private
List
<
Long
>
idList
;
private
Integer
checked
=
0
;
private
Long
roleId
;
}
\ No newline at end of file
bill-manager/src/main/java/com/mortals/xhx/base/system/resource/web/ResourceController.java
View file @
2a223ab3
...
...
@@ -10,20 +10,27 @@ import com.mortals.framework.exception.AppException;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.model.OrderCol
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.base.system.menu.model.MenuTreeSelect
;
import
com.mortals.xhx.base.system.resource.model.ResourceEntity
;
import
com.mortals.xhx.base.system.resource.model.ResourceQuery
;
import
com.mortals.xhx.base.system.resource.service.ResourceService
;
import
com.mortals.xhx.base.system.role.model.RoleAuthEntity
;
import
com.mortals.xhx.base.system.role.model.RoleAuthQuery
;
import
com.mortals.xhx.base.system.role.service.RoleAuthService
;
import
com.mortals.xhx.common.code.AuthType
;
import
com.mortals.xhx.common.code.SourceType
;
import
com.mortals.xhx.common.code.YesNoEnum
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.
springframework.web.bind.annotation.PostMapping
;
import
org.springframework.
web.bind.annotation.RequestMapping
;
import
org.springframework.
web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.
RestController
;
import
org.
checkerframework.checker.units.qual.A
;
import
org.springframework.
beans.factory.annotation.Autowired
;
import
org.springframework.
util.ObjectUtils
;
import
org.springframework.web.bind.annotation.
*
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.
RESULT_KEY
;
/**
* 资源信息
...
...
@@ -36,6 +43,9 @@ import java.util.Map;
@RequestMapping
(
"resource"
)
public
class
ResourceController
extends
BaseCRUDJsonBodyMappingController
<
ResourceService
,
ResourceEntity
,
Long
>
{
@Autowired
private
RoleAuthService
roleAuthService
;
public
ResourceController
()
{
super
.
setModuleDesc
(
"资源信息"
);
}
...
...
@@ -79,4 +89,48 @@ public class ResourceController extends BaseCRUDJsonBodyMappingController<Resour
return
rest
;
}
/**
* 分组显示
*/
@ApiOperation
(
value
=
"分组列表"
)
@PostMapping
(
value
=
"group"
)
@UnAuth
public
String
group
(
@RequestBody
ResourceQuery
query
)
{
JSONObject
ret
=
new
JSONObject
();
Map
<
String
,
Object
>
model
=
new
HashMap
<>();
String
busiDesc
=
"查询"
+
this
.
getModuleDesc
()
+
"子节点"
;
try
{
if
(!
ObjectUtils
.
isEmpty
(
query
.
getRoleId
()))
{
List
<
RoleAuthEntity
>
roleAuthEntities
=
roleAuthService
.
find
(
new
RoleAuthQuery
().
roleId
(
query
.
getRoleId
()));
Set
<
Long
>
collect
=
roleAuthEntities
.
stream
()
.
filter
(
f
->
f
.
getMenuId
()
==
null
)
.
map
(
m
->
m
.
getResourceId
())
.
collect
(
Collectors
.
toSet
());
Map
<
String
,
List
<
ResourceEntity
>>
group
=
this
.
service
.
find
(
new
ResourceQuery
(),
getContext
()).
stream
()
.
map
(
m
->
{
if
(
collect
.
contains
(
m
.
getId
()))
{
m
.
setChecked
(
YesNoEnum
.
YES
.
getValue
());
}
return
m
;
})
.
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getGroupName
()));
model
.
put
(
KEY_RESULT_DATA
,
group
);
}
else
{
Map
<
String
,
List
<
ResourceEntity
>>
group
=
this
.
service
.
find
(
new
ResourceQuery
(),
getContext
()).
stream
()
.
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getGroupName
()));
model
.
put
(
KEY_RESULT_DATA
,
group
);
}
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
ret
.
put
(
KEY_RESULT_DATA
,
model
);
recordSysLog
(
request
,
busiDesc
+
"【成功】"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"分组列表错误"
,
e
);
this
.
doException
(
request
,
busiDesc
,
model
,
e
);
ret
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
ret
.
put
(
KEY_RESULT_MSG
,
e
.
getMessage
());
}
return
ret
.
toJSONString
();
}
}
\ No newline at end of file
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