From bab860e1a027513f6c04ed31c1942f496acba6a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E8=BE=9E=E6=9C=AA=E5=AF=92?= <545073804@qq.com> Date: Mon, 6 Jan 2025 03:35:13 +0000 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96MapstructUtils?= =?UTF-8?q?=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 秋辞未寒 <545073804@qq.com> --- .../org/dromara/common/core/utils/MapstructUtils.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/MapstructUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/MapstructUtils.java index 07357d819..a3add4391 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/MapstructUtils.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/MapstructUtils.java @@ -59,7 +59,7 @@ public class MapstructUtils { * @return target */ public static V convert(T source, V target) { - if (ObjectUtil.hasNull(source)) { + if (ObjectUtil.hasNull(source, target)) { return null; } return CONVERTER.convert(source, target); @@ -74,7 +74,7 @@ public class MapstructUtils { * @return target */ public static V convert(T source, V target, Consumer beanConsumer) { - if (ObjectUtil.hasNull(source)) { + if (ObjectUtil.hasNull(source, target)) { return null; } return CONVERTER.convert(source, target, beanConsumer); @@ -88,7 +88,7 @@ public class MapstructUtils { * @return targetType */ public static List convert(List sourceList, Class targetType) { - if (CollUtil.isEmpty(sourceList)) { + if (CollUtil.isEmpty(sourceList) || ObjectUtil.isNull(targetType)) { return CollUtil.newArrayList(); } return CONVERTER.convert(sourceList, targetType); @@ -103,7 +103,7 @@ public class MapstructUtils { * @return targetType */ public static List convert(List sourceList, Class targetType, Consumer beanConsumer) { - if (CollUtil.isEmpty(sourceList)) { + if (CollUtil.isEmpty(sourceList) || ObjectUtil.isNull(targetType)) { return CollUtil.newArrayList(); } return CONVERTER.convert(sourceList, targetType, beanConsumer);