在测试功能时报出错误:
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: org.apache.ibatis.binding.BindingException: Parameter 'goods_ids' not found. Available parameters are [array, arg0]
### The error may exist in mapper/GoodsMapper.xml
### The error may involve goodsSysteam.dao.GoodsDao.delGoods
### The error occurred while executing an update
### Cause: org.apache.ibatis.binding.BindingException: Parameter 'goods_ids' not found. Available parameters are [array, arg0]
原因:
在传入多个参数时,未将映射文件中的sql映射的foreach元素中collection属性设置为array类型。
解决:
方法一:
在sql映射中将sql语句中的foreach元素的collection属性设置为array。
方法二:
在DAO层的方法中设置的参数前加上@Param注解声明参数。