mybatis批量insert时使用foreach发生Parameter '***' not found. Available parameters are [collection, list]错误
报错情况如下org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘stocksList’ not found. Available parameters are [stockList, param]
这句话的大概意思是你找不到你传进来的参数后来我发现是我collection里定义的参数“stocksList”没找到,最后发现只要把
mapper.java文件中方法参数从加@Param(“stocksList”)修改为
就行了,最后总结一下@Param中的参数应该要与Collection属性参数相同