From edc2fbe31b9aa0a4c7a98a504c10ce344e9be172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=90=A6=E6=B6=9B?= Date: Mon, 17 Apr 2023 17:00:44 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20bug=E3=80=91=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90=E5=99=A8=E6=B7=BB=E5=8A=A0oracle=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=A1=A8=E5=A4=87=E6=B3=A8=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jero/codegenerate/database/DbReadTableUtil.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jero-boot/jero-boot-base/jero-boot-base-generater-core/src/main/java/com/jero/codegenerate/database/DbReadTableUtil.java b/jero-boot/jero-boot-base/jero-boot-base-generater-core/src/main/java/com/jero/codegenerate/database/DbReadTableUtil.java index 54626c09..5f9d9b00 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-generater-core/src/main/java/com/jero/codegenerate/database/DbReadTableUtil.java +++ b/jero-boot/jero-boot-base/jero-boot-base-generater-core/src/main/java/com/jero/codegenerate/database/DbReadTableUtil.java @@ -536,7 +536,7 @@ public class DbReadTableUtil { } //通过表名获取表备注 - public String remarks(String a) throws SQLException, ClassNotFoundException { + public String remarks(String tableName) throws SQLException, ClassNotFoundException { Connection connection = null; Statement statement = null; try { @@ -544,7 +544,15 @@ public class DbReadTableUtil { connection = DriverManager.getConnection(com.jero.codegenerate.properties.CodeConfigProperties.databaseUrl, com.jero.codegenerate.properties.CodeConfigProperties.username, com.jero.codegenerate.properties.CodeConfigProperties.password); statement = connection.createStatement(1005, 1007); - String sqlStr = "SELECT table_comment FROM information_schema.TABLES WHERE table_name = " + "'"+a+"'"; + String sqlStr = ""; + if (com.jero.codegenerate.properties.CodeConfigProperties.databaseType.equals(DbConvertDef.MYSQL)) { + // mysql获取表的列信息sql + sqlStr = "SELECT table_comment FROM information_schema.TABLES WHERE table_name = " + "'"+tableName+"'"; + } + // oracle获取表的列信息sql + if (com.jero.codegenerate.properties.CodeConfigProperties.databaseType.equals(DbConvertDef.ORACLE)) { + sqlStr = "SELECT comments FROM user_tab_comments WHERE table_name = '" + tableName.toUpperCase() + "'"; + } ResultSet resultSet = statement.executeQuery(sqlStr); while(resultSet.next()) { String name = resultSet.getString(1);