default Map<Long, String> findProfileNameByIdList(@NonNull List<Long> profileIdList) { if (profileIdList.isEmpty()) { return Maps.newHashMap(); } Weekend<DictatorConfigProfile> weekend = Weekend.of(DictatorConfigProfile.class); weekend.weekendCriteria() .andIn(DictatorConfigProfile::getId, profileIdList); return this.findAll(weekend).stream() .collect(Collectors.toMap(DictatorConfigProfile::getId, DictatorConfigProfile::getProfileName)); }
default Map<Long, String> findConfigNameMapByGroupIdList(@NonNull List<Long> configIdList) { if (configIdList.isEmpty()) { return Maps.newHashMap(); } Weekend<DictatorConfigGroup> weekend = Weekend.of(DictatorConfigGroup.class); weekend.weekendCriteria() .andIn(DictatorConfigGroup::getId, configIdList); return this.findAll(weekend).stream() .collect(Collectors.toMap(DictatorConfigGroup::getId, DictatorConfigGroup::getGroupName)); } }
default Map<Long, DictatorConfigProfile> findMapByIdList(@NonNull List<Long> profileIdList) { Weekend<DictatorConfigProfile> weekend = Weekend.of(DictatorConfigProfile.class); weekend.weekendCriteria() .andIn(DictatorConfigProfile::getId, profileIdList); return this.findAll(weekend).stream() .collect(Collectors.toMap(DictatorConfigProfile::getId, e -> e)); }
default Map<Long, List<DictatorResource>> findByParentIdList(@NonNull List<Long> parentIdList){ Weekend<DictatorResource> weekend = Weekend.of(DictatorResource.class); weekend.weekendCriteria() .andIn(DictatorResource::getParentId,parentIdList); Map<Long,List<DictatorResource>> parentIdResourceMap = new HashMap<>(); parentIdList.stream() .parallel() .forEach(parentId->{ parentIdResourceMap.put(parentId, Lists.newArrayList()); }); this.findAll(weekend).forEach(e->{ List<DictatorResource> resourceList = parentIdResourceMap.get(e.getParentId()); resourceList.add(e); }); return parentIdResourceMap; }
default void deleteByIdList(List<Long> idList){ Weekend<DictatorConfig> weekend = Weekend.of(DictatorConfig.class); weekend.weekendCriteria() .andIn(DictatorConfig::getId,idList); this.deleteByExample(weekend); } }