Skip to content

Commit

Permalink
feat: 实现和配置 TABLE_SCHEMA_MAP 映射表名和数据库(模式)名,感谢 csx-bill 的贡献 #27
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyLemon authored Jun 2, 2024
2 parents 99cb455 + 9b9cf81 commit 1519942
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/apijson/framework/APIJSONVerifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public static <T> JSONObject initAccess(boolean shutdownWhenServerError, APIJSON
Map<String, Map<RequestMethod, String[]>> newMap = new LinkedHashMap<>();
Map<String, Map<String, Object>> fakeDeleteMap = new LinkedHashMap<>();
Map<String, String> newTKMap = new LinkedHashMap<>();
Map<String, String> tableSchemaMap = new LinkedHashMap<>();

SortedMap<Integer, Map<String, List<String>>> versionedTableColumnMap = new TreeMap<>(ColumnUtil.DESC_COMPARATOR);
SortedMap<Integer, Map<String, Map<String, String>>> versionedKeyColumnMap = new TreeMap<>(ColumnUtil.DESC_COMPARATOR);
Expand All @@ -208,6 +209,7 @@ public static <T> JSONObject initAccess(boolean shutdownWhenServerError, APIJSON

String name = item.getString("name");
String alias = item.getString("alias");
String schema = item.getString("schema");

Map<String, Object> fakemap = new HashMap<>();
String deletedKey = item.getString(AbstractSQLConfig.KEY_DELETED_KEY);
Expand Down Expand Up @@ -251,6 +253,7 @@ public static <T> JSONObject initAccess(boolean shutdownWhenServerError, APIJSON
newMap.put(alias, map);
fakeDeleteMap.put(alias, fakemap);
newTKMap.put(alias, name);
tableSchemaMap.put(alias, schema);

if (ENABLE_VERIFY_COLUMN) {
JSONObject columns = item.getJSONObject("columns");
Expand Down Expand Up @@ -313,10 +316,12 @@ public static <T> JSONObject initAccess(boolean shutdownWhenServerError, APIJSON
ACCESS_MAP = newMap;
ACCESS_FAKE_DELETE_MAP = fakeDeleteMap;
APIJSONSQLConfig.TABLE_KEY_MAP = newTKMap;
APIJSONSQLConfig.TABLE_SCHEMA_MAP = tableSchemaMap;
} else {
ACCESS_MAP.putAll(newMap);
ACCESS_FAKE_DELETE_MAP.putAll(fakeDeleteMap);
APIJSONSQLConfig.TABLE_KEY_MAP.putAll(newTKMap);
APIJSONSQLConfig.TABLE_SCHEMA_MAP = tableSchemaMap;
}

if (ENABLE_VERIFY_COLUMN) {
Expand Down

0 comments on commit 1519942

Please sign in to comment.