|
@@ -13,6 +13,8 @@ import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.AttributeAssignBuilder;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
|
|
|
+import java.io.Serializable;
|
|
|
+import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
@@ -45,6 +47,10 @@ public interface BaseService<T extends BaseIdPo> extends IService<T> {
|
|
|
Assert.equals(count, 0L, errorMsgTemplate, params);
|
|
|
}
|
|
|
|
|
|
+ default Map<Long, T> byIdsToMap(Collection<? extends Serializable> ids) {
|
|
|
+ return listByIds(ids).stream().collect(Collectors.toMap(BaseIdPo::getId, Function.identity()));
|
|
|
+ }
|
|
|
+
|
|
|
default long count(Consumer<LambdaQueryWrapper<T>> consumer) {
|
|
|
return count(Wrappers.<T>lambdaQuery().func(ObjectUtil.isNotEmpty(consumer), consumer));
|
|
|
}
|