@@ -523,18 +523,18 @@ && isInRelationMap(path) == false) {
523523
524524 if (value instanceof JSONObject ) {//JSONObject,往下一级提取
525525 if (isArrayKey (key )) {//APIJSON Array
526- result = getArray (path , parentConfig , key , (JSONObject ) value );
526+ result = getArray (path , key , (JSONObject ) value );
527527 } else {//APIJSON Object
528528 result = getObject (path , isFirst && isArrayChild //以第0个JSONObject为准
529529 ? parentConfig : null , key , (JSONObject ) value );
530-
530+
531531 //如果第0个都为空,那后面的也都无意义了。
532532 if (isFirst && isArrayChild && (result == null || result .isEmpty ())) {
533533 Log .d (TAG , "getObject isFirst && isArrayChild"
534534 + " && (result == null || result.isEmpty()) >> return null;" );
535535 return null ;
536536 }
537-
537+
538538 isFirst = false ;//[]里第一个不能为[]
539539 }
540540 Log .i (TAG , "getObject key = " + key + "; result = " + result );
@@ -727,8 +727,7 @@ && isInRelationMap(path) == false) {
727727 * @return 转为JSONArray不可行,因为会和被当成条件的key:JSONArray冲突。好像一般也就key{}:JSONArray用到??
728728 * @throws Exception
729729 */
730- private JSONObject getArray (String parentPath , QueryConfig parentConfig , String name
731- , final JSONObject request ) throws Exception {
730+ private JSONObject getArray (String parentPath , String name , JSONObject request ) throws Exception {
732731 Log .i (TAG , "\n \n \n getArray parentPath = " + parentPath
733732 + "; name = " + name + "; request = " + JSON .toJSONString (request ));
734733 if (isHeadMethod (requestMethod , true )) {
@@ -743,6 +742,7 @@ private JSONObject getArray(String parentPath, QueryConfig parentConfig, String
743742
744743 count = request .getIntValue (JSONRequest .KEY_COUNT );
745744 page = request .getIntValue (JSONRequest .KEY_PAGE );
745+
746746 request .remove (JSONRequest .KEY_COUNT );
747747 request .remove (JSONRequest .KEY_PAGE );
748748
@@ -752,8 +752,8 @@ private JSONObject getArray(String parentPath, QueryConfig parentConfig, String
752752
753753 //最好先获取第一个table的所有项(where条件),填充一个列表?
754754 Set <String > set = new LinkedHashSet <>(request .keySet ());
755- if ( count <= 0 || count > 5 ) {//5以下不优化长度
756- if ( parseRelation == false && set != null ) {
755+ if ( parseRelation == false && set != null ) {
756+ if ( count <= 0 || count > 5 ) {//5以下不优化长度
757757 String table ;
758758 Object value ;
759759 for (String key : set ) {
@@ -778,7 +778,7 @@ private JSONObject getArray(String parentPath, QueryConfig parentConfig, String
778778
779779 QueryConfig config = new QueryConfig (requestMethod , count , page );
780780
781-
781+
782782 JSONObject transferredRequest = new JSONObject (true );
783783
784784 JSONObject parent = null ;
@@ -808,7 +808,7 @@ private JSONObject getArray(String parentPath, QueryConfig parentConfig, String
808808 config .setPosition (Integer .valueOf (0 + StringUtil .getNumber (key , true )));
809809 isArrayKey = isArrayKey (key );
810810 if (isArrayKey ) {//json array
811- result = getArray (path , config , key , (JSONObject ) value );
811+ result = getArray (path , key , (JSONObject ) value );
812812 } else {//json object
813813 result = getObject (path , config , key , (JSONObject ) value );
814814 }
@@ -826,6 +826,10 @@ private JSONObject getArray(String parentPath, QueryConfig parentConfig, String
826826 }
827827 }
828828
829+ //解决[]:{Comment[]:{...}}内层count,page丢失
830+ request .put (JSONRequest .KEY_COUNT , count );
831+ request .put (JSONRequest .KEY_PAGE , page );
832+
829833 Log .i (TAG , "getArray return " + JSON .toJSONString (transferredRequest ) + "\n >>>>>>>>>>>>>>>\n \n \n " );
830834
831835 return transferredRequest ;
0 commit comments