Commit d9522808eb2359c56a5346d395a68489418b604d
1 parent
8e51de53
优化 LambdaQueryWrapperX 的 inIfPresent 判空逻辑
Showing
1 changed file
with
2 additions
and
3 deletions
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/LambdaQueryWrapperX.java
| ... | ... | @@ -4,7 +4,6 @@ import cn.hutool.core.util.ArrayUtil; |
| 4 | 4 | import cn.hutool.core.util.ObjectUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; |
| 6 | 6 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 7 | -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
| 8 | 7 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| 9 | 8 | import org.springframework.util.StringUtils; |
| 10 | 9 | |
| ... | ... | @@ -27,14 +26,14 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> { |
| 27 | 26 | } |
| 28 | 27 | |
| 29 | 28 | public LambdaQueryWrapperX<T> inIfPresent(SFunction<T, ?> column, Collection<?> values) { |
| 30 | - if (!CollectionUtils.isEmpty(values)) { | |
| 29 | + if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) { | |
| 31 | 30 | return (LambdaQueryWrapperX<T>) super.in(column, values); |
| 32 | 31 | } |
| 33 | 32 | return this; |
| 34 | 33 | } |
| 35 | 34 | |
| 36 | 35 | public LambdaQueryWrapperX<T> inIfPresent(SFunction<T, ?> column, Object... values) { |
| 37 | - if (!ArrayUtil.isEmpty(values)) { | |
| 36 | + if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) { | |
| 38 | 37 | return (LambdaQueryWrapperX<T>) super.in(column, values); |
| 39 | 38 | } |
| 40 | 39 | return this; | ... | ... |