mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
1.修复MybatisKeyGeneratorUtil类的空指针异常
2.修复MapperInvocationHandler的数据类型强转异常
This commit is contained in:
parent
09d649d296
commit
062723a69c
@ -56,6 +56,12 @@ public class MybatisKeyGeneratorUtil {
|
|||||||
|
|
||||||
|
|
||||||
public static KeyGenerator createIdKeyGenerator(TableInfo tableInfo, MappedStatement ms, IdInfo idInfo) {
|
public static KeyGenerator createIdKeyGenerator(TableInfo tableInfo, MappedStatement ms, IdInfo idInfo) {
|
||||||
|
FlexGlobalConfig flexGlobalConfig = FlexGlobalConfig.getConfig(ms.getConfiguration());
|
||||||
|
|
||||||
|
if(flexGlobalConfig == null){
|
||||||
|
return NoKeyGenerator.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
FlexGlobalConfig.KeyConfig globalKeyConfig = FlexGlobalConfig.getConfig(ms.getConfiguration()).getKeyConfig();
|
FlexGlobalConfig.KeyConfig globalKeyConfig = FlexGlobalConfig.getConfig(ms.getConfiguration()).getKeyConfig();
|
||||||
KeyType keyType = getKeyType(idInfo, globalKeyConfig);
|
KeyType keyType = getKeyType(idInfo, globalKeyConfig);
|
||||||
|
|
||||||
|
|||||||
@ -41,7 +41,12 @@ public class MapperInvocationHandler implements InvocationHandler {
|
|||||||
|
|
||||||
public MapperInvocationHandler(Object mapper, DataSource dataSource) {
|
public MapperInvocationHandler(Object mapper, DataSource dataSource) {
|
||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
this.dataSource = (FlexDataSource) dataSource;
|
if(dataSource instanceof FlexDataSource){
|
||||||
|
this.dataSource = (FlexDataSource) dataSource;
|
||||||
|
}else{
|
||||||
|
this.dataSource = null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +70,7 @@ public class MapperInvocationHandler implements InvocationHandler {
|
|||||||
//优先获取用户自己配置的 dbType
|
//优先获取用户自己配置的 dbType
|
||||||
DbType dbType = DialectFactory.getHintDbType();
|
DbType dbType = DialectFactory.getHintDbType();
|
||||||
if (dbType == null) {
|
if (dbType == null) {
|
||||||
if (dataSourceKey != null) {
|
if (dataSourceKey != null && dataSource != null) {
|
||||||
dbType = dataSource.getDbType(dataSourceKey);
|
dbType = dataSource.getDbType(dataSourceKey);
|
||||||
}
|
}
|
||||||
if (dbType == null) {
|
if (dbType == null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user