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
1f757947
Commit
1f757947
authored
Sep 20, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限集:菜单树接口:页面&权限项
parent
e0d76db7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
0 deletions
+99
-0
TabSysMenuMapper.java
...c/main/java/com/gic/auth/dao/mapper/TabSysMenuMapper.java
+11
-0
MenuService.java
...rvice/src/main/java/com/gic/auth/service/MenuService.java
+10
-0
MenuServiceImpl.java
.../main/java/com/gic/auth/service/impl/MenuServiceImpl.java
+5
-0
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+10
-0
TabSysMenuMapper.xml
...th-service/src/main/resources/mapper/TabSysMenuMapper.xml
+14
-0
RoleController.java
...main/java/com/gic/auth/web/controller/RoleController.java
+49
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysMenuMapper.java
View file @
1f757947
package
com
.
gic
.
auth
.
dao
.
mapper
;
import
com.gic.auth.dto.AuthItemListDTO
;
import
com.gic.auth.dto.MenuDTO
;
import
com.gic.auth.entity.TabSysMenu
;
import
com.gic.auth.qo.MenuListQO
;
import
com.gic.auth.qo.MenuOperationItemListQO
;
...
...
@@ -134,4 +135,13 @@ public interface TabSysMenuMapper {
* @return int
*/
int
countChildByParentId
(
@Param
(
"menuId"
)
Integer
menuId
);
/**
* 查询菜单树(页面&权限项)
* @Title: listMenuTree
* @Description:
* @author guojuxing
* @param project
* @return java.util.List<com.gic.auth.entity.TabSysMenu>
*/
List
<
TabSysMenu
>
listMenuTree
(
@Param
(
"project"
)
String
project
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/MenuService.java
View file @
1f757947
...
...
@@ -104,4 +104,14 @@ public interface MenuService {
* @return boolean
*/
boolean
isHasChild
(
Integer
menuId
);
/**
* 查询菜单树(页面&权限项)
* @Title: listMenuTree
* @Description:
* @author guojuxing
* @param project
* @return java.util.List<com.gic.auth.dto.MenuDTO>
*/
List
<
TabSysMenu
>
listMenuTree
(
String
project
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/MenuServiceImpl.java
View file @
1f757947
...
...
@@ -120,6 +120,11 @@ public class MenuServiceImpl implements MenuService {
return
false
;
}
@Override
public
List
<
TabSysMenu
>
listMenuTree
(
String
project
)
{
return
tabSysMenuMapper
.
listMenuTree
(
project
);
}
private
void
updateSort
(
Integer
sort
,
Integer
id
)
{
TabSysMenu
record
=
new
TabSysMenu
();
record
.
setMenuId
(
id
);
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
1f757947
...
...
@@ -14,6 +14,7 @@ import com.gic.commons.util.PageHelperUtils;
import
com.gic.open.api.dto.ApplicationDTO
;
import
com.gic.open.api.dto.ServePropDTO
;
import
com.gic.open.api.service.ApplicationApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
...
...
@@ -81,6 +82,15 @@ public class MenuApiServiceImpl implements MenuApiService {
}
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
listMenuTreeForRole
(
String
project
)
{
List
<
TabSysMenu
>
list
=
menuService
.
listMenuTree
(
project
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityListNew
(
MenuDTO
.
class
,
list
));
}
return
ServiceResponse
.
success
(
new
ArrayList
<>());
}
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
listMenuItemByParentId
(
Integer
parentId
)
{
TabSysMenu
record
=
menuService
.
getMenuById
(
parentId
);
if
(
record
==
null
)
{
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysMenuMapper.xml
View file @
1f757947
...
...
@@ -362,4 +362,17 @@
where status = 1
and parent_id = #{menuId}
</select>
<select
id=
"listMenuTree"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_menu
where status=1
<if
test=
"project != null"
>
and project = #{project}
</if>
<include
refid=
"tree_filter"
></include>
order by level,sort
</select>
</mapper>
\ No newline at end of file
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/RoleController.java
View file @
1f757947
package
com
.
gic
.
auth
.
web
.
controller
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.auth.constant.MenuLevelConstants
;
import
com.gic.auth.constant.MenuProjectConstants
;
import
com.gic.auth.qo.MenuListQO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -83,4 +90,46 @@ public class RoleController {
return
EnterpriseRestResponse
.
failure
(
userResponse
);
}
}
/**
* 查询列表数据
* @Title: updateAppPage
* @Description:
* @author guojuxing
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/list-gic-menu-tree"
)
public
RestResponse
listMenuTree
()
{
ServiceResponse
<
List
<
MenuDTO
>>
result
=
menuApiService
.
listMenuTreeForRole
(
MenuProjectConstants
.
DEFAULT_PROJECT
);
if
(
result
.
isSuccess
())
{
return
RestResponse
.
success
(
changeListToTree
(
MenuLevelConstants
.
FIRST_LEVEL_PARENT_ID
,
result
.
getResult
()));
}
return
EnterpriseRestResponse
.
failure
(
result
);
}
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
(
"menuVersionName"
,
menuDTO
.
getMenuVersionName
());
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