From 6a072a57ba8f314f727d7d50a368f6718901dc11 Mon Sep 17 00:00:00 2001 From: guanmengyuan Date: Sun, 22 Oct 2023 22:11:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DfieldMapping=20?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E7=B1=BB=E5=9E=8B=E6=9F=A5=E8=AF=A2null?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mybatisflex/core/field/FieldQueryManager.java | 4 ++++ .../java/com/mybatisflex/core/table/TableInfoFactory.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/field/FieldQueryManager.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/field/FieldQueryManager.java index 59f586d2..35e16de4 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/field/FieldQueryManager.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/field/FieldQueryManager.java @@ -26,6 +26,8 @@ import com.mybatisflex.core.util.CollectionUtil; import java.lang.reflect.Array; import java.util.*; +import static com.mybatisflex.core.table.TableInfoFactory.defaultSupportColumnTypes; + /** * 属性查询管理。 * @@ -87,6 +89,8 @@ public class FieldQueryManager { Class componentType = filedType.getComponentType(); List objects = mapper.selectListByQueryAs(queryWrapper, componentType); value = getArrayValue(componentType, objects); + } else if (defaultSupportColumnTypes.contains(filedType)) { + value = mapper.selectObjectByQueryAs(queryWrapper, filedType); } else { value = mapper.selectOneByQueryAs(queryWrapper, filedType); // 循环查询嵌套类 diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/TableInfoFactory.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/TableInfoFactory.java index 5146439e..152d983b 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/TableInfoFactory.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/table/TableInfoFactory.java @@ -50,7 +50,7 @@ public class TableInfoFactory { private TableInfoFactory() { } - static final Set> defaultSupportColumnTypes = CollectionUtil.newHashSet( + public static final Set> defaultSupportColumnTypes = CollectionUtil.newHashSet( int.class, Integer.class, short.class, Short.class, long.class, Long.class,