@Test public void getPermissionMapByGroupIds() { Long id = mockData(); Map<Long, List<PermissionDO>> map = permissionService.getPermissionMapByGroupIds(Collections.singletonList(id)); assertNotNull(map.get(id)); boolean anyMatch = map.get(id).stream().anyMatch(permission -> permission.getName().equals("权限2")); assertTrue(anyMatch); }
@Override public Map<Long, List<PermissionDO>> getPermissionMapByGroupIds(List<Long> groupIds) { HashMap map = new HashMap(groupIds.size()); groupIds.stream().forEach(groupId -> { List<PermissionDO> permissions = this.baseMapper.selectPermissionsByGroupId(groupId); map.put(groupId, permissions); }); return map; }
PermissionServiceImpl extends ServiceImpl<PermissionMapper, PermissionDO> implements PermissionService { @Override public Map<Long, List<PermissionDO>> getPermissionMapByGroupIds(List<Long> groupIds) { HashMap map = new HashMap(groupIds.size()); groupIds.stream().forEach(groupId -> { List<PermissionDO> permissions = this.baseMapper.selectPermissionsByGroupId(groupId); map.put(groupId, permissions); }); return map; } }
PermissionServiceImpl extends ServiceImpl<PermissionMapper, PermissionDO> implements PermissionService { @Override public Map<Long, List<PermissionDO>> getPermissionMapByGroupIds(List<Long> groupIds) { HashMap map = new HashMap(groupIds.size()); groupIds.stream().forEach(groupId -> { List<PermissionDO> permissions = this.baseMapper.selectPermissionsByGroupId(groupId); map.put(groupId, permissions); }); return map; }  }
PermissionServiceImpl extends ServiceImpl<PermissionMapper, PermissionDO> implements PermissionService { @Override public Map<Long, List<PermissionDO>> getPermissionMapByGroupIds(List<Long> groupIds) { HashMap map = new HashMap(groupIds.size()); groupIds.stream().forEach(groupId -> { List<PermissionDO> permissions = this.baseMapper.selectPermissionsByGroupId(groupId); map.put(groupId, permissions); }); return map; }  @Override List<PermissionDO> getPermissionByGroupId(Long groupId); @Override List<PermissionDO> getPermissionByGroupIds(List<Long> groupIds); @Override Map<Long, List<PermissionDO>> getPermissionMapByGroupIds(List<Long> groupIds); @Override List<Map<String, List<Map<String, String>>>> structuringPermissions(List<PermissionDO> permissions); @Override Map<String, List<String>> structuringPermissionsSimply(List<PermissionDO> permissions); }
PermissionServiceImpl extends ServiceImpl<PermissionMapper, PermissionDO> implements PermissionService { @Override public Map<Long, List<PermissionDO>> getPermissionMapByGroupIds(List<Long> groupIds) { HashMap map = new HashMap(groupIds.size()); groupIds.stream().forEach(groupId -> { List<PermissionDO> permissions = this.baseMapper.selectPermissionsByGroupId(groupId); map.put(groupId, permissions); }); return map; }  @Override List<PermissionDO> getPermissionByGroupId(Long groupId); @Override List<PermissionDO> getPermissionByGroupIds(List<Long> groupIds); @Override Map<Long, List<PermissionDO>> getPermissionMapByGroupIds(List<Long> groupIds); @Override List<Map<String, List<Map<String, String>>>> structuringPermissions(List<PermissionDO> permissions); @Override Map<String, List<String>> structuringPermissionsSimply(List<PermissionDO> permissions);  }