diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/enums/NameToTypeEnum.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/enums/NameToTypeEnum.java index 065f702e4..fe6e99830 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/enums/NameToTypeEnum.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/enums/NameToTypeEnum.java @@ -9,6 +9,7 @@ import java.util.Arrays; import java.util.Map; import java.util.stream.Collectors; +// TODO @dhb52:是不是把 FindInSetEnum、NameToTypeEnum 融合,搞成 DbTypeEnum?然后里面 type、productName,findInSet /** * 数据库产品名 => mp DbType 的映射关系 * diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/JdbcUtils.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/JdbcUtils.java index 532162c2a..c7e9e89cd 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/JdbcUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/util/JdbcUtils.java @@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.annotation.DbType; import javax.sql.DataSource; import java.sql.Connection; -import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.SQLException; @@ -53,10 +52,7 @@ public class JdbcUtils { DynamicRoutingDataSource dynamicRoutingDataSource = SpringUtils.getBean(DynamicRoutingDataSource.class); DataSource dataSource = dynamicRoutingDataSource.determineDataSource(); try (Connection conn = dataSource.getConnection()) { - DatabaseMetaData metaData = conn.getMetaData(); - String databaseProductName = metaData.getDatabaseProductName(); - DbType dbType = NameToTypeEnum.find(databaseProductName); - return dbType; + return NameToTypeEnum.find(conn.getMetaData().getDatabaseProductName()); } catch (SQLException e) { throw new IllegalArgumentException(e.getMessage()); }