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
5e7111a9
Commit
5e7111a9
authored
Sep 17, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜单权限管理接口:页面、子页面
parent
0384d7b0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
503 additions
and
39 deletions
+503
-39
TabSysMenuMapper.java
...c/main/java/com/gic/auth/dao/mapper/TabSysMenuMapper.java
+32
-1
TabSysMenu.java
...service/src/main/java/com/gic/auth/entity/TabSysMenu.java
+54
-1
MenuService.java
...rvice/src/main/java/com/gic/auth/service/MenuService.java
+43
-1
MenuServiceImpl.java
.../main/java/com/gic/auth/service/impl/MenuServiceImpl.java
+43
-9
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+154
-22
TabSysMenuMapper.xml
...th-service/src/main/resources/mapper/TabSysMenuMapper.xml
+98
-5
MenuController.java
...main/java/com/gic/auth/web/controller/MenuController.java
+79
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysMenuMapper.java
View file @
5e7111a9
package
com
.
gic
.
auth
.
dao
.
mapper
;
import
com.gic.auth.entity.TabSysMenu
;
import
com.gic.auth.qo.MenuListQO
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -53,5 +55,33 @@ public interface TabSysMenuMapper {
*/
int
updateByPrimaryKey
(
TabSysMenu
record
);
List
<
TabSysMenu
>
listMenu
();
/**
* 查询菜单树(页面、子页面、权限项)
* @Title: listMenu
* @Description:
* @author guojuxing
* @param params
* @return java.util.List<com.gic.auth.entity.TabSysMenu>
*/
List
<
TabSysMenu
>
listMenu
(
MenuListQO
params
);
/**
* 获取最大排序值
* @Title: getMaxSortByParentId
* @Description:
* @author guojuxing
* @param parentId 父级ID
* @param project
* @return int
*/
int
getMaxSortByParentId
(
@Param
(
"parentId"
)
Integer
parentId
,
@Param
(
"project"
)
String
project
);
/**
* 查询页面下的权限项列表数据
* @Title: listMenuRoleByParentId
* @Description:
* @author guojuxing
* @param parentId
* @return java.util.List<com.gic.auth.entity.TabSysMenu>
*/
List
<
TabSysMenu
>
listMenuRoleByParentId
(
@Param
(
"parentId"
)
Integer
parentId
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/entity/TabSysMenu.java
View file @
5e7111a9
...
...
@@ -17,7 +17,7 @@ public class TabSysMenu {
private
String
menuName
;
/**
*
所在项目
*
应用项目 默认gic / 应用市场的appID
*/
private
String
project
;
...
...
@@ -71,6 +71,26 @@ public class TabSysMenu {
*/
private
Integer
isShow
;
/**
* 页面code
*/
private
String
menuCode
;
/**
* 父级code
*/
private
String
parentCode
;
/**
* 多选,例如_1_2_格式,如果是GIC菜单 1gic标准版 2gic集团版;如果是应用菜单 1:基础班 2:高级版
*/
private
String
menuVersion
;
/**
* 0:页面 1:权限项 2:操作项
*/
private
Integer
menuType
;
public
Integer
getMenuId
()
{
return
menuId
;
}
...
...
@@ -174,4 +194,36 @@ public class TabSysMenu {
public
void
setIsShow
(
Integer
isShow
)
{
this
.
isShow
=
isShow
;
}
public
String
getMenuCode
()
{
return
menuCode
;
}
public
void
setMenuCode
(
String
menuCode
)
{
this
.
menuCode
=
menuCode
;
}
public
String
getParentCode
()
{
return
parentCode
;
}
public
void
setParentCode
(
String
parentCode
)
{
this
.
parentCode
=
parentCode
;
}
public
String
getMenuVersion
()
{
return
menuVersion
;
}
public
void
setMenuVersion
(
String
menuVersion
)
{
this
.
menuVersion
=
menuVersion
;
}
public
Integer
getMenuType
()
{
return
menuType
;
}
public
void
setMenuType
(
Integer
menuType
)
{
this
.
menuType
=
menuType
;
}
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/MenuService.java
View file @
5e7111a9
package
com
.
gic
.
auth
.
service
;
import
com.gic.auth.dto.MenuDTO
;
import
com.gic.auth.entity.TabSysMenu
;
import
com.gic.auth.qo.MenuListQO
;
import
java.util.List
;
public
interface
MenuService
{
List
<
TabSysMenu
>
listMenu
();
List
<
TabSysMenu
>
listMenu
(
MenuListQO
params
);
TabSysMenu
getMenuById
(
Integer
menuId
);
/**
* 新增页面
* @Title: savePage
* @Description:
* @author guojuxing
* @param menuDTO
* @return void
*/
void
savePage
(
MenuDTO
menuDTO
);
/**
* 获取当前最大排序值
* @Title: getMaxSortByParentIdAndLevel
* @Description:
* @author guojuxing
* @param parentId 父级ID
* @param project
* @return int
*/
int
getMaxSortByParentId
(
Integer
parentId
,
String
project
);
/**
* @Title: updatePage
* @Description:
* @author guojuxing
* @param menuDTO
* @return void
*/
void
updatePage
(
MenuDTO
menuDTO
);
/**
* 查询页面下面的权限项列表数据
* @Title: listMenuRoleByParentId
* @Description:
* @author guojuxing
* @param parentId
* @return java.util.List<com.gic.auth.entity.TabSysMenu>
*/
List
<
TabSysMenu
>
listMenuRoleByParentId
(
Integer
parentId
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/MenuServiceImpl.java
View file @
5e7111a9
package
com
.
gic
.
auth
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.auth.dao.mapper.TabSysMenuMapper
;
import
com.gic.auth.entity.TabSysMenu
;
import
com.gic.auth.service.MenuService
;
import
org.apache.
dubbo.rpc.RpcContext
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
org.apache.
commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
com.gic.auth.dao.mapper.TabSysMenuMapper
;
import
com.gic.auth.dto.MenuDTO
;
import
com.gic.auth.entity.TabSysMenu
;
import
com.gic.auth.qo.MenuListQO
;
import
com.gic.auth.service.MenuService
;
import
com.gic.commons.util.EntityUtil
;
@Service
(
"menuService"
)
public
class
MenuServiceImpl
implements
MenuService
{
@Autowired
private
TabSysMenuMapper
tabSysMenuMapper
;
@Override
public
List
<
TabSysMenu
>
listMenu
()
{
System
.
out
.
println
(
"menuService:"
+
JSON
.
toJSONString
(
RpcContext
.
getContext
().
getAttachments
()));
return
this
.
tabSysMenuMapper
.
listMenu
();
public
List
<
TabSysMenu
>
listMenu
(
MenuListQO
params
)
{
return
this
.
tabSysMenuMapper
.
listMenu
(
params
);
}
@Override
public
TabSysMenu
getMenuById
(
Integer
menuId
)
{
return
this
.
tabSysMenuMapper
.
selectByPrimaryKey
(
menuId
);
}
@Override
public
void
savePage
(
MenuDTO
menuDTO
)
{
TabSysMenu
record
=
EntityUtil
.
changeEntityNew
(
TabSysMenu
.
class
,
menuDTO
);
record
.
setCreateTime
(
new
Date
());
record
.
setUpdateTime
(
new
Date
());
record
.
setStatus
(
1
);
tabSysMenuMapper
.
insertSelective
(
record
);
}
@Override
public
int
getMaxSortByParentId
(
Integer
parentId
,
String
project
)
{
return
tabSysMenuMapper
.
getMaxSortByParentId
(
parentId
,
project
);
}
@Override
public
void
updatePage
(
MenuDTO
menuDTO
)
{
TabSysMenu
record
=
EntityUtil
.
changeEntityNew
(
TabSysMenu
.
class
,
menuDTO
);
record
.
setUpdateTime
(
new
Date
());
tabSysMenuMapper
.
updateByPrimaryKeySelective
(
record
);
}
@Override
public
List
<
TabSysMenu
>
listMenuRoleByParentId
(
Integer
parentId
)
{
List
<
TabSysMenu
>
list
=
tabSysMenuMapper
.
listMenuRoleByParentId
(
parentId
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
list
;
}
return
new
ArrayList
<>();
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
5e7111a9
package
com
.
gic
.
auth
.
service
.
outer
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.constant.MenuLevelConstants
;
import
com.gic.auth.constant.MenuProjectConstants
;
import
com.gic.auth.constant.MenuTypeEnum
;
import
com.gic.auth.dto.MenuDTO
;
import
com.gic.auth.entity.TabSysMenu
;
import
com.gic.auth.qo.MenuListQO
;
import
com.gic.auth.service.AuthCodeApiService
;
import
com.gic.auth.service.MenuApiService
;
import
com.gic.auth.service.MenuService
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.enterprise.utils.UserDetailUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.dubbo.rpc.RpcContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.utils.valid.ValidParamsUtils
;
@Service
(
"menuApiService"
)
public
class
MenuApiServiceImpl
implements
MenuApiService
{
...
...
@@ -24,19 +26,19 @@ public class MenuApiServiceImpl implements MenuApiService {
private
MenuService
menuService
;
@Autowired
private
AuthCodeApiService
authCodeApiService
;
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
getUserMenu
(
Integer
userId
,
Integer
enterpriseId
,
Integer
currentMenu
)
{
M
ap
<
String
,
String
>
attachments
=
RpcContext
.
getContext
().
getAttachments
();
System
.
out
.
println
(
"menuApiService:"
+
JSON
.
toJSONString
(
attachments
));
List
<
TabSysMenu
>
menuList
=
this
.
menuService
.
listMenu
();
M
enuListQO
params
=
new
MenuListQO
();
params
.
setMenuType
(
MenuTypeEnum
.
PAGE
.
getCode
(
));
List
<
TabSysMenu
>
menuList
=
this
.
menuService
.
listMenu
(
params
);
int
level
=
1
;
int
parentId
=
0
;
if
(
currentMenu
!=
null
)
{
if
(
currentMenu
!=
null
)
{
TabSysMenu
menu
=
this
.
menuService
.
getMenuById
(
currentMenu
);
parentId
=
currentMenu
;
level
=
menu
.
getLevel
()
+
1
;
level
=
menu
.
getLevel
()
+
1
;
}
this
.
authCodeApiService
.
getAuthCode
(
1
);
return
ServiceResponse
.
success
(
this
.
treeMenu
(
menuList
,
level
,
parentId
));
}
...
...
@@ -45,14 +47,144 @@ public class MenuApiServiceImpl implements MenuApiService {
return
this
.
getUserMenu
(
userId
,
enterpriseId
,
null
);
}
private
List
<
MenuDTO
>
treeMenu
(
List
<
TabSysMenu
>
menuList
,
int
level
,
int
parentId
){
@Override
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
));
}
@Override
public
ServiceResponse
<
List
<
MenuDTO
>>
listMenuRoleByParentId
(
Integer
parentId
)
{
TabSysMenu
record
=
menuService
.
getMenuById
(
parentId
);
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"参数有误,页面不存在"
);
}
List
<
TabSysMenu
>
menuList
=
menuService
.
listMenuRoleByParentId
(
parentId
);
return
ServiceResponse
.
success
(
EntityUtil
.
changeEntityListNew
(
MenuDTO
.
class
,
menuList
));
}
@Override
public
ServiceResponse
<
Void
>
saveGICPage
(
MenuDTO
menuDTO
)
{
menuDTO
.
setProject
(
MenuProjectConstants
.
DEFAULT_PROJECT
);
return
savePage
(
menuDTO
,
MenuDTO
.
SavePageValid
.
class
);
}
@Override
public
ServiceResponse
<
Void
>
updateGICPage
(
MenuDTO
menuDTO
)
{
return
updatePage
(
menuDTO
,
MenuDTO
.
SavePageValid
.
class
);
}
@Override
public
ServiceResponse
<
Void
>
deleteMenu
(
Integer
menuId
)
{
TabSysMenu
record
=
menuService
.
getMenuById
(
menuId
);
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"主键参数有误,查无数据"
);
}
MenuDTO
menuDTO
=
new
MenuDTO
();
menuDTO
.
setMenuId
(
menuId
);
menuDTO
.
setStatus
(
0
);
menuService
.
updatePage
(
menuDTO
);
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
Void
>
saveGICChildPage
(
MenuDTO
menuDTO
)
{
menuDTO
.
setProject
(
MenuProjectConstants
.
DEFAULT_PROJECT
);
return
saveChildPage
(
menuDTO
,
MenuDTO
.
SaveGICChildPageValid
.
class
);
}
@Override
public
ServiceResponse
<
Void
>
updateGICChildPage
(
MenuDTO
menuDTO
)
{
return
updateChildPage
(
menuDTO
,
MenuDTO
.
SaveGICChildPageValid
.
class
);
}
@Override
public
ServiceResponse
<
Void
>
updateAppPage
(
MenuDTO
menuDTO
)
{
return
updatePage
(
menuDTO
,
MenuDTO
.
UpdateAppPageValid
.
class
);
}
@Override
public
ServiceResponse
<
Void
>
saveAppChildPage
(
MenuDTO
menuDTO
)
{
return
saveChildPage
(
menuDTO
,
MenuDTO
.
SaveAppChildPageValid
.
class
);
}
@Override
public
ServiceResponse
<
Void
>
updateAppChildPage
(
MenuDTO
menuDTO
)
{
return
updateChildPage
(
menuDTO
,
MenuDTO
.
EditAppChildPageValid
.
class
);
}
private
ServiceResponse
<
Void
>
savePage
(
MenuDTO
menuDTO
,
Class
clazz
)
{
ServiceResponse
paramsValid
=
ValidParamsUtils
.
allCheckValidate
(
menuDTO
,
clazz
);
if
(!
paramsValid
.
isSuccess
())
{
return
paramsValid
;
}
//sort
int
maxSort
=
menuService
.
getMaxSortByParentId
(
MenuLevelConstants
.
FIRST_LEVEL_PARENT_ID
,
menuDTO
.
getProject
());
menuDTO
.
setSort
(
maxSort
+
1
);
//level
menuDTO
.
setLevel
(
1
);
menuDTO
.
setParentId
(
MenuLevelConstants
.
FIRST_LEVEL_PARENT_ID
);
menuDTO
.
setMenuType
(
MenuTypeEnum
.
PAGE
.
getCode
());
menuService
.
savePage
(
menuDTO
);
return
ServiceResponse
.
success
();
}
private
ServiceResponse
<
Void
>
saveChildPage
(
MenuDTO
menuDTO
,
Class
clazz
)
{
ServiceResponse
paramsValid
=
ValidParamsUtils
.
allCheckValidate
(
menuDTO
,
clazz
);
if
(!
paramsValid
.
isSuccess
())
{
return
paramsValid
;
}
TabSysMenu
record
=
menuService
.
getMenuById
(
menuDTO
.
getParentId
());
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"父级页面不存在"
);
}
//sort
int
maxSort
=
menuService
.
getMaxSortByParentId
(
menuDTO
.
getParentId
(),
menuDTO
.
getProject
());
menuDTO
.
setSort
(
maxSort
+
1
);
//level
menuDTO
.
setLevel
(
record
.
getLevel
()
+
1
);
//父级code
menuDTO
.
setParentCode
(
record
.
getMenuCode
());
menuDTO
.
setMenuType
(
MenuTypeEnum
.
PAGE
.
getCode
());
menuService
.
savePage
(
menuDTO
);
return
ServiceResponse
.
success
();
}
private
ServiceResponse
<
Void
>
updatePage
(
MenuDTO
menuDTO
,
Class
clazz
)
{
TabSysMenu
record
=
menuService
.
getMenuById
(
menuDTO
.
getMenuId
());
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"主键参数有误,查无数据"
);
}
ServiceResponse
paramsValid
=
ValidParamsUtils
.
allCheckValidate
(
menuDTO
,
clazz
);
if
(!
paramsValid
.
isSuccess
())
{
return
paramsValid
;
}
menuService
.
updatePage
(
menuDTO
);
return
ServiceResponse
.
success
();
}
private
ServiceResponse
<
Void
>
updateChildPage
(
MenuDTO
menuDTO
,
Class
clazz
)
{
TabSysMenu
parent
=
menuService
.
getMenuById
(
menuDTO
.
getParentId
());
if
(
parent
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"父级页面不存在"
);
}
menuService
.
updatePage
(
menuDTO
);
return
updatePage
(
menuDTO
,
clazz
);
}
private
List
<
MenuDTO
>
treeMenu
(
List
<
TabSysMenu
>
menuList
,
int
level
,
int
parentId
)
{
List
<
MenuDTO
>
list
=
null
;
if
(
level
<
5
){
for
(
TabSysMenu
menu
:
menuList
){
if
(
level
==
menu
.
getLevel
()
&&
menu
.
getIsShow
().
intValue
()
==
1
&&
menu
.
getParentId
().
intValue
()
==
parentId
){
if
(
level
<
5
)
{
for
(
TabSysMenu
menu
:
menuList
)
{
if
(
level
==
menu
.
getLevel
()
&&
menu
.
getIsShow
().
intValue
()
==
1
&&
menu
.
getParentId
().
intValue
()
==
parentId
)
{
MenuDTO
menuDTO
=
EntityUtil
.
changeEntityByJSON
(
MenuDTO
.
class
,
menu
);
menuDTO
.
setChildren
(
this
.
treeMenu
(
menuList
,
menu
.
getLevel
().
intValue
()
+
1
,
menuDTO
.
getMenuId
()));
if
(
list
==
null
)
{
menuDTO
.
setChildren
(
this
.
treeMenu
(
menuList
,
menu
.
getLevel
().
intValue
()
+
1
,
menuDTO
.
getMenuId
()));
if
(
list
==
null
)
{
list
=
new
ArrayList
<>();
}
list
.
add
(
menuDTO
);
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysMenuMapper.xml
View file @
5e7111a9
...
...
@@ -15,10 +15,23 @@
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"level"
jdbcType=
"INTEGER"
property=
"level"
/>
<result
column=
"is_show"
jdbcType=
"INTEGER"
property=
"isShow"
/>
<result
column=
"menu_code"
jdbcType=
"VARCHAR"
property=
"menuCode"
/>
<result
column=
"parent_code"
jdbcType=
"VARCHAR"
property=
"parentCode"
/>
<result
column=
"menu_version"
jdbcType=
"VARCHAR"
property=
"menuVersion"
/>
<result
column=
"menu_type"
jdbcType=
"INTEGER"
property=
"menuType"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
menu_id, menu_name, project, menu_url, parent_id, target, icon_url, sort, status,
create_time, update_time, level, is_show
create_time, update_time, level, is_show, menu_code, parent_code, menu_version, menu_type
</sql>
<sql
id=
"tree_filter"
>
and menu_type != 2
</sql>
<sql
id=
"role_filter"
>
and menu_type = 1
</sql>
<sql
id=
"page_filter"
>
and menu_type = 0
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -35,12 +48,14 @@
menu_url, parent_id, target,
icon_url, sort, status,
create_time, update_time, level,
is_show)
is_show, menu_code, parent_code,
menu_version, menu_type)
values (#{menuId,jdbcType=INTEGER}, #{menuName,jdbcType=VARCHAR}, #{project,jdbcType=VARCHAR},
#{menuUrl,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{target,jdbcType=INTEGER},
#{iconUrl,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{level,jdbcType=INTEGER},
#{isShow,jdbcType=INTEGER})
#{isShow,jdbcType=INTEGER}, #{menuCode,jdbcType=VARCHAR}, #{parentCode,jdbcType=VARCHAR},
#{menuVersion,jdbcType=VARCHAR}, #{menuType,jdbcType=INTEGER})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.auth.entity.TabSysMenu"
>
insert into tab_sys_menu
...
...
@@ -84,6 +99,18 @@
<if
test=
"isShow != null"
>
is_show,
</if>
<if
test=
"menuCode != null"
>
menu_code,
</if>
<if
test=
"parentCode != null"
>
parent_code,
</if>
<if
test=
"menuVersion != null"
>
menu_version,
</if>
<if
test=
"menuType != null"
>
menu_type,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"menuId != null"
>
...
...
@@ -125,6 +152,18 @@
<if
test=
"isShow != null"
>
#{isShow,jdbcType=INTEGER},
</if>
<if
test=
"menuCode != null"
>
#{menuCode,jdbcType=VARCHAR},
</if>
<if
test=
"parentCode != null"
>
#{parentCode,jdbcType=VARCHAR},
</if>
<if
test=
"menuVersion != null"
>
#{menuVersion,jdbcType=VARCHAR},
</if>
<if
test=
"menuType != null"
>
#{menuType,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.auth.entity.TabSysMenu"
>
...
...
@@ -166,6 +205,18 @@
<if
test=
"isShow != null"
>
is_show = #{isShow,jdbcType=INTEGER},
</if>
<if
test=
"menuCode != null"
>
menu_code = #{menuCode,jdbcType=VARCHAR},
</if>
<if
test=
"parentCode != null"
>
parent_code = #{parentCode,jdbcType=VARCHAR},
</if>
<if
test=
"menuVersion != null"
>
menu_version = #{menuVersion,jdbcType=VARCHAR},
</if>
<if
test=
"menuType != null"
>
menu_type = #{menuType,jdbcType=INTEGER},
</if>
</set>
where menu_id = #{menuId,jdbcType=INTEGER}
</update>
...
...
@@ -182,13 +233,54 @@
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
level = #{level,jdbcType=INTEGER},
is_show = #{isShow,jdbcType=INTEGER}
is_show = #{isShow,jdbcType=INTEGER},
menu_code = #{menuCode,jdbcType=VARCHAR},
parent_code = #{parentCode,jdbcType=VARCHAR},
menu_version = #{menuVersion,jdbcType=VARCHAR},
menu_type = #{menuType,jdbcType=INTEGER}
where menu_id = #{menuId,jdbcType=INTEGER}
</update>
<select
id=
"listMenu"
resultMap=
"BaseResultMap"
>
<select
id=
"listMenu"
resultMap=
"BaseResultMap"
parameterType=
"com.gic.auth.qo.MenuListQO"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_menu
where status=1
<if
test=
"search != null and search != '' "
>
and ( menu_name like concat('%', #{search}, '%') or menu_code like concat('%', #{search}, '%') )
</if>
<if
test=
"isGIC == 1"
>
and project = 'gic'
</if>
<if
test=
"isGIC == 2"
>
and project != 'gic'
</if>
<if
test=
"menuType != null"
>
and menu_type = #{menuType}
</if>
<if
test=
"menuType == null"
>
and menu_type != 2
</if>
order by level,sort
</select>
<select
id=
"getMaxSortByParentId"
resultType=
"int"
>
select
ifnull(max(sort), 0)
from tab_sys_menu
where status=1
and parent_id = #{parentId}
and project = #{project}
</select>
<select
id=
"listMenuRoleByParentId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_menu
where status=1
and menu_type = 1
order by sort
</select>
</mapper>
\ No newline at end of file
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/MenuController.java
View file @
5e7111a9
...
...
@@ -3,9 +3,11 @@ package com.gic.auth.web.controller;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.MenuDTO
;
import
com.gic.auth.qo.MenuListQO
;
import
com.gic.auth.service.MenuApiService
;
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
;
...
...
@@ -30,4 +32,81 @@ public class MenuController {
}
return
EnterpriseRestResponse
.
failure
(
userMenu
);
}
/**
* 新增GIC页面
* @Title: saveGICPage
* @Description:
* @author guojuxing
* @param menuDTO
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/save-gic-page"
)
public
RestResponse
saveGICPage
(
MenuDTO
menuDTO
)
{
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
saveGICPage
(
menuDTO
));
}
@RequestMapping
(
"/update-gic-page"
)
public
RestResponse
updateGICPage
(
MenuDTO
menuDTO
)
{
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
updateGICPage
(
menuDTO
));
}
@RequestMapping
(
"/delete-menu"
)
public
RestResponse
deleteMenu
(
Integer
menuId
)
{
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
deleteMenu
(
menuId
));
}
/**
* 新增gic子页面
* @Title: saveGICChildPage
* @Description:
* @author guojuxing
* @param menuDTO
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/save-gic-child-page"
)
public
RestResponse
saveGICChildPage
(
MenuDTO
menuDTO
)
{
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
saveGICChildPage
(
menuDTO
));
}
@RequestMapping
(
"/update-gic-child-page"
)
public
RestResponse
updateGICChildPage
(
MenuDTO
menuDTO
)
{
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
updateGICChildPage
(
menuDTO
));
}
/**
* 编辑应用页面
* @Title: updateAppPage
* @Description:
* @author guojuxing
* @param menuDTO
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/update-app-page"
)
public
RestResponse
updateAppPage
(
MenuDTO
menuDTO
)
{
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
updateAppPage
(
menuDTO
));
}
/**
* 查询列表数据
* @Title: updateAppPage
* @Description:
* @author guojuxing
* @param params
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/list-menu-tree"
)
public
RestResponse
listMenuTree
(
MenuListQO
params
)
{
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
listMenuTree
(
params
));
}
/**
* 查询页面下面的权限项列表数据
* @Title: listMenuRole
* @Description:
* @author guojuxing
* @param parentId
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/list-menu-role"
)
public
RestResponse
listMenuRole
(
Integer
parentId
)
{
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
listMenuRoleByParentId
(
parentId
));
}
}
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