Skip to content

Commit 5d40217

Browse files
committed
解决 JOIN 副表返回空对象
1 parent b92fab3 commit 5d40217

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,10 @@ protected JSONObject onPutColumn(@NotNull SQLConfig config, @NotNull ResultSet r
783783
String lable = getKey(config, rs, rsmd, tablePosition, table, columnIndex, childMap);
784784
Object value = getValue(config, rs, rsmd, tablePosition, table, columnIndex, lable, childMap);
785785

786-
// 必须 put 进去,否则某个字段为 null 可能导致中断后续正常返回值 if (value != null) {
787-
table.put(lable, value);
788-
// }
786+
// 主表必须 put 至少一个 null 进去,否则全部字段为 null 都不 put 会导致中断后续正常返回值
787+
if (value != null || (join == null && table.isEmpty())) {
788+
table.put(lable, value);
789+
}
789790

790791
return table;
791792
}

0 commit comments

Comments
 (0)