class DDMStructureBatchLoader implements BatchLoader<Long, DDMStructure> {

    @Override
    public CompletionStage<List<DDMStructure>> load(List<Long> keys) {
        return CompletableFuture.supplyAsync(() -> {
            if (keys == null || keys.isEmpty()) {
                return Collections.emptyList();
            }

            DynamicQuery query = DynamicQueryFactoryUtil.forClass(DDMStructure.class);
            query.add(PropertyFactoryUtil.forName("structureId")
                    .in(keys.stream()
                            .mapToLong(l -> l)
                            .toArray()));
            return ddmStructureLocalService.dynamicQuery(query);
        });
    }

}