@@ -467,12 +467,15 @@ && isInRelationMap(path) == false) {
467467 }
468468
469469 boolean nameIsNumber = StringUtil .isNumer (name );
470+ String table = Pair .parseEntry (name ).getValue ();
471+ Log .d (TAG , "getObject table = " + table );
472+
470473 QueryConfig config = nameIsNumber ? parentConfig : null ;
471474 if (config == null ) {
472- config = new QueryConfig (requestMethod , name ).setCount (1 );
475+ config = new QueryConfig (requestMethod , table ).setCount (1 );
473476 }
474477 //避免"[]":{"0":{"1":{}}}这种导致第3层当成[]的直接子Object
475- if (nameIsNumber && ("" + config .getPosition ()).equals (name ) == false ) {
478+ if (nameIsNumber && ("" + config .getPosition ()).equals (table ) == false ) {
476479 config .setPosition (0 ).setCount (1 ).setPage (0 );
477480 }
478481
@@ -507,7 +510,7 @@ && isInRelationMap(path) == false) {
507510 }
508511 } else if (requestMethod == PUT && JSON .isJSONArray (value )) {//PUT JSONArray
509512 JSONArray array = ((JSONArray ) value );
510- if (array != null && array .isEmpty () == false && isTableKey (name )) {
513+ if (array != null && array .isEmpty () == false && isTableKey (table )) {
511514 int putType = 0 ;
512515 if (key .endsWith ("+" )) {//add
513516 putType = 1 ;
@@ -526,13 +529,13 @@ && isInRelationMap(path) == false) {
526529 arrayRequest .put (Table .ID , request .get (Table .ID ));
527530 // arrayRequest.setColumn(realKey);//put请求会对id添加功能符?
528531 arrayRequest .put (JSONRequest .KEY_COLUMN , realKey );
529- JSONRequest getRequest = new JSONRequest (name , arrayRequest );
532+ JSONRequest getRequest = new JSONRequest (table , arrayRequest );
530533 JSONObject response = new RequestParser ().parseResponse (getRequest );
531534 //GET >>>>>>>>>>>>>>>>>>>>>>>>>
532535
533536
534537 //add all 或 remove all <<<<<<<<<<<<<<<<<<<<<<<<<
535- response = response == null ? null : response .getJSONObject (name );
538+ response = response == null ? null : response .getJSONObject (table );
536539 JSONArray targetArray = response == null ? null : response .getJSONArray (realKey );
537540 if (targetArray == null ) {
538541 targetArray = new JSONArray ();
@@ -582,8 +585,8 @@ && isInRelationMap(path) == false) {
582585
583586 Object target = getValueByPath (getRelationPath (getAbsPath (path , replaceKey )), true );
584587 Log .d (TAG , "getObject value = " + value + ";> + target );
585- if (((String ) value ).equals (target ) && isTableKey (name )) {
586- Log .e (TAG , "getObject ((String) value).equals(target) && isTableKey(name ) >> return null;" );
588+ if (((String ) value ).equals (target ) && isTableKey (table )) {
589+ Log .e (TAG , "getObject ((String) value).equals(target) && isTableKey(table ) >> return null;" );
587590 return null ;//parseRelation时还获取不到就不用再做无效的query了。不考虑 Table:{Table:{}}嵌套
588591 }
589592 if (key .startsWith ("@" )) {
@@ -616,10 +619,10 @@ && isInRelationMap(path) == false) {
616619
617620
618621 //执行SQL操作数据库
619- if (containRelation == false && isTableKey (name )) {//提高性能
622+ if (containRelation == false && isTableKey (table )) {//提高性能
620623 if (parseRelation == false || isInRelationMap (path )) {//避免覆盖原来已经获取的
621624 // keyValuePathMap.remove(path);
622- QueryConfig config2 = newQueryConfig (name , transferredRequest );
625+ QueryConfig config2 = newQueryConfig (table , transferredRequest );
623626
624627 if (parentConfig != null ) {
625628 config2 .setCount (parentConfig .getCount ()).setPage (parentConfig .getPage ())
@@ -1073,7 +1076,9 @@ public static String getRealKey(RequestMethod method, String originKey, boolean
10731076
10741077 //"User:toUser":User转换"toUser":User, User为查询同名Table得到的JSONObject。交给客户端处理更好?不,查询就得截取
10751078 if (isTableKey ) {//不允许在column key中使用Type:key形式
1076- key = Pair .parseEntry (key , null ).getKey ();
1079+ key = Pair .parseEntry (key , false ).getKey ();//table以左边为准
1080+ } else {
1081+ key = Pair .parseEntry (key ).getValue ();//column以右边为准
10771082 }
10781083
10791084 if (isWord (key .startsWith ("@" ) ? key .substring (1 ) : key ) == false ) {
0 commit comments