@@ -689,7 +689,7 @@ && isInRelationMap(path) == false) {
689689 * @param parentConfig parentObject对子object的SQL查询配置
690690 * @param name parentObject的key
691691 * @param request parentObject的value
692- * @return
692+ * @return 转为JSONArray不可行,因为会和被当成条件的key:JSONArray冲突。好像一般也就key{}:JSONArray用到??
693693 * @throws Exception
694694 */
695695 private JSONObject getArray (String parentPath , QueryConfig parentConfig , String name
@@ -721,9 +721,11 @@ private JSONObject getArray(String parentPath, QueryConfig parentConfig, String
721721 Set <String > set = new LinkedHashSet <>(request .keySet ());
722722 if (count <= 0 || count > 5 ) {//5以下不优化长度
723723 if (parseRelation == false && set != null ) {
724+ String table ;
724725 Object value ;
725726 for (String key : set ) {
726- value = isTableKey (key ) ? request .get (key ) : null ;
727+ table = Pair .parseEntry (key , true ).getKey ();
728+ value = isTableKey (table ) ? request .get (key ) : null ;
727729 if (value != null && value instanceof JSONObject ) {// && value.isEmpty() == false) {
728730 // totalCount = QueryHelper.getInstance().getCount(key);
729731 firstTableKey = key ;
@@ -732,7 +734,7 @@ private JSONObject getArray(String parentPath, QueryConfig parentConfig, String
732734 // JSONObject target = response == null ? null : response.getJSONObject(key);
733735 // total = target == null ? 0 : target.getIntValue(JSONResponse.KEY_COUNT);
734736
735- total = estimateMaxCount (path , key , (JSONObject ) value );
737+ total = estimateMaxCount (path , table , (JSONObject ) value );
736738 break ;
737739 }
738740 }
@@ -825,9 +827,9 @@ private JSONObject getArray(String parentPath, QueryConfig parentConfig, String
825827 * @return
826828 * @throws Exception
827829 */
828- public int estimateMaxCount (String path , String name , JSONObject value ) throws Exception {
829- if (StringUtil .isNotEmpty (name , true ) == false ) {
830- Log .e (TAG , "estimateMaxCount StringUtil.isNotEmpty(name , true) == false >> return 0;" );
830+ public int estimateMaxCount (String path , String table , JSONObject value ) throws Exception {
831+ if (StringUtil .isNotEmpty (table , true ) == false ) {
832+ Log .e (TAG , "estimateMaxCount StringUtil.isNotEmpty(table , true) == false >> return 0;" );
831833 return 0 ;
832834 }
833835
@@ -870,10 +872,9 @@ public int estimateMaxCount(String path, String name, JSONObject value) throws E
870872 }
871873 }
872874
873- name = Pair .parseEntry (name , true ).getKey ();
874- JSONObject response = new Parser (RequestMethod .HEAD ).parseResponse (new JSONRequest (name , request ));
875+ JSONObject response = new Parser (RequestMethod .HEAD ).parseResponse (new JSONRequest (table , request ));
875876 if (response != null ) {
876- response = response .getJSONObject (name );
877+ response = response .getJSONObject (table );
877878 }
878879 return response == null ? 0 : response .getIntValue (JSONResponse .KEY_COUNT );
879880 }
0 commit comments