| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fb9c267 commit e17422e
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1002,12 +1002,12 @@ else if (join != null){ | |||
| 1002 | 1002 | j.setOriginKey(key); | |
| 1003 | 1003 | j.setOriginValue(targetPath); | |
| 1004 | 1004 | j.setJoinType(joinType); | |
| 1005 | - j.setName(table); | ||
| 1005 | + j.setTable(table); | ||
| 1006 | 1006 | j.setAlias(alias); | |
| 1007 | 1007 | j.setTargetName(targetTable); | |
| 1008 | 1008 | j.setTargetKey(targetKey); | |
| 1009 | 1009 | j.setKeyAndType(key); | |
| 1010 | - j.setTable(getJoinObject(table, tableObj, key)); | ||
| 1010 | + j.setRequest(getJoinObject(table, tableObj, key)); | ||
| 1011 | 1011 | j.setOutter((JSONObject) e.getValue()); | |
| 1012 | 1012 | ||
| 1013 | 1013 | joinList.add(j); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2492,21 +2492,21 @@ public static AbstractSQLConfig parseJoin(RequestMethod method, AbstractSQLConfi | |||
| 2492 | 2492 | } | |
| 2493 | 2493 | ||
| 2494 | 2494 | ||
| 2495 | - String name; | ||
| 2495 | + String table; | ||
| 2496 | 2496 | String alias; | |
| 2497 | 2497 | for (Join j : joinList) { | |
| 2498 | - name = j.getName(); | ||
| 2498 | + table = j.getTable(); | ||
| 2499 | 2499 | alias = j.getAlias(); | |
| 2500 | 2500 | //JOIN子查询不能设置LIMIT,因为ON关系是在子查询后处理的,会导致结果会错误 | |
| 2501 | - SQLConfig joinConfig = newSQLConfig(method, name, alias, j.getTable(), null, false, callback); | ||
| 2502 | - SQLConfig cacheConfig = newSQLConfig(method, name, alias, j.getTable(), null, false, callback).setCount(1); | ||
| 2501 | + SQLConfig joinConfig = newSQLConfig(method, table, alias, j.getRequest(), null, false, callback); | ||
| 2502 | + SQLConfig cacheConfig = newSQLConfig(method, table, alias, j.getRequest(), null, false, callback).setCount(1); | ||
| 2503 | 2503 | ||
| 2504 | 2504 | if (j.isAppJoin() == false) { //除了 @ APP JOIN,其它都是 SQL JOIN,则副表要这样配置 | |
| 2505 | 2505 | if (joinConfig.getDatabase() == null) { | |
| 2506 | 2506 | joinConfig.setDatabase(config.getDatabase()); //解决主表 JOIN 副表,引号不一致 | |
| 2507 | 2507 | } | |
| 2508 | 2508 | else if (joinConfig.getDatabase().equals(config.getDatabase()) == false) { | |
| 2509 | - throw new IllegalArgumentException("主表 " + config.getTable() + " 的 @database:" + config.getDatabase() + " 和它 SQL JOIN 的副表 " + name + " 的 @database:" + joinConfig.getDatabase() + " 不一致!"); | ||
| 2509 | + throw new IllegalArgumentException("主表 " + config.getTable() + " 的 @database:" + config.getDatabase() + " 和它 SQL JOIN 的副表 " + table + " 的 @database:" + joinConfig.getDatabase() + " 不一致!"); | ||
| 2510 | 2510 | } | |
| 2511 | 2511 | if (joinConfig.getSchema() == null) { | |
| 2512 | 2512 | joinConfig.setSchema(config.getSchema()); //主表 JOIN 副表,默认 schema 一致 | |
@@ -2521,7 +2521,7 @@ else if (joinConfig.getDatabase().equals(config.getDatabase()) == false) { | |||
| 2521 | 2521 | joinConfig.setMain(false).setKeyPrefix(true); | |
| 2522 | 2522 | ||
| 2523 | 2523 | if (j.isLeftOrRightJoin()) { | |
| 2524 | - SQLConfig outterConfig = newSQLConfig(method, name, alias, j.getOutter(), null, false, callback); | ||
| 2524 | + SQLConfig outterConfig = newSQLConfig(method, table, alias, j.getOutter(), null, false, callback); | ||
| 2525 | 2525 | outterConfig.setMain(false).setKeyPrefix(true).setDatabase(joinConfig.getDatabase()).setSchema(joinConfig.getSchema()); //解决主表 JOIN 副表,引号不一致 | |
| 2526 | 2526 | j.setOutterConfig(outterConfig); | |
| 2527 | 2527 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,8 +30,8 @@ public class Join { | |||
| 30 | 30 | ||
| 31 | 31 | private String joinType; // "@" - APP, "&" - INNER, "|" - FULL, "!" - OUTTER, "<" - LEFT, ">" - RIGHT, "^" - SIDE, "*" - CROSS | |
| 32 | 32 | private String relateType; // "" - 一对一, "{}" - 一对多, "<>" - 多对一 | |
| 33 | - private JSONObject table; // { "id@":"/Moment/userId" } | ||
| 34 | - private String name; //User | ||
| 33 | + private JSONObject request; // { "id@":"/Moment/userId" } | ||
| 34 | + private String table; //User | ||
| 35 | 35 | private String alias; //owner | |
| 36 | 36 | private String key; //id | |
| 37 | 37 | private String targetName; // Moment | |
@@ -76,23 +76,23 @@ public void setRelateType(String relateType) { | |||
| 76 | 76 | this.relateType = relateType; | |
| 77 | 77 | } | |
| 78 | 78 | ||
| 79 | - public String getName() { | ||
| 80 | - return name; | ||
| 79 | + public String getTable() { | ||
| 80 | + return table; | ||
| 81 | 81 | } | |
| 82 | - public void setName(String name) { | ||
| 83 | - this.name = name; | ||
| 82 | + public void setTable(String table) { | ||
| 83 | + this.table = table; | ||
| 84 | 84 | } | |
| 85 | 85 | public String getAlias() { | |
| 86 | 86 | return alias; | |
| 87 | 87 | } | |
| 88 | 88 | public void setAlias(String alias) { | |
| 89 | 89 | this.alias = alias; | |
| 90 | 90 | } | |
| 91 | - public JSONObject getTable() { | ||
| 92 | - return table; | ||
| 91 | + public JSONObject getRequest() { | ||
| 92 | + return request; | ||
| 93 | 93 | } | |
| 94 | - public void setTable(JSONObject table) { | ||
| 95 | - this.table = table; | ||
| 94 | + public void setRequest(JSONObject request) { | ||
| 95 | + this.request = request; | ||
| 96 | 96 | } | |
| 97 | 97 | public String getKey() { | |
| 98 | 98 | return key; | |
@@ -146,7 +146,7 @@ public void setKeyAndType(@NotNull String originKey) throws Exception { //id, id | |||
| 146 | 146 | originKey = originKey.substring(0, originKey.length() - 1); | |
| 147 | 147 | } | |
| 148 | 148 | else { //TODO 暂时只允许 User.id = Moment.userId 字段关联,不允许 User.id = 82001 这种 | |
| 149 | - throw new IllegalArgumentException(joinType + "/.../" + name + "/" + originKey + " 不合法!join:'.../refKey'" + " 中 refKey 必须以 @ 结尾!"); | ||
| 149 | + throw new IllegalArgumentException(joinType + "/.../" + table + "/" + originKey + " 不合法!join:'.../refKey'" + " 中 refKey 必须以 @ 结尾!"); | ||
| 150 | 150 | } | |
| 151 | 151 | ||
| 152 | 152 | if (originKey.endsWith("{}")) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments