Skip to content

Commit

Permalink
♻️ 重构代码
Browse files Browse the repository at this point in the history
  • Loading branch information
leshalv committed Aug 26, 2020
1 parent bb9bfeb commit cc88d5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ public List<OracleColumnModel> getTableColumns(String table) throws QueryExcepti
if (CollectionUtils.isEmpty(columnsCaching)) {
//查询全部
if (table.equals(PERCENT_SIGN)) {
String sql = "SELECT ut.TABLE_NAME, -- 表名称 ut.COLUMN_NAME,--字段名称 uc.comments as REMARKS,--字段注释 concat(concat(concat(ut.DATA_TYPE, '('), ut.DATA_LENGTH), ')') AS COLUMN_TYPE,--字典类型 ut.DATA_LENGTH as COLUMN_LENGTH--字典长度 FROM user_tab_columns ut INNER JOIN user_col_comments uc ON ut.TABLE_NAME = uc.table_name AND ut.COLUMN_NAME = uc.column_name";
String sql = "SELECT ut.TABLE_NAME, ut.COLUMN_NAME, uc.comments as REMARKS, concat(concat(concat(ut.DATA_TYPE, '('), ut.DATA_LENGTH), ')') AS COLUMN_TYPE, ut.DATA_LENGTH as COLUMN_LENGTH FROM user_tab_columns ut INNER JOIN user_col_comments uc ON ut.TABLE_NAME = uc.table_name AND ut.COLUMN_NAME = uc.column_name";
if (isDda()) {
sql = "SELECT ut.TABLE_NAME, -- 表名称 ut.COLUMN_NAME,--字段名称 uc.comments as REMARKS,--字段注释 concat(concat(concat(ut.DATA_TYPE, '('), ut.DATA_LENGTH), ')') AS COLUMN_TYPE,--字典类型 ut.DATA_LENGTH as COLUMN_LENGTH--字典长度 FROM dba_tab_columns ut INNER JOIN dba_col_comments uc ON ut.TABLE_NAME = uc.table_name AND ut.COLUMN_NAME = uc.column_name and ut.OWNER = uc.OWNER WHERE ut.OWNER = '"
sql = "SELECT ut.TABLE_NAME, ut.COLUMN_NAME, uc.comments as REMARKS, concat(concat(concat(ut.DATA_TYPE, '('), ut.DATA_LENGTH), ')') AS COLUMN_TYPE, ut.DATA_LENGTH as COLUMN_LENGTH FROM dba_tab_columns ut INNER JOIN dba_col_comments uc ON ut.TABLE_NAME = uc.table_name AND ut.COLUMN_NAME = uc.column_name and ut.OWNER = uc.OWNER WHERE ut.OWNER = '"
+ getDataBase() + "'";
}
PreparedStatement statement = prepareStatement(sql);
Expand All @@ -155,9 +155,9 @@ public List<OracleColumnModel> getTableColumns(String table) throws QueryExcepti
}
//单表查询
else {
String sql = "SELECT ut.TABLE_NAME, -- 表名称 ut.COLUMN_NAME,--字段名称 uc.comments as REMARKS,--字段注释 concat(concat(concat(ut.DATA_TYPE, '('), ut.DATA_LENGTH), ')') AS COLUMN_TYPE,--字典类型 ut.DATA_LENGTH as COLUMN_LENGTH--字典长度 FROM user_tab_columns ut INNER JOIN user_col_comments uc ON ut.TABLE_NAME = uc.table_name AND ut.COLUMN_NAME = uc.column_name WHERE ut.Table_Name = '%s'";
String sql = "SELECT ut.TABLE_NAME, ut.COLUMN_NAME, uc.comments as REMARKS, concat(concat(concat(ut.DATA_TYPE, '('), ut.DATA_LENGTH), ')') AS COLUMN_TYPE, ut.DATA_LENGTH as COLUMN_LENGTH FROM user_tab_columns ut INNER JOIN user_col_comments uc ON ut.TABLE_NAME = uc.table_name AND ut.COLUMN_NAME = uc.column_name WHERE ut.Table_Name = '%s'";
if (isDda()) {
sql = "SELECT ut.TABLE_NAME, -- 表名称 ut.COLUMN_NAME,--字段名称 uc.comments as REMARKS,--字段注释 concat(concat(concat(ut.DATA_TYPE, '('), ut.DATA_LENGTH), ')') AS COLUMN_TYPE,--字典类型 ut.DATA_LENGTH as COLUMN_LENGTH--字典长度 FROM dba_tab_columns ut INNER JOIN dba_col_comments uc ON ut.TABLE_NAME = uc.table_name AND ut.COLUMN_NAME = uc.column_name and ut.OWNER = uc.OWNER WHERE ut.Table_Name = '%s' ut.OWNER = '"
sql = "SELECT ut.TABLE_NAME, ut.COLUMN_NAME, uc.comments as REMARKS, concat(concat(concat(ut.DATA_TYPE, '('), ut.DATA_LENGTH), ')') AS COLUMN_TYPE, ut.DATA_LENGTH as COLUMN_LENGTH FROM dba_tab_columns ut INNER JOIN dba_col_comments uc ON ut.TABLE_NAME = uc.table_name AND ut.COLUMN_NAME = uc.column_name and ut.OWNER = uc.OWNER WHERE ut.Table_Name = '%s' ut.OWNER = '"
+ getDataBase() + "'";
}
resultSet = prepareStatement(String.format(sql, table)).executeQuery();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ void build() throws IOException {
hikariConfig.setJdbcUrl(getUrl());
hikariConfig.setUsername(getUserName());
hikariConfig.setPassword(getPassword());
// hikariConfig.addDataSourceProperty("remarks", "true");
hikariConfig.setMinimumIdle(2);
hikariConfig.setMaximumPoolSize(5);
HikariDataSource dataSource = new HikariDataSource(hikariConfig);
Expand All @@ -58,7 +57,7 @@ void build() throws IOException {
//生成文件路径
.fileOutputDir(fileOutputDir)
//文件类型
.fileType(EngineFileType.HTML)
.fileType(EngineFileType.WORD)
//打开文件夹
.openOutputDir(true)
//生成模板实现
Expand Down

0 comments on commit cc88d5d

Please sign in to comment.