You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public <P, C> void saveOrUpdateTopSubs(P top, List<C> subs, Supplier<C> exampleSupplier, Function<P, Long> topIdGetter, Function<C, Long> subIdGetter) {
// save or update top
super.saveOrUpdate(top);
if (CollectionUtils.isEmpty(subs)) {
return;
}
// delete subs
List<C> existingChilds = this.findByExample(exampleSupplier.get());
Map<Long, C> existingChildMap = UtilHelper.mapUniqueValue(existingChilds, subIdGetter);
for (C c : subs) {
Long id = subIdGetter.apply(c);
if (id != null) {
existingChildMap.remove(id);
}
}
//
for (C c : existingChildMap.values()) {
this.delete(c);
}
// save or update subs
for (C c : subs) {
this.saveOrUpdate(c);
}
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: