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 }
756756 String 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+ // }
760760 path = path .substring (index + 1 );
761761
762762 index = path .indexOf ("/" );
@@ -769,16 +769,16 @@ private List<Join> onJoinParse(String join, JSONObject request) throws Exception
769769
770770 //取出Table对应的JSONObject,及内部引用赋值 key:value
771771 tableObj = request .getJSONObject (table );
772- targetPath = tableObj == null ? null : tableObj .getString (key + "@" );
772+ targetPath = tableObj == null ? null : tableObj .getString (key );
773773 if (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
778778 index = targetPath .lastIndexOf ("/" );
779779 targetKey = index < 0 ? null : targetPath .substring (index + 1 );
780780 if (StringUtil .isEmpty (targetKey , true )) {
781- throw new IllegalArgumentException (table + "." + key + "@ :'/targetTable/targetKey' 中targetKey不能为空!" );
781+ throw new IllegalArgumentException (table + "." + key + ":'/targetTable/targetKey' 中targetKey不能为空!" );
782782 }
783783
784784 targetPath = targetPath .substring (0 , index );
@@ -790,17 +790,18 @@ private List<Join> onJoinParse(String join, JSONObject request) throws Exception
790790 targetObj = request .getJSONObject (targetTable );
791791 if (targetObj == null ) {
792792 throw 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
797798 Join j = new Join ();
798799 j .setJoinType (joinType );
799- j .setTable (getJoinObject (table , tableObj , key ));
800800 j .setName (table );
801- j .setKey (key );
802801 j .setTargetName (targetTable );
803802 j .setTargetKey (targetKey );
803+ j .setKeyAndType (key );
804+ j .setTable (getJoinObject (table , tableObj , key ));
804805
805806 joinList .add (j );
806807
@@ -855,7 +856,7 @@ private JSONObject getJoinObject(String table, JSONObject obj, String key) {
855856
856857 //取出所有join条件
857858 JSONObject requestObj = new JSONObject (true );//(JSONObject) obj.clone();//
858- HashSet <String > set = new HashSet <>(obj .keySet ());
859+ Set <String > set = new LinkedHashSet <>(obj .keySet ());
859860 for (String k : set ) {
860861 if (StringUtil .isEmpty (k , true )) {
861862 continue ;
@@ -868,7 +869,7 @@ private JSONObject getJoinObject(String table, JSONObject obj, String key) {
868869 }
869870 else {
870871 if (k .endsWith ("@" )) {
871- if (k .equals (key + "@" )) {
872+ if (k .equals (key )) {
872873 continue ;
873874 }
874875 throw new UnsupportedOperationException (table + "." + k + " 不合法!" + JSONRequest .KEY_JOIN
0 commit comments