Mybatis批量更新报错Unexpected error occurred in scheduled task. org.mybatis.spring.MyBatisSystemExcepti...

今天发版测试遇到一个恶心的问题,mybatis批量更新异常,百度解决


image.png

解决方案:
http://www.mybatis.org/mybatis-3/zh/dynamic-sql.html#foreach

简单点就是把list方式传参换做map传参,其他不变。

 @Override
    public int saveUserInfo(List userInfoList) {
        if(CollectionUtils.isEmpty(userInfoList)){
            return 0;
        }else{
            Map map = new HashMap<>();
            map.put("userInfoList",userInfoList);
           userInfoDoMapper.updateUserInfoDos(userInfoList);
           log.info("批量更新数据userInfoList={}",userInfoList);
            return userInfoList.size();
        }
    }

xml配合改一下

  
  
    
      update t_cmb_fintech_user_info
      
        
          user_name = #{item.userName,jdbcType=VARCHAR},
        
        
          user_probability = #{item.userProbability,jdbcType=DOUBLE},
        
        
          user_spare = #{item.userSpare,jdbcType=VARCHAR},
        
        
          user_share_count = #{item.userShareCount,jdbcType=INTEGER},
        
        
          user_share_num = #{item.userShareNum,jdbcType=INTEGER},
        
      
      where user_uid = #{item.userUid,jdbcType=VARCHAR}
    
  
  

你可能感兴趣的:(Mybatis批量更新报错Unexpected error occurred in scheduled task. org.mybatis.spring.MyBatisSystemExcepti...)