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
9edf0a74
Commit
9edf0a74
authored
Mar 24, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应用菜单权限优化:根据菜单code获取对应的菜单
parent
7e95ee25
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
1 deletions
+48
-1
MenuApiService.java
...pi/src/main/java/com/gic/auth/service/MenuApiService.java
+10
-0
TabSysMenuMapper.java
...c/main/java/com/gic/auth/dao/mapper/TabSysMenuMapper.java
+2
-0
MenuService.java
...rvice/src/main/java/com/gic/auth/service/MenuService.java
+3
-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
+9
-0
TabSysMenuMapper.xml
...th-service/src/main/resources/mapper/TabSysMenuMapper.xml
+8
-0
MenuController.java
...main/java/com/gic/auth/web/controller/MenuController.java
+11
-1
No files found.
gic-platform-auth-api/src/main/java/com/gic/auth/service/MenuApiService.java
View file @
9edf0a74
...
...
@@ -350,4 +350,14 @@ public interface MenuApiService {
* @return com.gic.api.base.commons.ServiceResponse<java.util.Map<java.lang.String,java.lang.String>>
*/
ServiceResponse
<
Map
<
String
,
String
>>
getGicDefaultVersion
();
/**
* 根据code查询,因为code唯一
* @Title: getMenuByMenuCode
* @Description:
* @author guojuxing
* @param menuCode
* @return com.gic.api.base.commons.ServiceResponse<com.gic.auth.dto.MenuDTO>
*/
ServiceResponse
<
MenuDTO
>
getMenuByMenuCode
(
String
menuCode
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysMenuMapper.java
View file @
9edf0a74
...
...
@@ -179,6 +179,8 @@ public interface TabSysMenuMapper {
*/
int
countByMenuCode
(
@Param
(
"menuCode"
)
String
menuCode
,
@Param
(
"menuId"
)
Integer
menuId
);
TabSysMenu
getMenuByMenuCode
(
String
menuCode
);
/**
* 批量更新子集的父级code数据,根据父级ID
* @Title: updateParentCodeByParentId
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/MenuService.java
View file @
9edf0a74
...
...
@@ -158,6 +158,9 @@ public interface MenuService {
*/
boolean
isRepeatMenuCode
(
String
code
,
Integer
menuId
);
TabSysMenu
getMenuByMenuCode
(
String
menuCode
);
/**
* 批量更新子集的父级code数据,根据父级ID
* @Title: updateParentCodeByParentId
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/MenuServiceImpl.java
View file @
9edf0a74
...
...
@@ -157,6 +157,11 @@ public class MenuServiceImpl implements MenuService {
}
@Override
public
TabSysMenu
getMenuByMenuCode
(
String
menuCode
)
{
return
tabSysMenuMapper
.
getMenuByMenuCode
(
menuCode
);
}
@Override
public
void
updateParentCodeByParentId
(
Integer
parentId
,
String
parentCode
)
{
tabSysMenuMapper
.
updateParentCodeByParentId
(
parentId
,
parentCode
);
}
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
9edf0a74
...
...
@@ -518,6 +518,15 @@ public class MenuApiServiceImpl implements MenuApiService {
return
ServiceResponse
.
success
(
map
);
}
@Override
public
ServiceResponse
<
MenuDTO
>
getMenuByMenuCode
(
String
menuCode
)
{
TabSysMenu
record
=
menuService
.
getMenuByMenuCode
(
menuCode
);
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"菜单code错误,无数据"
);
}
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityNew
(
MenuDTO
.
class
,
record
));
}
private
ServiceResponse
<
Void
>
savePage
(
MenuDTO
menuDTO
,
Class
clazz
)
{
ServiceResponse
paramsValid
=
ValidParamsUtils
.
allCheckValidate
(
menuDTO
,
clazz
);
if
(!
paramsValid
.
isSuccess
())
{
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysMenuMapper.xml
View file @
9edf0a74
...
...
@@ -491,6 +491,14 @@
</if>
</select>
<select
id=
"getMenuByMenuCode"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
></include>
from tab_sys_menu
where status = 1
and menu_code = #{menuCode}
limit 1
</select>
<update
id=
"updateParentCodeByParentId"
>
update tab_sys_menu set parent_code = #{parentCode}
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/MenuController.java
View file @
9edf0a74
...
...
@@ -9,6 +9,7 @@ import com.gic.commons.util.EntityUtil;
import
com.gic.enterprise.ano.IgnoreLogin
;
import
com.gic.enterprise.utils.UserDetail
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -69,9 +70,18 @@ public class MenuController {
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"login-user-menu-of-app"
)
public
RestResponse
loginUserMenu
(
Integer
currentMenu
,
String
appId
)
{
public
RestResponse
loginUserMenu
(
Integer
currentMenu
,
String
appId
,
String
menuCode
)
{
LOGGER
.
info
(
"查询登录用户的应用的菜单参数:{}-{}-{}"
,
currentMenu
,
appId
,
menuCode
);
Integer
userId
=
UserDetailUtils
.
getUserDetail
().
getUserId
();
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
if
(
StringUtils
.
isBlank
(
appId
))
{
//根据menuCode去查询对应的appId
ServiceResponse
<
MenuDTO
>
menuDTOServiceResponse
=
menuApiService
.
getMenuByMenuCode
(
menuCode
);
if
(
menuDTOServiceResponse
.
isSuccess
())
{
MenuDTO
tempDTO
=
menuDTOServiceResponse
.
getResult
();
appId
=
tempDTO
.
getProject
();
}
}
ServiceResponse
<
List
<
MenuDTO
>>
userMenu
=
this
.
menuApiService
.
getUserMenuOfApp
(
enterpriseId
,
userId
,
currentMenu
,
appId
);
if
(
userMenu
.
isSuccess
())
{
...
...
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