diff --git a/eladmin-common/src/main/java/me/zhengjie/annotation/Query.java b/eladmin-common/src/main/java/me/zhengjie/annotation/Query.java index c5bbcca6d..6f693ecfa 100644 --- a/eladmin-common/src/main/java/me/zhengjie/annotation/Query.java +++ b/eladmin-common/src/main/java/me/zhengjie/annotation/Query.java @@ -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 } } diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java b/eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java index cc9980846..321b766d8 100644 --- a/eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java +++ b/eladmin-common/src/main/java/me/zhengjie/utils/QueryHelp.java @@ -100,6 +100,13 @@ public static Predicate getPredicate(Root 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; } }