!561 使用封装好的StreamUtils工具类代替项目中的部分stream操作

* refactor : 使用封装好的StreamUtils工具类代替项目中的部分stream操作
This commit is contained in:
DoubleH
2024-07-06 05:58:26 +00:00
committed by 疯狂的狮子Li
parent 0cb3105cea
commit 6cc24dc763
8 changed files with 43 additions and 10 deletions

View File

@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.toolkit.Db;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StreamUtils;
import java.io.Serializable;
import java.util.Collection;
@ -341,7 +342,7 @@ public interface BaseMapperPlus<T, V> extends BaseMapper<T> {
* @return 查询到的符合条件的对象列表,经过转换为指定类型的对象后返回
*/
default <C> List<C> selectObjs(Wrapper<T> wrapper, Function<? super Object, C> mapper) {
return this.selectObjs(wrapper).stream().filter(Objects::nonNull).map(mapper).collect(Collectors.toList());
return StreamUtils.toList(this.selectObjs(wrapper), mapper);
}
}