fix: 修复fieldMapping 基础类型查询null的情况

This commit is contained in:
guanmengyuan 2023-10-22 22:11:17 +08:00
parent ea83639365
commit 6a072a57ba
2 changed files with 5 additions and 1 deletions

View File

@ -26,6 +26,8 @@ import com.mybatisflex.core.util.CollectionUtil;
import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.util.*; import java.util.*;
import static com.mybatisflex.core.table.TableInfoFactory.defaultSupportColumnTypes;
/** /**
* 属性查询管理 * 属性查询管理
* *
@ -87,6 +89,8 @@ public class FieldQueryManager {
Class<?> componentType = filedType.getComponentType(); Class<?> componentType = filedType.getComponentType();
List<?> objects = mapper.selectListByQueryAs(queryWrapper, componentType); List<?> objects = mapper.selectListByQueryAs(queryWrapper, componentType);
value = getArrayValue(componentType, objects); value = getArrayValue(componentType, objects);
} else if (defaultSupportColumnTypes.contains(filedType)) {
value = mapper.selectObjectByQueryAs(queryWrapper, filedType);
} else { } else {
value = mapper.selectOneByQueryAs(queryWrapper, filedType); value = mapper.selectOneByQueryAs(queryWrapper, filedType);
// 循环查询嵌套类 // 循环查询嵌套类

View File

@ -50,7 +50,7 @@ public class TableInfoFactory {
private TableInfoFactory() { private TableInfoFactory() {
} }
static final Set<Class<?>> defaultSupportColumnTypes = CollectionUtil.newHashSet( public static final Set<Class<?>> defaultSupportColumnTypes = CollectionUtil.newHashSet(
int.class, Integer.class, int.class, Integer.class,
short.class, Short.class, short.class, Short.class,
long.class, Long.class, long.class, Long.class,