【fix bug】代码生成器添加oracle查询表备注分支
This commit is contained in:
+10
-2
@@ -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;
|
Connection connection = null;
|
||||||
Statement statement = null;
|
Statement statement = null;
|
||||||
try {
|
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);
|
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);
|
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);
|
ResultSet resultSet = statement.executeQuery(sqlStr);
|
||||||
while(resultSet.next()) {
|
while(resultSet.next()) {
|
||||||
String name = resultSet.getString(1);
|
String name = resultSet.getString(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user