Skip to content

Commit c3a3399

Browse files
authored
getSQLSchema 根据优先级处理不同情况
1 parent 201c078 commit c3a3399

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,7 @@ public String getSchema() {
13231323
@Override
13241324
public String getSQLSchema() {
13251325
String table = getTable();
1326-
//强制,避免因为全局默认的 @schema 自动填充进来,导致这几个类的 schema 为 sys 等其它值
1326+
// FIXME 全部默认填充判断是 系统表 则不填充 // 强制,避免因为全局默认的 @schema 自动填充进来,导致这几个类的 schema 为 sys 等其它值
13271327
if (Table.TAG.equals(table) || Column.TAG.equals(table)) {
13281328
return SCHEMA_INFORMATION; //MySQL, PostgreSQL, SQL Server 都有的
13291329
}
@@ -1338,9 +1338,11 @@ public String getSQLSchema() {
13381338
return ""; //Oracle, Dameng 的 all_tables, dba_tables 和 all_tab_columns, dba_columns 表好像不属于任何 Schema
13391339
}
13401340

1341-
//String sch = getSchema();
1342-
String sch = TABLE_SCHEMA_MAP.get(table);
1343-
return sch == null ? DEFAULT_SCHEMA : sch;
1341+
String sch = getSchema(); // 前端传参 @schema 优先
1342+
if (sch == null) {
1343+
sch = TABLE_SCHEMA_MAP.get(table); // 其次 Access 表 alias 和 schema 配置
1344+
}
1345+
return sch == null ? DEFAULT_SCHEMA : sch; // 最后代码默认兜底配置
13441346
}
13451347
@Override
13461348
public AbstractSQLConfig setSchema(String schema) {

0 commit comments

Comments
 (0)