Parameter 'list1' not found. Available parameters are [list] 解析
在使用foreach语句时会经常报Parameter ‘ordersList’ not found. Available parameters are [list] 解析这个错误,造成这个错误的主要原因你的写法错误:请看错误实例
mapper接口中
List<Orders> selectKeyList(List<Integer> ordersList);
在mapper.xml中你的写法是
<foreach collection="ordersList" item="item" open="and id in(" separator="," close=")" >
#{item}
</foreach>
由下面这段代码你可以知道 collection=”ordersList”不能这么写
private Object wrapCollection(Object object) {
DefaultSqlSession.StrictMap map;
// 如果传入参数是一个集合
if (object instanceof Collection) {
//创建1个Map
map = new DefaultSqlSession.StrictMap();
map.put("collection", object);
//注意 如果参数是list
if (object instanceof List) {
//那么传来的参数,collection的默认写法应该 collection="list"
map.put("list", object);
}
return map;
} else if (object != null && object.getClass().isArray()) {
map = new DefaultSqlSession.StrictMap();
//数组的默认写法为collection="array"
map.put("array", object);
return map;
} else {
return object;
}
}
所以你的collection=”ordersList”应该改为collection=”list” 这样就能将错误改正,当然如果不想改,那么只有改动mapper接口中定义的方法了如下:
List<Orders> selectKeyList(@Param("ordersList")List<Integer> ordersList);
这个错误也能得到有效的解决.
---------------------
作者:qq_21863565
原文:https://blog.csdn.net/qq_21863565/article/details/81262834
Parameter 'list1' not found. Available parameters are [list] 解析的更多相关文章
- 初学Java9:学习Mybatis时报错:Parameter 'name' not found. Available parameters are [1, 0, param1, param2]
报错-->Parameter 'name' not found. Available parameters are [1, 0, param1, param2] 百度找到这篇文章完成修改 htt ...
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [1, 0, param1, param2]
Spring+mybatis错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.bi ...
- spring 整合Mybatis 错误:Parameter 'items_id' not found. Available parameters are [array]
运行环境:jdk1.7.0_17+tomcat 7 + spring:3.2.0 +mybatis:3.2.7+ eclipse 错误:Parameter 'items_id' not found. ...
- Mybatis报错:Parameter 'list' not found. Available parameters are [groupList, param1]
GroupDao.java 里面定义的方法: void batchInsertLog(@Param("groupList") List<MktPromotionIntegra ...
- ### Cause: org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [arg1, arg0, param1, param2]
org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: org.apache.ib ...
- 怪事年年有,今天特别多!org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'empno' not found. Available parameters are [emp, deptno, param1, param
错误: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.Binding ...
- IDEA下运行 mybatis报错 Parameter 'arg0' not found. Available parameters are [autoRecharge, id, param1, param2]
电脑换系统之后重新安装一了 一下idea 项目运行时出现了以下错误, [autoRecharge, id, param1, param2] 或 [arg0, id, arg1, param2] 参考地 ...
- mybatis 批量更新 Parameter '__frch_item_0' not found. Available parameters are [list]
一次在做批量更新数据的时候报错 Parameter '__frch_item_0' not found. Available parameters are [list] 记过反复查找,最后才发现是一个 ...
- 解决Parameter '__frch_item_0' not found. Available parameters 问题
1. 问题描述: 出现如下问题,执行报错信息 Caused by: org.mybatis.spring.MyBatisSystemException: nested exception is org ...
随机推荐
- VBA算术运算符
以下是VBA支持算术运算符. 假设变量A=5,变量B=10,那么 - 运算符 描述 示例 + 两个操作数相加 A + B = 15 - 两个操作数相减 A - B = -5 * 两个操作数相乘 A * ...
- springboot项目命linux环境下命令启动
测试环境:dev nohup java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 \-Dcom.s ...
- 【微信网页直接下载app】微信跳转-微信浏览器中直接唤起本地浏览器和App
文档传送门:https://github.com/EthanOrange/wechat-redirect demo: http://wxredirect.jslab.fun/call-app
- 根目录/缺少执行权限x产生的两种错误
Linux根目录缺少x权限,产生的两个错误: 以root用户执行systemctl命令报权限相关问题 [root@hps2 ~]# systemctl stop hps-manager * (pktt ...
- lvs+keepalived+application部署(只使用两台机器)
目前大家用LVS+Keepalived + APP 架构都是 2台LVS +Keepalived 然后后端跟着 应用设备 然而针对小客户来说, 2台LVS平常没什么压力 还有一台备着(虽然可以跑双主 ...
- springboot 使用 @data 插件,减少代码量
一.idea 安装 lombok 插件 二.重启 idea 三.添加依赖 <dependency> <groupId>org.projectlombok</groupId ...
- python-----多进程笔记
多进程笔记: 在Python中多进程的创建方式对比: 1.在Python中,可以通过os.fork()创建子进程,但是这种方式智能在'linux'和'unix'以及'mac'下面使用,不能跨平台,所以 ...
- waitpid()
waitpid() pid_t waitpid(pid_t pid, int *status, int options); 参数: pid>0 只等待进程ID等于pid的子进程,不管其它已经有多 ...
- Mysql+keepalived
测试环境 192.168.2.201 master slave 192.168.2.202 master slave 配置流程:安装MySQL->优化系统->优化配置my.cnf-> ...
- 转 oracle数据库更新时间字段数据时的sql语句
https://www.cnblogs.com/sun-rain/p/4921512.html ---Oracle数据库-时间函数 ---格式化时间插入update t_user u set u.mo ...