Skip to content

Commit

Permalink
Java: MultiDataSource 完善驼峰与蛇形命名互转的代码
Browse files Browse the repository at this point in the history
  • Loading branch information
TommyLemon committed Dec 23, 2023
1 parent f8ca8af commit 5e71493
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,7 @@ public String getDBUri() {
return "";
}

@Override
public String getSQLTable() {
String t = super.getSQLTable();
return isInfluxDB() ? t.toLowerCase() : t;
}


// TODO 迁移到 APIJSON 主项目 <<<<<<<<<<<<<<<<<<<<
@Override
Expand Down Expand Up @@ -390,10 +386,20 @@ protected void onJoinComplexRelation(String sql, String quote, Join join, String
}


@Override
public String getSQLTable() {
String t = super.getSQLTable();
return isInfluxDB() ? t.toLowerCase() : t;
// return isInfluxDB() ? t.toLowerCase() : StringUtil.firstCase(JSONRequest.recoverUnderline(t, false), false);
}

// 取消注释可将前端传参驼峰命名转为蛇形命名 aBCdEfg => upper ? A_B_CD_EFG : a_b_cd_efg
// @Override
// public String getSQLKey(String key) {
// return super.getSQLKey(JSONRequest.recoverUnderline(key, false));
// if (DemoVerifier.SYSTEM_ACCESS_MAP.containsKey(getTable())) {
// return key;
// }
// return super.getSQLKey(StringUtil.firstCase(JSONRequest.recoverUnderline(key, false), false));
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,11 @@ public JSONObject execute(@NotNull SQLConfig<Long> config, boolean unknownType)
// @Override
// protected String getKey(SQLConfig<Long> config, java.sql.ResultSet rs, ResultSetMetaData rsmd, int tablePosition, JSONObject table, int columnIndex, Map<String, JSONObject> childMap) throws Exception {
// String key = super.getKey(config, rs, rsmd, tablePosition, table, columnIndex, childMap);
// return JSONResponse.formatUnderline(key, true);
// String tbl = StringUtil.firstCase(JSONResponse.formatUnderline(rsmd.getTableName(columnIndex), true), true);
// if (DemoVerifier.SYSTEM_ACCESS_MAP.containsKey(tbl)) {
// return key;
// }
// return StringUtil.firstCase(JSONResponse.formatUnderline(key, true), false);
// }

}

0 comments on commit 5e71493

Please sign in to comment.