feat: 实现和配置 TABLE_SCHEMA_MAP
This commit is contained in:
parent
72996e9550
commit
201c078083
@ -130,6 +130,11 @@ public abstract class AbstractSQLConfig<T extends Object> implements SQLConfig<T
|
||||
public static Pattern PATTERN_RANGE;
|
||||
public static Pattern PATTERN_FUNCTION;
|
||||
|
||||
/**
|
||||
* 表 SCHEMA 映射
|
||||
*/
|
||||
public static Map<String, String> TABLE_SCHEMA_MAP;
|
||||
|
||||
/**
|
||||
* 表名映射,隐藏真实表名,对安全要求很高的表可以这么做
|
||||
*/
|
||||
@ -157,6 +162,19 @@ public abstract class AbstractSQLConfig<T extends Object> implements SQLConfig<T
|
||||
// TODO 改成更好的正则,校验前面为单词,中间为操作符,后面为值
|
||||
PATTERN_FUNCTION = Pattern.compile("^[A-Za-z0-9%,:_@&~`!=\\<\\>\\|\\[\\]\\{\\} /\\.\\+\\-\\*\\^\\?\\(\\)\\$]+$");
|
||||
|
||||
TABLE_SCHEMA_MAP = new HashMap<>();
|
||||
TABLE_SCHEMA_MAP.put(Table.class.getSimpleName(), DEFAULT_SCHEMA);
|
||||
TABLE_SCHEMA_MAP.put(Column.class.getSimpleName(), DEFAULT_SCHEMA);
|
||||
TABLE_SCHEMA_MAP.put(PgClass.class.getSimpleName(), DEFAULT_SCHEMA);
|
||||
TABLE_SCHEMA_MAP.put(PgAttribute.class.getSimpleName(), DEFAULT_SCHEMA);
|
||||
TABLE_SCHEMA_MAP.put(SysTable.class.getSimpleName(), DEFAULT_SCHEMA);
|
||||
TABLE_SCHEMA_MAP.put(SysColumn.class.getSimpleName(), DEFAULT_SCHEMA);
|
||||
TABLE_SCHEMA_MAP.put(ExtendedProperty.class.getSimpleName(), DEFAULT_SCHEMA);
|
||||
TABLE_SCHEMA_MAP.put(AllTable.class.getSimpleName(), DEFAULT_SCHEMA);
|
||||
TABLE_SCHEMA_MAP.put(AllColumn.class.getSimpleName(), DEFAULT_SCHEMA);
|
||||
TABLE_SCHEMA_MAP.put(AllTableComment.class.getSimpleName(), DEFAULT_SCHEMA);
|
||||
TABLE_SCHEMA_MAP.put(AllColumnComment.class.getSimpleName(), DEFAULT_SCHEMA);
|
||||
|
||||
TABLE_KEY_MAP = new HashMap<>();
|
||||
TABLE_KEY_MAP.put(Table.class.getSimpleName(), Table.TABLE_NAME);
|
||||
TABLE_KEY_MAP.put(Column.class.getSimpleName(), Column.TABLE_NAME);
|
||||
@ -1320,7 +1338,8 @@ public abstract class AbstractSQLConfig<T extends Object> implements SQLConfig<T
|
||||
return ""; //Oracle, Dameng 的 all_tables, dba_tables 和 all_tab_columns, dba_columns 表好像不属于任何 Schema
|
||||
}
|
||||
|
||||
String sch = getSchema();
|
||||
//String sch = getSchema();
|
||||
String sch = TABLE_SCHEMA_MAP.get(table);
|
||||
return sch == null ? DEFAULT_SCHEMA : sch;
|
||||
}
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user