From c3167e3f0527b796248a8214cb861eb1d302849f Mon Sep 17 00:00:00 2001 From: SanLi <2689170096@qq.com> Date: Fri, 18 Sep 2020 14:21:34 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=94=AF=E6=8C=81=E8=BE=BE?= =?UTF-8?q?=E6=A2=A6=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screw/core/query/dm/DmDataBaseQuery.java | 99 ++++++++++--------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/screw-core/src/main/java/cn/smallbun/screw/core/query/dm/DmDataBaseQuery.java b/screw-core/src/main/java/cn/smallbun/screw/core/query/dm/DmDataBaseQuery.java index efe00b8..dc4c85d 100644 --- a/screw-core/src/main/java/cn/smallbun/screw/core/query/dm/DmDataBaseQuery.java +++ b/screw-core/src/main/java/cn/smallbun/screw/core/query/dm/DmDataBaseQuery.java @@ -54,57 +54,58 @@ */ @SuppressWarnings("serial") public class DmDataBaseQuery extends AbstractDatabaseQuery { - private ConcurrentMap> tablesMap = new ConcurrentHashMap<>(); - private static String DM_QUERY_TABLE_SQL = "" - + "select " - + " ut.table_name TABLE_NAME, " - + " utc.comments COMMENTS " - + "from " - + " user_tables ut " - + "left join USER_TAB_COMMENTS utc " - + "on " - + " ut.table_name=utc.table_name "; + private final ConcurrentMap> tablesMap = new ConcurrentHashMap<>(); + private static final String DM_QUERY_TABLE_SQL = "" + + "select " + + " ut.table_name TABLE_NAME, " + + " utc.comments COMMENTS " + + "from " + + " user_tables ut " + + "left join USER_TAB_COMMENTS utc " + + "on " + + " ut.table_name=utc.table_name "; - private static String DM_QUERY_COLUMNS_SQL = "" + "select " - + " ut.table_name TABLE_NAME , " - + " uc.column_name COLUMN_NAME , " - //+ " case uc.data_type when 'INT' then uc.data_type when 'CLOB' then uc.data_type when 'BLOB' then uc.data_type when 'INTEGER' then uc.data_type else concat(concat(concat(uc.data_type, '('), uc.data_length), ')') end case AS COLUMN_TYPE , " - + " case uc.data_type when 'CLOB' then uc.data_type when 'BLOB' then uc.data_type else concat(concat(concat(uc.data_type, '('), uc.data_length), ')') end case AS COLUMN_TYPE , " - + " uc.data_length COLUMN_LENGTH , " - + " uc.DATA_PRECISION DATA_PRECISION, " - + " uc.DATA_SCALE DECIMAL_DIGITS, " - + " case uc.NULLABLE when 'Y' then '1' else '0' end case NULLABLE," - + " uc.DATA_DEFAULT COLUMN_DEF, " - + " ucc.comments REMARKS " - + "from " - + " user_tables ut " - + "left join USER_TAB_COMMENTS utc " - + "on " - + " ut.table_name=utc.table_name " - + "left join user_tab_columns uc " - + "on " - + " ut.table_name=uc.table_name " - + "left join user_col_comments ucc " - + "on " - + " uc.table_name =ucc.table_name " - + " and uc.column_name=ucc.column_name " - + "where 1=1 "; + private static final String DM_QUERY_COLUMNS_SQL = "" + + "select " + + " ut.table_name TABLE_NAME , " + + " uc.column_name COLUMN_NAME , " + //+ " case uc.data_type when 'INT' then uc.data_type when 'CLOB' then uc.data_type when 'BLOB' then uc.data_type when 'INTEGER' then uc.data_type else concat(concat(concat(uc.data_type, '('), uc.data_length), ')') end case AS COLUMN_TYPE , " + + " case uc.data_type when 'CLOB' then uc.data_type when 'BLOB' then uc.data_type else concat(concat(concat(uc.data_type, '('), uc.data_length), ')') end case AS COLUMN_TYPE , " + + " uc.data_length COLUMN_LENGTH , " + + " uc.DATA_PRECISION DATA_PRECISION, " + + " uc.DATA_SCALE DECIMAL_DIGITS, " + + " case uc.NULLABLE when 'Y' then '1' else '0' end case NULLABLE," + + " uc.DATA_DEFAULT COLUMN_DEF, " + + " ucc.comments REMARKS " + + "from " + + " user_tables ut " + + "left join USER_TAB_COMMENTS utc " + + "on " + + " ut.table_name=utc.table_name " + + "left join user_tab_columns uc " + + "on " + + " ut.table_name=uc.table_name " + + "left join user_col_comments ucc " + + "on " + + " uc.table_name =ucc.table_name " + + " and uc.column_name=ucc.column_name " + + "where 1=1 "; - private static String DM_QUERY_PK_SQL = "" + "SELECT " - + "C.OWNER AS TABLE_SCHEM, " - + "C.TABLE_NAME , " - + "C.COLUMN_NAME , " - + "C.POSITION AS KEY_SEQ , " - + "C.CONSTRAINT_NAME AS PK_NAME " - + "FROM " - + " ALL_CONS_COLUMNS C, " - + " ALL_CONSTRAINTS K " - + "WHERE " - + " K.CONSTRAINT_TYPE = 'P' " - + " AND K.OWNER = '%s' " - + " AND K.CONSTRAINT_NAME = C.CONSTRAINT_NAME " - + " AND K.TABLE_NAME = C.TABLE_NAME " - + " AND K.OWNER = C.OWNER "; + private static final String DM_QUERY_PK_SQL = "" + "SELECT " + + "C.OWNER AS TABLE_SCHEM, " + + "C.TABLE_NAME , " + + "C.COLUMN_NAME , " + + "C.POSITION AS KEY_SEQ , " + + "C.CONSTRAINT_NAME AS PK_NAME " + + "FROM " + + " ALL_CONS_COLUMNS C, " + + " ALL_CONSTRAINTS K " + + "WHERE " + + " K.CONSTRAINT_TYPE = 'P' " + + " AND K.OWNER = '%s' " + + " AND K.CONSTRAINT_NAME = C.CONSTRAINT_NAME " + + " AND K.TABLE_NAME = C.TABLE_NAME " + + " AND K.OWNER = C.OWNER "; /** * 构造函数