Commit 5b9106fdb5af2c7caa910fba8faf85037492f9a6

Authored by lemoncc
1 parent ebf4ac1d

fix: 在调用 selectList() 的时候 如果 Collection 参数为空会报错 sql 异常

yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
1 1 package cn.iocoder.yudao.framework.mybatis.core.mapper;
2 2  
  3 +import cn.hutool.core.collection.CollUtil;
3 4 import cn.iocoder.yudao.framework.common.pojo.PageParam;
4 5 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 6 import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
... ... @@ -69,10 +70,16 @@ public interface BaseMapperX<T> extends BaseMapper<T> {
69 70 }
70 71  
71 72 default List<T> selectList(String field, Collection<?> values) {
  73 + if (CollUtil.isEmpty(values)) {
  74 + return CollUtil.newArrayList();
  75 + }
72 76 return selectList(new QueryWrapper<T>().in(field, values));
73 77 }
74 78  
75 79 default List<T> selectList(SFunction<T, ?> field, Collection<?> values) {
  80 + if (CollUtil.isEmpty(values)) {
  81 + return CollUtil.newArrayList();
  82 + }
76 83 return selectList(new LambdaQueryWrapper<T>().in(field, values));
77 84 }
78 85  
... ... @@ -115,4 +122,4 @@ public interface BaseMapperX&lt;T&gt; extends BaseMapper&lt;T&gt; {
115 122 Db.saveOrUpdateBatch(collection);
116 123 }
117 124  
118 125 -}
  126 +}
119 127 \ No newline at end of file
... ...