| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a85e642 commit 7ae52ec
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,7 +19,7 @@ | |||
| 19 | 19 | import java.io.UnsupportedEncodingException; | |
| 20 | 20 | import java.util.ArrayList; | |
| 21 | 21 | import java.util.HashMap; | |
| 22 | - import java.util.HashSet; | ||
| 22 | + import java.util.LinkedHashSet; | ||
| 23 | 23 | import java.util.List; | |
| 24 | 24 | import java.util.Map; | |
| 25 | 25 | import java.util.Set; | |
@@ -754,9 +754,9 @@ private List<Join> onJoinParse(String join, JSONObject request) throws Exception | |||
| 754 | 754 | + "必须为 &/Table0/key0,</Table1/key1,... 这种形式!"); | |
| 755 | 755 | } | |
| 756 | 756 | 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 | + // } | ||
| 760 | 760 | path = path.substring(index + 1); | |
| 761 | 761 | ||
| 762 | 762 | index = path.indexOf("/"); | |
@@ -769,16 +769,16 @@ private List<Join> onJoinParse(String join, JSONObject request) throws Exception | |||
| 769 | 769 | ||
| 770 | 770 | //取出Table对应的JSONObject,及内部引用赋值 key:value | |
| 771 | 771 | tableObj = request.getJSONObject(table); | |
| 772 | - targetPath = tableObj == null ? null : tableObj.getString(key+"@"); | ||
| 772 | + targetPath = tableObj == null ? null : tableObj.getString(key); | ||
| 773 | 773 | 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' !"); | ||
| 775 | 775 | } | |
| 776 | 776 | ||
| 777 | 777 | //取出引用赋值路径targetPath对应的Table和key | |
| 778 | 778 | index = targetPath.lastIndexOf("/"); | |
| 779 | 779 | targetKey = index < 0 ? null : targetPath.substring(index + 1); | |
| 780 | 780 | if (StringUtil.isEmpty(targetKey, true)) { | |
| 781 | - throw new IllegalArgumentException(table + "." + key + "@:'/targetTable/targetKey' 中targetKey不能为空!"); | ||
| 781 | + throw new IllegalArgumentException(table + "." + key + ":'/targetTable/targetKey' 中targetKey不能为空!"); | ||
| 782 | 782 | } | |
| 783 | 783 | ||
| 784 | 784 | targetPath = targetPath.substring(0, index); | |
@@ -790,17 +790,18 @@ private List<Join> onJoinParse(String join, JSONObject request) throws Exception | |||
| 790 | 790 | targetObj = request.getJSONObject(targetTable); | |
| 791 | 791 | if (targetObj == null) { | |
| 792 | 792 | throw new IllegalArgumentException(targetTable + "." + targetKey | |
| 793 | - + "@:'/targetTable/targetKey' 中路径对应的对象不存在!"); | ||
| 793 | + + ":'/targetTable/targetKey' 中路径对应的对象不存在!"); | ||
| 794 | 794 | } | |
| 795 | - targetObj.put(key+"@", targetObj.remove(key+"@")); //保证和SQLExcecutor缓存的Config里where顺序一致,生成的SQL也就一致 | ||
| 795 | + | ||
| 796 | + tableObj.put(key, tableObj.remove(key)); //保证和SQLExcecutor缓存的Config里where顺序一致,生成的SQL也就一致 | ||
| 796 | 797 | ||
| 797 | 798 | Join j = new Join(); | |
| 798 | 799 | j.setJoinType(joinType); | |
| 799 | - j.setTable(getJoinObject(table, tableObj, key)); | ||
| 800 | 800 | j.setName(table); | |
| 801 | - j.setKey(key); | ||
| 802 | 801 | j.setTargetName(targetTable); | |
| 803 | 802 | j.setTargetKey(targetKey); | |
| 803 | + j.setKeyAndType(key); | ||
| 804 | + j.setTable(getJoinObject(table, tableObj, key)); | ||
| 804 | 805 | ||
| 805 | 806 | joinList.add(j); | |
| 806 | 807 | ||
@@ -855,7 +856,7 @@ private JSONObject getJoinObject(String table, JSONObject obj, String key) { | |||
| 855 | 856 | ||
| 856 | 857 | //取出所有join条件 | |
| 857 | 858 | JSONObject requestObj = new JSONObject(true);//(JSONObject) obj.clone();// | |
| 858 | - HashSet<String> set = new HashSet<>(obj.keySet()); | ||
| 859 | + Set<String> set = new LinkedHashSet<>(obj.keySet()); | ||
| 859 | 860 | for (String k : set) { | |
| 860 | 861 | if (StringUtil.isEmpty(k, true)) { | |
| 861 | 862 | continue; | |
@@ -868,7 +869,7 @@ private JSONObject getJoinObject(String table, JSONObject obj, String key) { | |||
| 868 | 869 | } | |
| 869 | 870 | else { | |
| 870 | 871 | if (k.endsWith("@")) { | |
| 871 | - if (k.equals(key+"@")) { | ||
| 872 | + if (k.equals(key)) { | ||
| 872 | 873 | continue; | |
| 873 | 874 | } | |
| 874 | 875 | throw new UnsupportedOperationException(table + "." + k + " 不合法!" + JSONRequest.KEY_JOIN | |
| Back | FazBrowse Home | New Git URL |
0 commit comments