Commit 33d0378c by guojuxing

gic子管理员菜单数据调整:必有个人中心和总览页面

parent 1d0b3535
......@@ -56,6 +56,11 @@ public class UserMenuQO implements Serializable{
*/
private boolean isOperationUser;
/**
* 是否查询固有的数据(个人中心&总览),默认不查询。用于gic子管理员登录后权限
*/
private Boolean isNeedInherentMenu;
public Integer getEnterpriseId() {
return enterpriseId;
}
......@@ -136,4 +141,13 @@ public class UserMenuQO implements Serializable{
isOperationUser = operationUser;
return this;
}
public Boolean getNeedInherentMenu() {
return isNeedInherentMenu;
}
public UserMenuQO setNeedInherentMenu(Boolean needInherentMenu) {
isNeedInherentMenu = needInherentMenu;
return this;
}
}
......@@ -137,10 +137,12 @@ public interface TabSysMenuMapper {
* @Description:
* @author zhiwj
* @param parentMenuIdList
* @param menuType 0:页面 1:权限项 2:操作
* @return java.util.List<com.gic.auth.entity.TabSysMenu>
* @throws
*/
List<TabSysMenu> listByParentMenuIdList(@Param("parentMenuIdList") List<Integer> parentMenuIdList);
List<TabSysMenu> listByParentMenuIdList(@Param("parentMenuIdList") List<Integer> parentMenuIdList,
@Param("menuType") Integer menuType);
/**
* gic菜单转应用菜单的时候,批量进行修改相关数据
......
......@@ -271,6 +271,13 @@ public interface MenuService {
List<TabSysMenu> listMenuForGicContainChild(List<Integer> parentIdList);
/**
* 查询固有菜单的数据(个人中心&总览必有)
* 操作项不用考虑,因为没有设置权限项
* @return
*/
List<TabSysMenu> listMenuForGicContainChild();
/**
* gic菜单转应用菜单的时候,批量进行修改相关数据
* @Title: updateMenuTmp

* @Description:
......
......@@ -18,9 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -214,7 +212,7 @@ public class MenuServiceImpl implements MenuService {
if (CollectionUtils.isEmpty(parentMenuIdList)) {
return new ArrayList<>();
}
return tabSysMenuMapper.listByParentMenuIdList(parentMenuIdList);
return tabSysMenuMapper.listByParentMenuIdList(parentMenuIdList, null);
}
@Override
......@@ -233,17 +231,29 @@ public class MenuServiceImpl implements MenuService {
return new ArrayList<>();
}
List<TabSysMenu> result = new ArrayList<>();
List<TabSysMenu> list = tabSysMenuMapper.listByParentMenuIdList(parentIdList);
while (CollectionUtils.isNotEmpty(list)) {
result.addAll(list);
List<Integer> menuIdList = list
.stream()
.filter(e -> e != null)
.map(e -> e.getMenuId())
.collect(Collectors.toList());
list.clear();
list = tabSysMenuMapper.listByParentMenuIdList(menuIdList);
recursion(result, parentIdList, false);
return result;
}
@Override
public List<TabSysMenu> listMenuForGicContainChild() {
TabSysMenu userMenu = getMenuByMenuCode("user");
if (userMenu == null) {
return Collections.emptyList();
}
TabSysMenu indexMenu = getMenuByMenuCode("zz");
if (indexMenu == null) {
return Collections.emptyList();
}
List<Integer> idList = new ArrayList<>();
idList.add(userMenu.getMenuId());
idList.add(indexMenu.getMenuId());
List<TabSysMenu> result = new ArrayList<>();
result.add(userMenu);
result.add(indexMenu);
recursion(result, idList, true);
return result;
}
......@@ -293,4 +303,25 @@ public class MenuServiceImpl implements MenuService {
record.setSort(sort);
tabSysMenuMapper.updateByPrimaryKeySelective(record);
}
/**
* 递归查询菜单数据
* @param result
* @param parentIdList
* @param isMenu 是否只查询页面类型的数据
*/
private void recursion(List<TabSysMenu> result, List<Integer> parentIdList, boolean isMenu) {
Integer menuType = isMenu ? 0 : null;
List<TabSysMenu> list = tabSysMenuMapper.listByParentMenuIdList(parentIdList, menuType);
while (CollectionUtils.isNotEmpty(list)) {
result.addAll(list);
List<Integer> menuIdList = list
.stream()
.filter(e -> e != null)
.map(e -> e.getMenuId())
.collect(Collectors.toList());
list.clear();
list = tabSysMenuMapper.listByParentMenuIdList(menuIdList, menuType);
}
}
}
......@@ -1350,6 +1350,19 @@ public class MenuApiServiceImpl implements MenuApiService {
menuIdList.add(menu.getMenuId());
}
}
//gic子管理员登录后权限
Boolean isNeedInherentMenu = params.getNeedInherentMenu();
if (isNeedInherentMenu != null && isNeedInherentMenu) {
//查询个人中心和总览的全部数据
List<TabSysMenu> inherentMenuList = menuService.listMenuForGicContainChild();
if (CollectionUtils.isNotEmpty(inherentMenuList)) {
for (TabSysMenu temp : inherentMenuList) {
menuIdList.add(temp.getMenuId());
}
}
}
resultList = menuService.selectByIdsAndOrderBy(menuIdList, " order by sort");
}
}
......
......@@ -482,6 +482,9 @@
<include refid="Base_Column_List" />
from tab_sys_menu
where delete_flag=${@com.gic.auth.constant.DeleteFlagConstants@NORMAL_STATUS}
<if test="menuType != null">
and menu_type = #{menuType}
</if>
<if test="null != parentMenuIdList and parentMenuIdList.size() &gt; 0">
and parent_id in
<foreach close=")" collection="parentMenuIdList" index="index" item="item" open="(" separator=",">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment