@@ -260,7 +260,9 @@ public JSONObject execute(@NotNull SQLConfig config, boolean unknowType) throws
260260 Log .i (TAG , ">>> execute result = getCache('" + sql + "', " + position + ") = " + result );
261261 if (result != null ) {
262262 cachedSQLCount ++;
263-
263+ if (getCache (sql ,config ).size () > 1 ) {
264+ result .put (KEY_RAW_LIST , getCache (sql ,config ));
265+ }
264266 Log .d (TAG , "\n \n execute result != null >> return result;" + "\n >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n \n " );
265267 return result ;
266268 }
@@ -589,19 +591,17 @@ else if (curJoin.isOuterJoin() || curJoin.isAntiJoin()) {
589591
590592 if (isHead == false ) {
591593 // @ APP JOIN 查询副表并缓存到 childMap <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
592-
593- executeAppJoin (config , resultList , childMap );
594+ Map < String , List < JSONObject >> appJoinChildMap = new HashMap <>();
595+ executeAppJoin (config , resultList , appJoinChildMap );
594596
595597 // @ APP JOIN 查询副表并缓存到 childMap >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
596598
597599 //子查询 SELECT Moment.*, Comment.id 中的 Comment 内字段
598- Set <Entry <String , JSONObject >> set = childMap .entrySet ();
600+ Set <Entry <String , List < JSONObject >>> set = appJoinChildMap .entrySet ();
599601
600602 //<sql, Table>
601- for (Entry <String , JSONObject > entry : set ) {
602- List <JSONObject > l = new ArrayList <>();
603- l .add (entry .getValue ());
604- putCache (entry .getKey (), l , null );
603+ for (Entry <String , List <JSONObject >> entry : set ) {
604+ putCache (entry .getKey (), entry .getValue (), null );
605605 }
606606
607607 putCache (sql , resultList , config );
@@ -633,7 +633,7 @@ else if (curJoin.isOuterJoin() || curJoin.isAntiJoin()) {
633633 * @param childMap
634634 * @throws Exception
635635 */
636- protected void executeAppJoin (SQLConfig config , List <JSONObject > resultList , Map <String , JSONObject > childMap ) throws Exception {
636+ protected void executeAppJoin (SQLConfig config , List <JSONObject > resultList , Map <String , List < JSONObject > > childMap ) throws Exception {
637637 List <Join > joinList = config .getJoinList ();
638638 if (joinList != null ) {
639639
@@ -737,8 +737,12 @@ protected void executeAppJoin(SQLConfig config, List<JSONObject> resultList, Map
737737 }
738738 }
739739 cacheSql = cc .getSQL (false );
740- childMap .put (cacheSql , result );
741-
740+ List <JSONObject > results = childMap .get (cacheSql );
741+ if (results == null ) {
742+ results = new ArrayList <>();
743+ childMap .put (cacheSql ,results );
744+ }
745+ results .add (result );
742746 Log .d (TAG , ">>> executeAppJoin childMap.put('" + cacheSql + "', result); childMap.size() = " + childMap .size ());
743747 }
744748 }
0 commit comments