|
@@ -40,13 +40,14 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<ISysRoleMenuMapper, SysR
|
|
|
public void saveBatchByRoleId(Long roleId, List<Long> menuIds) {
|
|
|
List<SysRoleMenu> sysMenus = new ArrayList<>();
|
|
|
HashMap<Long, SysMenu> menuMap = sysMenuService.getByIds(menuIds);
|
|
|
+ HashSet<Long> menuIdsSet = new HashSet<>();
|
|
|
for (Long menuId : menuIds) {
|
|
|
Long parentId = menuMap.get(menuId).getParentId();
|
|
|
- if(!menuIds.contains(parentId)){
|
|
|
- menuIds.add(parentId);
|
|
|
+ if(parentId != null && !menuIds.contains(parentId) ){
|
|
|
+ menuIdsSet.add(parentId);
|
|
|
}
|
|
|
}
|
|
|
- HashSet<Long> menuIdsSet = new HashSet<>(menuIds);
|
|
|
+ menuIdsSet.addAll(menuIds);
|
|
|
for (Long menuId : menuIdsSet) {
|
|
|
SysRoleMenu roleMenu = new SysRoleMenu();
|
|
|
roleMenu.setRoleId(roleId);
|