mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
支持通过FlexConfiguration预注册的自定义typeHandler,同时解决需要带自定义初始化参数的问题
This commit is contained in:
parent
3330a417a9
commit
8dd5578d15
@ -435,7 +435,12 @@ public class TableInfoFactory {
|
|||||||
Class<?> typeHandlerClass = columnAnnotation.typeHandler();
|
Class<?> typeHandlerClass = columnAnnotation.typeHandler();
|
||||||
Configuration configuration = FlexGlobalConfig.getDefaultConfig().getConfiguration();
|
Configuration configuration = FlexGlobalConfig.getDefaultConfig().getConfiguration();
|
||||||
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
|
TypeHandlerRegistry typeHandlerRegistry = configuration.getTypeHandlerRegistry();
|
||||||
typeHandler = typeHandlerRegistry.getInstance(columnInfo.getPropertyType(), typeHandlerClass);
|
Class<?> propertyType = columnInfo.getPropertyType();
|
||||||
|
JdbcType jdbcType = columnAnnotation.jdbcType();
|
||||||
|
typeHandler = typeHandlerRegistry.getTypeHandler(propertyType, jdbcType);
|
||||||
|
if (typeHandler == null || !typeHandlerClass.isAssignableFrom(typeHandler.getClass())) {
|
||||||
|
typeHandler = typeHandlerRegistry.getInstance(propertyType, typeHandlerClass);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
columnInfo.setTypeHandler(typeHandler);
|
columnInfo.setTypeHandler(typeHandler);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user