1919import java .io .UnsupportedEncodingException ;
2020import java .util .ArrayList ;
2121import java .util .HashMap ;
22- import java .util .HashSet ;
22+ import java .util .LinkedHashSet ;
2323import java .util .List ;
2424import java .util .Map ;
2525import java .util .Set ;
@@ -754,9 +754,9 @@ private List<Join> onJoinParse(String join, JSONObject request) throws Exception
754754+ "必须为 &/Table0/key0,</Table1/key1,... 这种形式!" );
755755}
756756String joinType = path .substring (0 , index ); //& | ! < > ( ) <> () *
757- if (StringUtil .isEmpty (joinType , true )) {
758- joinType = "|" ; // FULL JOIN / UNIOIN
759- }
757+ // if (StringUtil.isEmpty(joinType, true)) {
758+ // joinType = "|"; // FULL JOIN
759+ // }
760760path = path .substring (index + 1 );
761761
762762index = path .indexOf ("/" );
@@ -769,16 +769,16 @@ private List<Join> onJoinParse(String join, JSONObject request) throws Exception
769769
770770//取出Table对应的JSONObject,及内部引用赋值 key:value
771771tableObj = request .getJSONObject (table );
772- targetPath = tableObj == null ? null : tableObj .getString (key + "@" );
772+ targetPath = tableObj == null ? null : tableObj .getString (key );
773773if (StringUtil .isEmpty (targetPath , true )) {
774- throw new IllegalArgumentException (table + "." + key + "@ :value 中value必须为引用赋值的路径 '/targetTable/targetKey' !" );
774+ throw new IllegalArgumentException (table + "." + key + ":value 中value必须为引用赋值的路径 '/targetTable/targetKey' !" );
775775}
776776
777777//取出引用赋值路径targetPath对应的Table和key
778778index = targetPath .lastIndexOf ("/" );
779779targetKey = index < 0 ? null : targetPath .substring (index + 1 );
780780if (StringUtil .isEmpty (targetKey , true )) {
781- throw new IllegalArgumentException (table + "." + key + "@ :'/targetTable/targetKey' 中targetKey不能为空!" );
781+ throw new IllegalArgumentException (table + "." + key + ":'/targetTable/targetKey' 中targetKey不能为空!" );
782782}
783783
784784targetPath = targetPath .substring (0 , index );
@@ -790,17 +790,18 @@ private List<Join> onJoinParse(String join, JSONObject request) throws Exception
790790targetObj = request .getJSONObject (targetTable );
791791if (targetObj == null ) {
792792throw new IllegalArgumentException (targetTable + "." + targetKey
793- + "@ :'/targetTable/targetKey' 中路径对应的对象不存在!" );
793+ + ":'/targetTable/targetKey' 中路径对应的对象不存在!" );
794794}
795- targetObj .put (key +"@" , targetObj .remove (key +"@" )); //保证和SQLExcecutor缓存的Config里where顺序一致,生成的SQL也就一致
795+
796+ tableObj .put (key , tableObj .remove (key )); //保证和SQLExcecutor缓存的Config里where顺序一致,生成的SQL也就一致
796797
797798Join j = new Join ();
798799j .setJoinType (joinType );
799- j .setTable (getJoinObject (table , tableObj , key ));
800800j .setName (table );
801- j .setKey (key );
802801j .setTargetName (targetTable );
803802j .setTargetKey (targetKey );
803+ j .setKeyAndType (key );
804+ j .setTable (getJoinObject (table , tableObj , key ));
804805
805806joinList .add (j );
806807
@@ -855,7 +856,7 @@ private JSONObject getJoinObject(String table, JSONObject obj, String key) {
855856
856857//取出所有join条件
857858JSONObject requestObj = new JSONObject (true );//(JSONObject) obj.clone();//
858- HashSet <String > set = new HashSet <>(obj .keySet ());
859+ Set <String > set = new LinkedHashSet <>(obj .keySet ());
859860for (String k : set ) {
860861if (StringUtil .isEmpty (k , true )) {
861862continue ;
@@ -868,7 +869,7 @@ private JSONObject getJoinObject(String table, JSONObject obj, String key) {
868869}
869870else {
870871if (k .endsWith ("@" )) {
871- if (k .equals (key + "@" )) {
872+ if (k .equals (key )) {
872873continue ;
873874}
874875throw new UnsupportedOperationException (table + "." + k + " 不合法!" + JSONRequest .KEY_JOIN
0 commit comments