Skip to content

Commit

Permalink
[代码优化](v2.5): @query 加入 INNER 查询
Browse files Browse the repository at this point in the history
  • Loading branch information
elunez committed Jun 21, 2020
1 parent a24d4f7 commit 73eb350
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ enum Type {
* 适用于简单连接查询,复杂的请自定义该注解,或者使用sql查询
*/
enum Join {
/** jie 2019-6-4 13:18:30 左右连接 */
LEFT, RIGHT
/** jie 2019-6-4 13:18:30 */
LEFT, RIGHT, INNER
}

}
Expand Down
7 changes: 7 additions & 0 deletions eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ public static <R, Q> Predicate getPredicate(Root<R> root, Q query, CriteriaBuild
join = root.join(name, JoinType.RIGHT);
}
break;
case INNER:
if(ObjectUtil.isNotNull(join) && ObjectUtil.isNotNull(val)){
join = join.join(name, JoinType.INNER);
} else {
join = root.join(name, JoinType.INNER);
}
break;
default: break;
}
}
Expand Down

0 comments on commit 73eb350

Please sign in to comment.