mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
feature:add jdbcType config support
This commit is contained in:
parent
ab4bc2d8c5
commit
9fc1ca1ca2
@ -432,6 +432,7 @@ public class TableInfo {
|
||||
for (ColumnInfo columnInfo : columnInfoList) {
|
||||
ResultMapping mapping = new ResultMapping.Builder(configuration, columnInfo.getProperty(),
|
||||
columnInfo.getColumn(), columnInfo.getPropertyType())
|
||||
.jdbcType(columnInfo.getJdbcType())
|
||||
.typeHandler(columnInfo.getTypeHandler())
|
||||
.build();
|
||||
resultMappings.add(mapping);
|
||||
@ -441,6 +442,7 @@ public class TableInfo {
|
||||
ResultMapping mapping = new ResultMapping.Builder(configuration, idInfo.getProperty(),
|
||||
idInfo.getColumn(), idInfo.getPropertyType())
|
||||
.flags(CollectionUtil.newArrayList(ResultFlag.ID))
|
||||
.jdbcType(idInfo.getJdbcType())
|
||||
.typeHandler(idInfo.getTypeHandler())
|
||||
.build();
|
||||
resultMappings.add(mapping);
|
||||
@ -456,7 +458,7 @@ public class TableInfo {
|
||||
|
||||
TypeHandler typeHandler = columnInfo.getTypeHandler();
|
||||
if (value != null && typeHandler != null) {
|
||||
return new TypeHandlerObject(typeHandler, value, columnInfo.jdbcType);
|
||||
return new TypeHandlerObject(typeHandler, value, columnInfo.getJdbcType());
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
@ -26,6 +26,7 @@ import com.mybatisflex.core.util.CollectionUtil;
|
||||
import com.mybatisflex.core.util.StringUtil;
|
||||
import org.apache.ibatis.reflection.Reflector;
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.TypeHandler;
|
||||
import org.apache.ibatis.type.TypeHandlerRegistry;
|
||||
import org.apache.ibatis.type.UnknownTypeHandler;
|
||||
@ -204,6 +205,11 @@ public class TableInfos {
|
||||
columnInfo.setTypeHandler(typeHandler);
|
||||
}
|
||||
|
||||
|
||||
if (column != null && column.jdbcType() != JdbcType.UNDEFINED){
|
||||
columnInfo.setJdbcType(column.jdbcType());
|
||||
}
|
||||
|
||||
if (FlexConsts.DEFAULT_PRIMARY_FIELD.equals(field.getName())) {
|
||||
idField = field;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user