Mybatis报错:Parameter 'list' not found. Available parameters are [groupList, param1]
GroupDao.java 里面定义的方法:
void batchInsertLog(@Param("groupList") List<MktPromotionIntegralLog> groupList);
修改前的GroupMapper.xml
<insert id="batchInsertLog" parameterType="java.util.List">
INSERT INTO table
(ps_id,goods_id,item_number,goods_name)
values
<foreach collection="list" item="log" index="groupList" separator=",">
(#{log.ps_id},#{log.goods_id},#{log.item_number},#{log.goods_name})
</foreach>
</insert>
执行batchInsertLog方法会报错:
Parameter 'list' not found. Available parameters are [groupList, param1]
修改后的GroupMapper.xml
<insert id="batchInsertLog" parameterType="java.util.List">
INSERT INTO table
(ps_id,goods_id,item_number,goods_name)
values
<foreach collection="groupList" item="log" index="groupList" separator=",">
(#{log.ps_id},#{log.goods_id},#{log.item_number},#{log.goods_name})
</foreach>
</insert>
修改后报错问题得以解决.
产生这个问题的原因是由于一直认为 foreach 里面的 collection 应该放的是 java.util.List 之类的,但其实应该是我们与Dao里面 @Param("groupList") 绑定的参数名一致,如果没有使用 @Param ,修改前的修改前的GroupMapper.xml也是不会有问题的.
Mybatis报错:Parameter 'list' not found. Available parameters are [groupList, param1]的更多相关文章
- Mybatis传多个参数的问题 及MyBatis报错 Parameter '0' not found. Available parameters are [arg1, arg0, param1 问题
对于使用Mybatis ,传多个参数,我们可以使用对象封装外,还可以直接传递参数 对象的封装,例如查询对象条件basequery对象 <select id="getProductByP ...
- IDEA下运行 mybatis报错 Parameter 'arg0' not found. Available parameters are [autoRecharge, id, param1, param2]
电脑换系统之后重新安装一了 一下idea 项目运行时出现了以下错误, [autoRecharge, id, param1, param2] 或 [arg0, id, arg1, param2] 参考地 ...
- MyBatis报错 Parameter '0' not found. Available parameters are [arg1, arg0, param1, param2]
修改 <update id="updateStatusById" parameterType="java.lang.Integer"> update ...
- mybatis 批量更新 Parameter '__frch_item_0' not found. Available parameters are [list]
一次在做批量更新数据的时候报错 Parameter '__frch_item_0' not found. Available parameters are [list] 记过反复查找,最后才发现是一个 ...
- mybatis报错Mapped Statements collection does not contain value for com.inter.IOper
首页 > 精品文库 > mybatis报错Mapped Statements collection does not contain value for com.inter.IOper m ...
- mybatis报错 Error instantiating interface com.atguigu.mybatis.dao.DepartmentMapper with invalid types () or values ()
mybatis报错 Error instantiating interface com.atguigu.mybatis.dao.DepartmentMapper with invalid types ...
- mybatis报错:Invalid bound statement (not found)
mybatis报错:Invalid bound statement (not found)的原因很多,但是正如报错提示一样,找不到xml中的sql语句,报错的情况分为三种: 第一种:语法错误 Java ...
- oracle+mybatis报错:BindingException("Invalid bound statement (not found): ")
oracle+mybatis报错:BindingException("Invalid bound statement (not found): ") 从mysql转到oracle数 ...
- Springboot项目下mybatis报错:Invalid bound statement (not found)
mybatis报错:Invalid bound statement (not found)的原因很多,但是正如报错提示一样,找不到xml中的sql语句,报错的情况分为三种: 第一种:语法错误 Java ...
随机推荐
- Socket类 以及 ServerSocket类 讲解
Socket类 套接字是网络连接的端点,套接字使应用可以从网络中读取数据,可以向网络中写入数据.不同计算机上的两个应用程序可以通过连接发送或接收字节流,以此达到相互通信的目的. 为了从一个应用程序向另 ...
- composer设置忽略版本匹配
composer install 时遇到错误: Your requirements could not be resolved to an installable set of packages. 原 ...
- 零基础的人该怎么学习JAVA
对于JAVA有所兴趣但又是零基础的人,该如何学习JAVA呢?对于想要学习开发技术的学子来说找到一个合适自己的培训机构是非常难的事情,在选择的过程中总是 因为这样或那样的问题让你犹豫不决,阻碍你前进的 ...
- 新书发布《每天5分钟玩转Docker容器技术》
后台不时收到关于纸质版教程书籍的询问,今天终于可以给大家一个交代了. <每天5分钟玩转Docker容器技术>现已在各大书城上架. 比较了一下,目前京东上最实惠:https://item.j ...
- Oculus Store游戏下载默认路径修改方法
最近在测试一款VR游戏,所以在硬件设备上选择了HTC Vive和Oculus两款眼镜.相对而言,HTC安装比较人性化:支持自定义安装路径,而且可在界面更改应用程序下载位置,如图所示: 这下替我节省了不 ...
- QCW切割 --铁片
1.QCW切割旋转轴限位部件 --刘锦峰协助 :铁片 功率85% 最大功率100 最小功率50 脉宽0.1ms 调整焦点-0.5左右
- [VirtualBox] 1、NAT模式下端口映射
1.VirtualBox中有4中网络连接方式 VirtualBox中有4中网络连接方式:NAT.Bridged Adapter.Internal.Host-only Adapter,VMWare中有三 ...
- You Are the One DP
You Are the One Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Sub ...
- FPGA在其他领域的应用(二)
计算机和存储领域: 计算机技术和存储技术发展迅猛.如今,云计算正在实现对传统 IT 功能和全新功能的整合.例如,许多大型数据中心目前正在同时提供传统的 IT 服务以及新型的数据分析服务. 因此,这些大 ...
- Python自学笔记-生成器(来自廖雪峰的官网Python3)
感觉廖雪峰的官网http://www.liaoxuefeng.com/里面的教程不错,所以学习一下,把需要复习的摘抄一下. 以下内容主要为了自己复习用,详细内容请登录廖雪峰的官网查看. 生成器 通过列 ...