代码优化

This commit is contained in:
2025-06-05 12:59:32 +08:00
parent 721cd48d96
commit c65bd7b36f
2 changed files with 2 additions and 4 deletions

View File

@@ -4,7 +4,6 @@ import com.yanghuanglin.seq.enums.DbType;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
/**
@@ -134,9 +133,8 @@ public class GeneratorConfig {
public DbType getDbType() {
if (this.dbType == null) {
Connection connection = null;
try {
connection = dataSource.getConnection();
Connection connection = dataSource.getConnection();
String productName = connection.getMetaData().getDatabaseProductName();
this.dbType = DbType.of(productName);
} catch (SQLException e) {

View File

@@ -30,7 +30,7 @@ public enum DbType {
*/
public static DbType of(String productName) {
for (DbType value : DbType.values()) {
if (value.name().equalsIgnoreCase(productName.replace(" ","_"))) {
if (value.name().equalsIgnoreCase(productName.replace(" ", "_"))) {
return value;
}
}