Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
优化 AbstractParser.java 缩进
  • Loading branch information
TommyLemon authored Jul 20, 2025
commit 2122b8c89408bfb48ec60862057cb428c74904fb
54 changes: 27 additions & 27 deletions APIJSONORM/src/main/java/apijson/orm/AbstractParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -1563,39 +1563,39 @@ else if (join != null){
throw new UnsupportedDataTypeException(TAG + ".onJoinParse join 只能是 String 或 Map<String, Object> 类型!");
}

List<Entry<String, Object>> slashKeys = new ArrayList<>();
List<Entry<String, Object>> nonSlashKeys = new ArrayList<>();
Set<Entry<String, Object>> entries = joinMap == null ? null : joinMap.entrySet();
List<Entry<String, Object>> slashKeys = new ArrayList<>();
List<Entry<String, Object>> nonSlashKeys = new ArrayList<>();
Set<Entry<String, Object>> entries = joinMap == null ? null : joinMap.entrySet();

if (entries == null || entries.isEmpty()) {
Log.e(TAG, "onJoinParse set == null || set.isEmpty() >> return null;");
return null;
}
for (Entry<String, Object> e : entries) {
String path = e.getKey();
if (path != null && path.indexOf("/") > 0) {
slashKeys.add(e); // 以 / 开头的 key,例如 </Table/key@
} else {
nonSlashKeys.add(e); // 普通 key,例如 Table: {}
}
}
if (entries == null || entries.isEmpty()) {
Log.e(TAG, "onJoinParse set == null || set.isEmpty() >> return null;");
return null;
}
for (Entry<String, Object> e : entries) {
String path = e.getKey();
if (path != null && path.indexOf("/") > 0) {
slashKeys.add(e); // 以 / 开头的 key,例如 </Table/key@
} else {
nonSlashKeys.add(e); // 普通 key,例如 Table: {}
}
}

Map<String, Object> whereJoinMap = new LinkedHashMap<>();
Map<String, Object> whereJoinMap = new LinkedHashMap<>();

for (Entry<String, Object> e : nonSlashKeys) {
String tableKey = e.getKey(); // 如 "Location_info"
Object tableObj = e.getValue(); // value 是 Map
for (Entry<String, Object> e : nonSlashKeys) {
String tableKey = e.getKey(); // 如 "Location_info"
Object tableObj = e.getValue(); // value 是 Map

if (request.containsKey(tableKey)) {
whereJoinMap.put(tableKey, tableObj);
} else {
Log.w(TAG, "跳过 join 中 key = " + tableKey + ",因为它不在 request 中");
}
}

if (request.containsKey(tableKey)) {
whereJoinMap.put(tableKey, tableObj);
} else {
Log.w(TAG, "跳过 join 中 key = " + tableKey + ",因为它不在 request 中");
}
}

Set<Entry<String, Object>> set = joinMap == null ? null : new LinkedHashSet<>(slashKeys);

Set<Entry<String, Object>> set = joinMap == null ? null : new LinkedHashSet<>(slashKeys);
;
if (set == null || set.isEmpty()) {
Log.e(TAG, "onJoinParse set == null || set.isEmpty() >> return null;");
return null;
Expand Down