Commit ba4d4540abc67433ad17a6ebb4e98ef5a66640d0
1 parent
71add4b0
条件判断添加支持JOIN表的属性
Showing
1 changed file
with
12 additions
and
12 deletions
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/MPJLambdaWrapperX.java
| ... | ... | @@ -20,7 +20,7 @@ import java.util.function.Consumer; |
| 20 | 20 | */ |
| 21 | 21 | public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { |
| 22 | 22 | |
| 23 | - public MPJLambdaWrapperX<T> likeIfPresent(SFunction<T, ?> column, String val) { | |
| 23 | + public <R> MPJLambdaWrapperX<T> likeIfPresent(SFunction<R, ?> column, String val) { | |
| 24 | 24 | MPJWrappers.lambdaJoin().like(column, val); |
| 25 | 25 | if (StringUtils.hasText(val)) { |
| 26 | 26 | return (MPJLambdaWrapperX<T>) super.like(column, val); |
| ... | ... | @@ -28,63 +28,63 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { |
| 28 | 28 | return this; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public MPJLambdaWrapperX<T> inIfPresent(SFunction<T, ?> column, Collection<?> values) { | |
| 31 | + public <R> MPJLambdaWrapperX<T> inIfPresent(SFunction<R, ?> column, Collection<?> values) { | |
| 32 | 32 | if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) { |
| 33 | 33 | return (MPJLambdaWrapperX<T>) super.in(column, values); |
| 34 | 34 | } |
| 35 | 35 | return this; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public MPJLambdaWrapperX<T> inIfPresent(SFunction<T, ?> column, Object... values) { | |
| 38 | + public <R> MPJLambdaWrapperX<T> inIfPresent(SFunction<R, ?> column, Object... values) { | |
| 39 | 39 | if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) { |
| 40 | 40 | return (MPJLambdaWrapperX<T>) super.in(column, values); |
| 41 | 41 | } |
| 42 | 42 | return this; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public MPJLambdaWrapperX<T> eqIfPresent(SFunction<T, ?> column, Object val) { | |
| 45 | + public <R> MPJLambdaWrapperX<T> eqIfPresent(SFunction<R, ?> column, Object val) { | |
| 46 | 46 | if (ObjectUtil.isNotEmpty(val)) { |
| 47 | 47 | return (MPJLambdaWrapperX<T>) super.eq(column, val); |
| 48 | 48 | } |
| 49 | 49 | return this; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public MPJLambdaWrapperX<T> neIfPresent(SFunction<T, ?> column, Object val) { | |
| 52 | + public <R> MPJLambdaWrapperX<T> neIfPresent(SFunction<R, ?> column, Object val) { | |
| 53 | 53 | if (ObjectUtil.isNotEmpty(val)) { |
| 54 | 54 | return (MPJLambdaWrapperX<T>) super.ne(column, val); |
| 55 | 55 | } |
| 56 | 56 | return this; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public MPJLambdaWrapperX<T> gtIfPresent(SFunction<T, ?> column, Object val) { | |
| 59 | + public <R> MPJLambdaWrapperX<T> gtIfPresent(SFunction<R, ?> column, Object val) { | |
| 60 | 60 | if (val != null) { |
| 61 | 61 | return (MPJLambdaWrapperX<T>) super.gt(column, val); |
| 62 | 62 | } |
| 63 | 63 | return this; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public MPJLambdaWrapperX<T> geIfPresent(SFunction<T, ?> column, Object val) { | |
| 66 | + public <R> MPJLambdaWrapperX<T> geIfPresent(SFunction<R, ?> column, Object val) { | |
| 67 | 67 | if (val != null) { |
| 68 | 68 | return (MPJLambdaWrapperX<T>) super.ge(column, val); |
| 69 | 69 | } |
| 70 | 70 | return this; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public MPJLambdaWrapperX<T> ltIfPresent(SFunction<T, ?> column, Object val) { | |
| 73 | + public <R> MPJLambdaWrapperX<T> ltIfPresent(SFunction<R, ?> column, Object val) { | |
| 74 | 74 | if (val != null) { |
| 75 | 75 | return (MPJLambdaWrapperX<T>) super.lt(column, val); |
| 76 | 76 | } |
| 77 | 77 | return this; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public MPJLambdaWrapperX<T> leIfPresent(SFunction<T, ?> column, Object val) { | |
| 80 | + public <R> MPJLambdaWrapperX<T> leIfPresent(SFunction<R, ?> column, Object val) { | |
| 81 | 81 | if (val != null) { |
| 82 | 82 | return (MPJLambdaWrapperX<T>) super.le(column, val); |
| 83 | 83 | } |
| 84 | 84 | return this; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public MPJLambdaWrapperX<T> betweenIfPresent(SFunction<T, ?> column, Object val1, Object val2) { | |
| 87 | + public <R> MPJLambdaWrapperX<T> betweenIfPresent(SFunction<R, ?> column, Object val1, Object val2) { | |
| 88 | 88 | if (val1 != null && val2 != null) { |
| 89 | 89 | return (MPJLambdaWrapperX<T>) super.between(column, val1, val2); |
| 90 | 90 | } |
| ... | ... | @@ -97,7 +97,7 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { |
| 97 | 97 | return this; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - public MPJLambdaWrapperX<T> betweenIfPresent(SFunction<T, ?> column, Object[] values) { | |
| 100 | + public <R> MPJLambdaWrapperX<T> betweenIfPresent(SFunction<R, ?> column, Object[] values) { | |
| 101 | 101 | Object val1 = ArrayUtils.get(values, 0); |
| 102 | 102 | Object val2 = ArrayUtils.get(values, 1); |
| 103 | 103 | return betweenIfPresent(column, val1, val2); |
| ... | ... | @@ -310,4 +310,4 @@ public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> { |
| 310 | 310 | return this; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | -} |
| 314 | +} | |
| 314 | 315 | \ No newline at end of file | ... | ... |