From 12d724c247e4f7dcb77b3a94891ccf4d86b53cfa Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期一, 15 十二月 2025 09:43:07 +0800
Subject: [PATCH] 经销商供货价信息

---
 server/dmmall_service/src/main/java/com/doumee/core/utils/ListUtil.java |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/server/dmmall_service/src/main/java/com/doumee/core/utils/ListUtil.java b/server/dmmall_service/src/main/java/com/doumee/core/utils/ListUtil.java
new file mode 100644
index 0000000..877cc22
--- /dev/null
+++ b/server/dmmall_service/src/main/java/com/doumee/core/utils/ListUtil.java
@@ -0,0 +1,39 @@
+package com.doumee.core.utils;
+
+import org.springframework.beans.BeanUtils;
+
+import java.util.List;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+
+/**
+ * Created by IntelliJ IDEA.
+ *
+ * @Author : Rk
+ * @create 2025/12/12 9:31
+ */
+public class ListUtil {
+
+    public static <S, T> List<T> copyProperties(List<S> sources, Supplier<T> target) {
+        return sources.stream().map(source -> {
+            T t = target.get();
+            BeanUtils.copyProperties(source, t);
+            return t;
+        }).collect(Collectors.toList());
+    }
+
+    public static <S, T> List<T> copyListProperties(List<S> sources, Class<T> target) {
+        return sources.stream().map(source -> {
+            T t;
+            try {
+                t = target.newInstance();
+            } catch (Exception e) {
+                e.printStackTrace();
+                return null;
+            }
+            BeanUtils.copyProperties(source, t);
+            return t;
+        }).collect(Collectors.toList());
+    }
+
+}

--
Gitblit v1.9.3