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
c011684e
Commit
c011684e
authored
Sep 20, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除接口
parent
194dd2d9
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
210 additions
and
7 deletions
+210
-7
TabSysMenuItemMapper.java
...in/java/com/gic/auth/dao/mapper/TabSysMenuItemMapper.java
+11
-0
TabSysMenuMapper.java
...c/main/java/com/gic/auth/dao/mapper/TabSysMenuMapper.java
+21
-0
MenuItemService.java
...e/src/main/java/com/gic/auth/service/MenuItemService.java
+11
-0
MenuService.java
...rvice/src/main/java/com/gic/auth/service/MenuService.java
+21
-0
MenuItemServiceImpl.java
...n/java/com/gic/auth/service/impl/MenuItemServiceImpl.java
+6
-0
MenuServiceImpl.java
.../main/java/com/gic/auth/service/impl/MenuServiceImpl.java
+15
-0
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+21
-0
MenuItemApiServiceImpl.java
...m/gic/auth/service/outer/impl/MenuItemApiServiceImpl.java
+29
-0
dubbo-gic-platform-auth-service.xml
...ce/src/main/resources/dubbo-gic-platform-auth-service.xml
+1
-0
TabSysMenuItemMapper.xml
...ervice/src/main/resources/mapper/TabSysMenuItemMapper.xml
+9
-0
TabSysMenuMapper.xml
...th-service/src/main/resources/mapper/TabSysMenuMapper.xml
+19
-0
MenuController.java
...main/java/com/gic/auth/web/controller/MenuController.java
+32
-7
MenuDetailVO.java
...h-web/src/main/java/com/gic/auth/web/vo/MenuDetailVO.java
+13
-0
dubbo-gic-platform-auth-web.xml
...th-web/src/main/resources/dubbo-gic-platform-auth-web.xml
+1
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysMenuItemMapper.java
View file @
c011684e
...
...
@@ -75,4 +75,14 @@ public interface TabSysMenuItemMapper {
* @return void
*/
void
deleteByMenuId
(
@Param
(
"menuId"
)
Integer
menuId
);
/**
* 根据权限项查询操作项数据
* @Title: listMenuItemByMenuId
* @Description:
* @author guojuxing
* @param menuId
* @return java.util.List<com.gic.auth.entity.TabSysMenuItem>
*/
List
<
TabSysMenuItem
>
listMenuItemByMenuId
(
@Param
(
"menuId"
)
Integer
menuId
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysMenuMapper.java
View file @
c011684e
package
com
.
gic
.
auth
.
dao
.
mapper
;
import
com.gic.auth.dto.AuthItemListDTO
;
import
com.gic.auth.entity.TabSysMenu
;
import
com.gic.auth.qo.MenuListQO
;
import
com.gic.auth.qo.MenuOperationItemListQO
;
...
...
@@ -114,4 +115,23 @@ public interface TabSysMenuMapper {
* @return java.util.List<com.gic.auth.entity.TabSysMenu>
*/
List
<
TabSysMenu
>
selectByIds
(
@Param
(
"menuIdList"
)
List
<
Integer
>
menuIdList
);
/**
* 查询页面下的权限项数据
* @Title: listAuthItemByMenuId
* @Description:
* @author guojuxing
* @param menuId
* @return java.util.List<com.gic.auth.dto.AuthItemListDTO>
*/
List
<
AuthItemListDTO
>
listAuthItemByMenuId
(
@Param
(
"menuId"
)
Integer
menuId
);
/**
* 统计页面下的子项目
* @Title: countChildByParentId
* @Description:
* @author guojuxing
* @param menuId
* @return int
*/
int
countChildByParentId
(
@Param
(
"menuId"
)
Integer
menuId
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/MenuItemService.java
View file @
c011684e
package
com
.
gic
.
auth
.
service
;
import
com.gic.auth.dto.MenuItemDTO
;
import
com.gic.auth.entity.TabSysMenuItem
;
import
java.util.List
;
/**
...
...
@@ -31,4 +32,14 @@ public interface MenuItemService {
* @return void
*/
void
deleteByMenuId
(
Integer
menuId
);
/**
* 根据权限项查询操作项
* @Title: listMenuItemByMenuId
* @Description:
* @author guojuxing
* @param menuId
* @return java.util.List<com.gic.auth.entity.TabSysMenuItem>
*/
List
<
TabSysMenuItem
>
listMenuItemByMenuId
(
Integer
menuId
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/MenuService.java
View file @
c011684e
package
com
.
gic
.
auth
.
service
;
import
com.gic.auth.dto.AuthItemListDTO
;
import
com.gic.auth.dto.MenuDTO
;
import
com.gic.auth.entity.TabSysMenu
;
import
com.gic.auth.qo.MenuListQO
;
...
...
@@ -83,4 +84,24 @@ public interface MenuService {
* @return java.util.List<com.gic.auth.entity.TabSysMenu>
*/
List
<
TabSysMenu
>
selectByIds
(
List
<
Integer
>
menuIdList
);
/**
* 查询页面下的权限项数据
* @Title: listAuthItemByMenuId
* @Description:
* @author guojuxing
* @param menuId
* @return java.util.List<com.gic.auth.dto.AuthItemListDTO>
*/
List
<
AuthItemListDTO
>
listAuthItemByMenuId
(
Integer
menuId
);
/**
* 是否有子项目(子页面、权限项等)
* @Title: isHasChild
* @Description:
* @author guojuxing
* @param menuId
* @return boolean
*/
boolean
isHasChild
(
Integer
menuId
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/MenuItemServiceImpl.java
View file @
c011684e
...
...
@@ -2,6 +2,7 @@ package com.gic.auth.service.impl;
import
com.gic.auth.dao.mapper.TabSysMenuItemMapper
;
import
com.gic.auth.dto.MenuItemDTO
;
import
com.gic.auth.entity.TabSysMenuItem
;
import
com.gic.auth.service.MenuItemService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -25,4 +26,9 @@ public class MenuItemServiceImpl implements MenuItemService{
public
void
deleteByMenuId
(
Integer
menuId
)
{
tabSysMenuItemMapper
.
deleteByMenuId
(
menuId
);
}
@Override
public
List
<
TabSysMenuItem
>
listMenuItemByMenuId
(
Integer
menuId
)
{
return
tabSysMenuItemMapper
.
listMenuItemByMenuId
(
menuId
);
}
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/MenuServiceImpl.java
View file @
c011684e
...
...
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.List
;
import
com.gic.auth.dto.AuthItemListDTO
;
import
com.gic.auth.qo.MenuOperationItemListQO
;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
...
...
@@ -105,6 +106,20 @@ public class MenuServiceImpl implements MenuService {
return
tabSysMenuMapper
.
selectByIds
(
menuIdList
);
}
@Override
public
List
<
AuthItemListDTO
>
listAuthItemByMenuId
(
Integer
menuId
)
{
return
tabSysMenuMapper
.
listAuthItemByMenuId
(
menuId
);
}
@Override
public
boolean
isHasChild
(
Integer
menuId
)
{
int
count
=
tabSysMenuMapper
.
countChildByParentId
(
menuId
);
if
(
count
>
0
)
{
return
true
;
}
return
false
;
}
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 @
c011684e
...
...
@@ -5,6 +5,7 @@ import java.util.*;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.Page
;
import
com.gic.auth.constant.*
;
import
com.gic.auth.dto.AuthItemListDTO
;
import
com.gic.auth.dto.MenuItemDTO
;
import
com.gic.auth.qo.AuthItemSaveQO
;
import
com.gic.auth.qo.MenuOperationItemListQO
;
...
...
@@ -105,6 +106,16 @@ public class MenuApiServiceImpl implements MenuApiService {
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"主键参数有误,查无数据"
);
}
if
(
record
.
getMenuType
().
intValue
()
==
MenuTypeEnum
.
PAGE
.
getCode
())
{
//如果是页面,判断下面是否有子页面
if
(
menuService
.
isHasChild
(
menuId
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"页面下有项目,不允许删除词页面"
);
}
}
else
if
(
record
.
getMenuType
().
intValue
()
==
MenuTypeEnum
.
ROLE
.
getCode
())
{
//权限项,需要同时删除关联表
menuItemService
.
deleteByMenuId
(
menuId
);
}
MenuDTO
menuDTO
=
new
MenuDTO
();
menuDTO
.
setMenuId
(
menuId
);
menuDTO
.
setStatus
(
0
);
...
...
@@ -313,6 +324,16 @@ public class MenuApiServiceImpl implements MenuApiService {
return
ServiceResponse
.
success
();
}
@Override
public
ServiceResponse
<
List
<
AuthItemListDTO
>>
listAuthItemByMenuId
(
Integer
menuId
)
{
TabSysMenu
record
=
menuService
.
getMenuById
(
menuId
);
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"参数有误,没有页面"
);
}
List
<
AuthItemListDTO
>
authItemList
=
menuService
.
listAuthItemByMenuId
(
menuId
);
return
ServiceResponse
.
success
(
authItemList
);
}
private
ServiceResponse
<
Void
>
savePage
(
MenuDTO
menuDTO
,
Class
clazz
)
{
ServiceResponse
paramsValid
=
ValidParamsUtils
.
allCheckValidate
(
menuDTO
,
clazz
);
if
(!
paramsValid
.
isSuccess
())
{
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuItemApiServiceImpl.java
0 → 100644
View file @
c011684e
package
com
.
gic
.
auth
.
service
.
outer
.
impl
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.dto.MenuItemDTO
;
import
com.gic.auth.service.MenuItemApiService
;
import
com.gic.auth.service.MenuItemService
;
import
com.gic.commons.util.EntityUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
(
"menuItemApiService"
)
public
class
MenuItemApiServiceImpl
implements
MenuItemApiService
{
@Autowired
private
MenuItemService
menuItemService
;
@Override
public
ServiceResponse
<
List
<
MenuItemDTO
>>
listMenuItemByMenuId
(
Integer
menuId
)
{
List
<
MenuItemDTO
>
list
=
EntityUtil
.
changeEntityListNew
(
MenuItemDTO
.
class
,
menuItemService
.
listMenuItemByMenuId
(
menuId
));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
ServiceResponse
.
success
(
list
);
}
return
ServiceResponse
.
success
(
new
ArrayList
<>());
}
}
gic-platform-auth-service/src/main/resources/dubbo-gic-platform-auth-service.xml
View file @
c011684e
...
...
@@ -17,6 +17,7 @@
<!--门店域-->
<dubbo:service
interface=
"com.gic.auth.service.UserApiService"
ref=
"userApiService"
timeout=
"6000"
/>
<dubbo:service
interface=
"com.gic.auth.service.MenuApiService"
ref=
"menuApiService"
timeout=
"6000"
/>
<dubbo:service
interface=
"com.gic.auth.service.MenuItemApiService"
ref=
"menuItemApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.log.api.service.LogApiService"
id=
"logApiService"
timeout=
"6000"
/>
<!--资源组-->
<dubbo:service
interface=
"com.gic.auth.service.ResourceApiService"
ref=
"resourceApiService"
timeout=
"6000"
/>
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysMenuItemMapper.xml
View file @
c011684e
...
...
@@ -129,4 +129,12 @@
</if>
</update>
<select
id=
"listMenuItemByMenuId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_sys_menu_item
where menu_id = #{menuId}
and status = 1
</select>
</mapper>
\ No newline at end of file
gic-platform-auth-service/src/main/resources/mapper/TabSysMenuMapper.xml
View file @
c011684e
...
...
@@ -342,4 +342,22 @@
</foreach>
</if>
</select>
<select
id=
"listAuthItemByMenuId"
resultType=
"com.gic.auth.dto.AuthItemListDTO"
>
select
a.menu_id menuId,
a.menu_name menuName,
(select count(DISTINCT b.item_id) from tab_sys_menu_item b where a.menu_id = b.menu_id and b.status = 1 ) operationItemCount
from tab_sys_menu a
where a.status=1
</select>
<select
id=
"countChildByParentId"
resultType=
"int"
>
select
count(1)
from tab_sys_menu
where status = 1
and parent_id = #{menuId}
</select>
</mapper>
\ No newline at end of file
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/MenuController.java
View file @
c011684e
...
...
@@ -5,8 +5,10 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
com.gic.auth.constant.SignConstants
;
import
com.gic.auth.constant.*
;
import
com.gic.auth.dto.MenuItemDTO
;
import
com.gic.auth.qo.AuthItemSaveQO
;
import
com.gic.auth.service.MenuItemApiService
;
import
com.gic.auth.web.vo.MenuOperationItemVO
;
import
org.apache.dubbo.rpc.RpcContext
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -17,9 +19,6 @@ import org.springframework.web.bind.annotation.RestController;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.auth.constant.GicVersionEnum
;
import
com.gic.auth.constant.MenuLevelConstants
;
import
com.gic.auth.constant.MenuProjectConstants
;
import
com.gic.auth.dto.MenuDTO
;
import
com.gic.auth.qo.MenuListQO
;
import
com.gic.auth.service.MenuApiService
;
...
...
@@ -36,6 +35,8 @@ public class MenuController {
private
final
static
Logger
LOGGER
=
LogManager
.
getLogger
(
MenuController
.
class
);
@Autowired
private
MenuApiService
menuApiService
;
@Autowired
private
MenuItemApiService
menuItemApiService
;
@RequestMapping
(
"login-user-menu"
)
public
RestResponse
loginUserMenu
(
Integer
currentMenu
)
{
...
...
@@ -190,9 +191,20 @@ public class MenuController {
if
(
result
.
isSuccess
())
{
MenuDTO
dto
=
result
.
getResult
();
MenuDetailVO
vo
=
EntityUtil
.
changeEntityNew
(
MenuDetailVO
.
class
,
dto
);
String
menuVersion
=
dto
.
getMenuVersion
().
substring
(
1
,
dto
.
getMenuVersion
().
length
()
-
1
);
vo
.
setMenuVersion
(
menuVersion
.
replaceAll
(
SignConstants
.
UNDERLINE
,
SignConstants
.
COMMA
));
vo
.
setMap
(
getMenuVersionMap
(
result
.
getResult
()));
if
(
dto
.
getMenuType
().
intValue
()
==
MenuTypeEnum
.
ROLE
.
getCode
())
{
//权限项
List
<
MenuItemDTO
>
menuItemDTOList
=
menuItemApiService
.
listMenuItemByMenuId
(
id
).
getResult
();
StringBuilder
itemIds
=
new
StringBuilder
();
for
(
MenuItemDTO
menuItemDTO
:
menuItemDTOList
)
{
itemIds
.
append
(
menuItemDTO
.
getItemId
()).
append
(
SignConstants
.
COMMA
);
}
String
tempItemIds
=
itemIds
.
toString
();
vo
.
setOperationItemIds
(
tempItemIds
.
substring
(
0
,
tempItemIds
.
length
()
-
1
));
}
else
{
String
menuVersion
=
dto
.
getMenuVersion
().
substring
(
1
,
dto
.
getMenuVersion
().
length
()
-
1
);
vo
.
setMenuVersion
(
menuVersion
.
replaceAll
(
SignConstants
.
UNDERLINE
,
SignConstants
.
COMMA
));
vo
.
setMap
(
getMenuVersionMap
(
result
.
getResult
()));
}
return
RestResponse
.
success
(
vo
);
}
return
EnterpriseRestResponse
.
failure
(
result
);
...
...
@@ -218,6 +230,19 @@ public class MenuController {
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
updateAuthItem
(
params
));
}
/**
* 查询页面下的权限项列表数据
* @Title: listAuthItem
* @Description:
* @author guojuxing
* @param menuId
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/list-auth-item"
)
public
RestResponse
listAuthItem
(
Integer
menuId
)
{
return
ResultControllerUtils
.
commonResult
(
menuApiService
.
listAuthItemByMenuId
(
menuId
));
}
private
static
Map
<
String
,
String
>
getMenuVersionMap
(
MenuDTO
dto
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>(
16
);
if
(
dto
.
getProject
().
equals
(
MenuProjectConstants
.
DEFAULT_PROJECT
)
&&
dto
.
getLevel
()
==
1
)
{
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/vo/MenuDetailVO.java
View file @
c011684e
...
...
@@ -63,6 +63,11 @@ public class MenuDetailVO implements Serializable{
*/
private
String
menuVersion
;
/**
* 操作项ID,如果是权限项,有该值
*/
private
String
operationItemIds
;
private
Map
<
String
,
String
>
map
;
public
Integer
getMenuId
()
{
...
...
@@ -152,4 +157,12 @@ public class MenuDetailVO implements Serializable{
public
void
setMap
(
Map
<
String
,
String
>
map
)
{
this
.
map
=
map
;
}
public
String
getOperationItemIds
()
{
return
operationItemIds
;
}
public
void
setOperationItemIds
(
String
operationItemIds
)
{
this
.
operationItemIds
=
operationItemIds
;
}
}
gic-platform-auth-web/src/main/resources/dubbo-gic-platform-auth-web.xml
View file @
c011684e
...
...
@@ -36,6 +36,7 @@
<dubbo:reference
interface=
"com.gic.store.service.StoreStatusSettingApiService"
id=
"storeStatusSettingApiService"
timeout=
"60000"
/>
<dubbo:reference
interface=
"com.gic.log.api.service.LogApiService"
id=
"logApiService"
timeout=
"60000"
/>
<dubbo:reference
interface=
"com.gic.auth.service.MenuApiService"
id=
"menuApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.auth.service.MenuItemApiService"
id=
"menuItemApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.enterprise.service.EnterpriseApiService"
id=
"enterpriseApiService"
timeout=
"6000"
/>
<dubbo:reference
interface=
"com.gic.auth.service.UserApiService"
id=
"userApiService"
timeout=
"6000"
/>
...
...
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