1. 同步 base-version

This commit is contained in:
chenbowen
2025-09-18 00:51:31 +08:00
parent dadf77b668
commit 76dd62665f
24 changed files with 666 additions and 37 deletions

View File

@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
/**
@@ -44,6 +45,21 @@ public class BeanUtils {
return list;
}
public static <S, T> Set<T> toBean(Set<S> source, Class<T> targetType) {
if (source == null) {
return null;
}
return CollectionUtils.convertSet(source, s -> toBean(s, targetType));
}
public static <S, T> Set<T> toBean(Set<S> source, Class<T> targetType, Consumer<T> peek) {
Set<T> set = toBean(source, targetType);
if (set != null) {
set.forEach(peek);
}
return set;
}
public static <S, T> PageResult<T> toBean(PageResult<S> source, Class<T> targetType) {
return toBean(source, targetType, null);
}