|
@@ -170,8 +170,6 @@ public class MenuService extends ServiceImpl<MenuMapper, Menu> implements IMenuS
|
|
|
}
|
|
|
//获取菜单id列表
|
|
|
List<Long> menuIdList = ProjectUtils.getLongIdFromIds(menuRequest.getMenuIds());
|
|
|
- //获取菜单下的所有按钮
|
|
|
- menuIdList = getAllMenuButtonIds(menuIdList);
|
|
|
List<CompanyMenu> needSaveCompanyMenuList = new ArrayList<>();
|
|
|
if (menuIdList.size() > 0) {
|
|
|
for (Long menuId : menuIdList) {
|
|
@@ -191,36 +189,34 @@ public class MenuService extends ServiceImpl<MenuMapper, Menu> implements IMenuS
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param menuIdList 菜单id
|
|
|
- * @return 所有菜单id
|
|
|
- * @methodName getAllMenuButtonIds
|
|
|
- * @Desc 获取所有菜单id
|
|
|
- * @Author huangyuan
|
|
|
- * @Date 2020/7/7 12:16 下午
|
|
|
- */
|
|
|
- private List<Long> getAllMenuButtonIds(List<Long> menuIdList) {
|
|
|
- if (menuIdList != null && menuIdList.size() > 0) {
|
|
|
- List<Menu> menuList = (List<Menu>) this.listByIds(menuIdList);
|
|
|
- //获取二级菜单
|
|
|
- List<Menu> secondMenuList = menuList.stream().filter(menu -> !ApiConstants.ROOT_MENU_PARENT_ID.
|
|
|
- equals(menu.getParentId())).collect(Collectors.toList());
|
|
|
- if (secondMenuList.size() > 0) {
|
|
|
- List<Long> secondMenuIdList = secondMenuList.stream().map(menu -> Long.
|
|
|
- parseLong(menu.getId().toString())).collect(Collectors.toList());
|
|
|
- //获取二级菜单下的按钮
|
|
|
- List<Menu> buttonList = list(Wrappers.<Menu>query().
|
|
|
- in(secondMenuIdList.size() > 0, "parent_id", secondMenuIdList)
|
|
|
- );
|
|
|
- if(buttonList != null && buttonList.size() > 0) {
|
|
|
- //分配按钮添加
|
|
|
- List<Long> buttonIdList = buttonList.stream().map(menu -> Long.
|
|
|
+ @Override
|
|
|
+ public String getAllMenuButtonIds(String menuIdStr) {
|
|
|
+ List<Long> menuIdList = new ArrayList<>();
|
|
|
+ if (StringUtils.isNotBlank(menuIdStr)) {
|
|
|
+ //将字符串转化为集合
|
|
|
+ menuIdList = ProjectUtils.getLongIdFromIds(menuIdStr);
|
|
|
+ if (menuIdList.size() > 0) {
|
|
|
+ List<Menu> menuList = (List<Menu>) this.listByIds(menuIdList);
|
|
|
+ //获取二级菜单
|
|
|
+ List<Menu> secondMenuList = menuList.stream().filter(menu -> !ApiConstants.ROOT_MENU_PARENT_ID.
|
|
|
+ equals(menu.getParentId())).collect(Collectors.toList());
|
|
|
+ if (secondMenuList.size() > 0) {
|
|
|
+ List<Long> secondMenuIdList = secondMenuList.stream().map(menu -> Long.
|
|
|
parseLong(menu.getId().toString())).collect(Collectors.toList());
|
|
|
- menuIdList.addAll(buttonIdList);
|
|
|
+ //获取二级菜单下的按钮
|
|
|
+ List<Menu> buttonList = list(Wrappers.<Menu>query().
|
|
|
+ in(secondMenuIdList.size() > 0, "parent_id", secondMenuIdList)
|
|
|
+ );
|
|
|
+ if (buttonList != null && buttonList.size() > 0) {
|
|
|
+ //分配按钮添加
|
|
|
+ List<Long> buttonIdList = buttonList.stream().map(menu -> Long.
|
|
|
+ parseLong(menu.getId().toString())).collect(Collectors.toList());
|
|
|
+ menuIdList.addAll(buttonIdList);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return menuIdList;
|
|
|
+ return ProjectUtils.listToStrByComma(menuIdList);
|
|
|
}
|
|
|
|
|
|
@Override
|