JoinType的类型:
类型 |
描述 |
FULL_JOIN |
FULL JOIN 全连接 |
INNER_JOIN |
INNER JOIN 内连接 |
LEFT_JOIN |
LEFT JOIN 左连接 |
RIGHT_JOIN |
RIGHT JOIN 右连接 |
举例默认说明:
AliasTable test = query.join(Test.class);//默认alias为t1
Column column1 = test.c("type");
Column column2 = new Column("b","id");
对象 |
描述 |
new Join(test) .on(column1, column2); |
默认Left Join LEFT JOIN Test t1 ON t1.type = b.id |
new Join(test) .on(column1, column2) .on(column1, 1, ExpressionType.CDT_MORE); |
LEFT JOIN Test t1 ON t1.type = b.id AND t1.type > 1 |
new Join(test, JoinType.RIGHT_JOIN) .on(column1, column2); |
RIGHT JOIN Test t1 ON t1.type = b.id |