This commit is contained in:
kamhung
2015-12-03 16:17:05 +08:00
parent d5c0ff1e8a
commit 56418b5fe3
2 changed files with 7 additions and 2 deletions

View File

@@ -90,7 +90,7 @@ final class FilterBeanNode extends FilterNode {
}
final String jc = joinCol.column().isEmpty() ? secinfo.getPrimary().field() : joinCol.column();
if (first) {
joinsb.append(" INNER JOIN ").append(secinfo.getTable())
joinsb.append(" ").append(joinCol.type().name()).append(" JOIN ").append(secinfo.getTable())
.append(" ").append(alias).append(" ON ").append(secinfo.getSQLColumn("a", jc)).append(" = ").append(secinfo.getSQLColumn(alias, jc));
}
newnode.foreignCache = secinfo.getCache();

View File

@@ -10,7 +10,6 @@ import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* 只支持 INNER JOIN
*
* @author zhangjx
*/
@@ -20,6 +19,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME)
public @interface FilterJoinColumn {
public enum JoinType { //不能支持RIGHT 因为right获取的主对象都是null
INNER;
}
/**
* 关联表 通常join表默认别名为b/c/d/...自增, 被join表默认别名为a
*
@@ -34,4 +38,5 @@ public @interface FilterJoinColumn {
*/
String column() default "";
JoinType type() default JoinType.INNER;
}