Просмотр исходного кода

增加deleteByIds空集合处理.

https://github.com/baomidou/mybatis-plus/issues/6257
nieqiurong 11 месяцев назад
Родитель
Сommit
423d43425f

+ 3 - 0
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/mapper/BaseMapper.java

@@ -203,6 +203,9 @@ public interface BaseMapper<T> extends Mapper<T> {
      * @since 3.5.7
      */
     default int deleteByIds(@Param(Constants.COLL) Collection<?> collections, boolean useFill) {
+        if (CollectionUtils.isEmpty(collections)) {
+            return 0;
+        }
         MybatisMapperProxy<?> mybatisMapperProxy = MybatisUtils.getMybatisMapperProxy(this);
         Class<?> entityClass = GenericTypeUtils.resolveTypeArguments(getClass(), BaseMapper.class)[0];
         SqlSession sqlSession = mybatisMapperProxy.getSqlSession();