Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
Overview
Overview
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
base_platform_enterprise
gic-platform-auth
Commits
cb02cd7c
Commit
cb02cd7c
authored
Sep 17, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜单权限管理接口:页面、子页面
parent
5e7111a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
8 deletions
+44
-8
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+1
-1
MenuController.java
...main/java/com/gic/auth/web/controller/MenuController.java
+43
-7
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
cb02cd7c
...
...
@@ -51,7 +51,7 @@ public class MenuApiServiceImpl implements MenuApiService {
public
ServiceResponse
<
List
<
MenuDTO
>>
listMenuTree
(
MenuListQO
params
)
{
params
.
setMenuType
(
MenuTypeEnum
.
PAGE
.
getCode
());
List
<
TabSysMenu
>
menuList
=
this
.
menuService
.
listMenu
(
params
);
return
ServiceResponse
.
success
(
this
.
treeMenu
(
menuList
,
1
,
0
));
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityListNew
(
MenuDTO
.
class
,
menuList
));
}
@Override
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/MenuController.java
View file @
cb02cd7c
package
com
.
gic
.
auth
.
web
.
controller
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.gic.auth.constant.MenuLevelConstants
;
import
org.apache.dubbo.rpc.RpcContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.MenuDTO
;
...
...
@@ -9,12 +20,7 @@ import com.gic.commons.webapi.reponse.RestResponse;
import
com.gic.enterprise.response.EnterpriseRestResponse
;
import
com.gic.enterprise.utils.ResultControllerUtils
;
import
com.gic.enterprise.utils.UserDetailUtils
;
import
org.apache.dubbo.rpc.RpcContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
com.gic.store.dto.StoreGroupDTO
;
@RestController
public
class
MenuController
{
...
...
@@ -95,7 +101,11 @@ public class MenuController {
*/
@RequestMapping
(
"/list-menu-tree"
)
public
RestResponse
listMenuTree
(
MenuListQO
params
)
{
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
listMenuTree
(
params
));
ServiceResponse
<
List
<
MenuDTO
>>
result
=
menuApiService
.
listMenuTree
(
params
);
if
(
result
.
isSuccess
())
{
return
RestResponse
.
success
(
changeListToTree
(
MenuLevelConstants
.
FIRST_LEVEL_PARENT_ID
,
result
.
getResult
()));
}
return
EnterpriseRestResponse
.
failure
(
result
);
}
/**
* 查询页面下面的权限项列表数据
...
...
@@ -109,4 +119,30 @@ public class MenuController {
public
RestResponse
listMenuRole
(
Integer
parentId
)
{
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
listMenuRoleByParentId
(
parentId
));
}
public
static
List
<
Map
<
String
,
Object
>>
changeListToTree
(
int
storeGroupId
,
List
<
MenuDTO
>
list
)
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
if
(
list
!=
null
)
{
for
(
MenuDTO
menuDTO
:
list
)
{
if
(
storeGroupId
==
menuDTO
.
getParentId
()
&&
menuDTO
.
getIsShow
().
intValue
()
==
1
)
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>(
16
);
data
.
put
(
"menuId"
,
menuDTO
.
getMenuId
());
data
.
put
(
"menuName"
,
menuDTO
.
getMenuName
());
data
.
put
(
"project"
,
menuDTO
.
getProject
());
data
.
put
(
"sort"
,
menuDTO
.
getSort
());
data
.
put
(
"menuCode"
,
menuDTO
.
getMenuCode
());
data
.
put
(
"parentCode"
,
menuDTO
.
getParentCode
());
data
.
put
(
"menuVersion"
,
menuDTO
.
getMenuVersion
());
List
<
Map
<
String
,
Object
>>
children
=
changeListToTree
(
menuDTO
.
getMenuId
(),
list
);
if
(
children
==
null
||
children
.
size
()
<
1
)
{
data
.
put
(
"children"
,
null
);
}
else
{
data
.
put
(
"children"
,
children
);
}
result
.
add
(
data
);
}
}
}
return
result
;
}
}
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