| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4847,8 +4847,20 @@ protected String concatJoinOn(@NotNull String sql, @NotNull String quote, @NotNu | |||
| 4847 | 4847 | ||
| 4848 | 4848 | String rt = on.getRelateType(); | |
| 4849 | 4849 | if (StringUtil.isEmpty(rt, false)) { | |
| 4850 | - sql += (first ? ON : AND) + quote + jt + quote + "." + quote + on.getKey() + quote + (isNot ? " != " : " = ") | ||
| 4851 | - + quote + getSQLTableWithAlias(on.getTargetTable(), on.getTargetAlias()) + quote + "." + quote + on.getTargetKey() + quote; | ||
| 4850 | + //解决join不支持@cast问题 | ||
| 4851 | + Map castMap = j.getJoinConfig().getCast(); | ||
| 4852 | + if (castMap.isEmpty()) { | ||
| 4853 | + sql += (first ? ON : AND) + quote + jt + quote + "." + quote + on.getKey() + quote + (isNot ? " != " : " = ") | ||
| 4854 | + + quote + on.getTargetTable() + quote + "." + quote + on.getTargetKey() + quote; | ||
| 4855 | + } else { | ||
| 4856 | + String leftTableRelationSql = quote + jt + quote + "." + quote + on.getKey() + quote; | ||
| 4857 | + Object castValueType = castMap.get(on.getOriginKey()); | ||
| 4858 | + if (castValueType != null) { | ||
| 4859 | + leftTableRelationSql = "CAST(" + leftTableRelationSql + " AS " + castValueType + ")"; | ||
| 4860 | + } | ||
| 4861 | + sql += (first ? ON : AND) + leftTableRelationSql + (isNot ? " != " : " = ") | ||
| 4862 | + + quote + on.getTargetTable() + quote + "." + quote + on.getTargetKey() + quote; | ||
| 4863 | + } | ||
| 4852 | 4864 | } | |
| 4853 | 4865 | else { | |
| 4854 | 4866 | onJoinComplexRelation(sql, quote, j, jt, onList, on); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments