Commit 677bdec6 authored by 廖旭伟's avatar 廖旭伟

角色菜单非空过滤

parent 02a8aa77
......@@ -97,7 +97,7 @@ public class RoleAuthServiceImpl extends AbstractCRUDServiceImpl<RoleAuthDao, Ro
condition.setRoleId(roleId);
List<RoleAuthEntity> roleModelEntities = this.find(condition);
if (CollectionUtils.isNotEmpty(roleModelEntities)) {
List<Long> menuIds = roleModelEntities.stream().map(RoleAuthEntity::getMenuId).collect(Collectors.toList());
List<Long> menuIds = roleModelEntities.stream().filter(m->m.getMenuId()!=null).map(RoleAuthEntity::getMenuId).collect(Collectors.toList());
MenuQuery query1 = new MenuQuery();
query1.setIdList(menuIds);
List<MenuEntity> menuEntities = menuService.find(query1);
......
......@@ -44,7 +44,7 @@ public class RoleServiceImpl extends AbstractCRUDServiceImpl<RoleDao, RoleEntity
@Override
protected void findAfter(RoleEntity entity, Context context, List<RoleEntity> list) throws AppException {
list.stream().forEach(item->{
List<Long> menuIds = roleAuthService.find(new RoleAuthQuery().roleId(item.getId())).stream().map(m -> m.getMenuId()).collect(Collectors.toList());
List<Long> menuIds = roleAuthService.find(new RoleAuthQuery().roleId(item.getId())).stream().filter(m->m.getMenuId()!=null).map(m -> m.getMenuId()).collect(Collectors.toList());
if(!ObjectUtils.isEmpty(menuIds)){
item.setMenuIdList(menuIds);
}
......
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