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 ...
随机推荐
- 关于linux中关在共享文件的NFS 提示错误解决办法
0. 查看挂载情况命令 : findmnt 1. 如果在客户机上遇到如下这样的提示错误,有可能的原因是因为没有安装nfs-utils 只需要yum install nfs-utils 就解决了 ...
- 使用ctypes调用系统C API函数需要注意的问题,函数参数中有指针或结构体的情况下最好不要修改argtypes
有人向我反应,在代码里同时用我的python模块uiautomation和其它另一个模块后,脚本运行时会报错,但单独使用任意一个模块时都是正常的,没有错误.issue链接 我用一个例子来演示下这个问题 ...
- 关于Vue中,checkBox等组件在赋值后,点击切换页面未及时更新问题
我们经常碰到这样的问题,在v-for循环中,给某些组件(此处以checkBox为例)赋值后,组件并不能正常切换, 这是因为数据层太多,render函数没有自动更新,需手动强制刷新. 解决方法:在切换c ...
- elment 中tree组件展开所有和收缩所有
upAll () { // 全部展开 遍历变成true let self = this; // 将没有转换成树的原数据 let treeList = this.sourceData; for (let ...
- 【转载】salesforce 零基础开发入门学习(五)异步进程介绍与数据批处理Batchable
salesforce 零基础开发入门学习(五)异步进程介绍与数据批处理Batchable 本篇知识参考:https://developer.salesforce.com/trailhead/for ...
- gitlab自动化部署CI案例
参考: https://blog.csdn.net/hxpjava1/article/details/78514999 (简单操作) https://blog.csdn.net/wh211212/ ...
- linux设置自动同步服务器时间
最近遇到一个问题,由于两台服务器时间的问题,经常导致用户登录由于时间差问题而报错,再三百度,最后整理了一下修改linux定时同步的操作(本方法适用于有自己时间服务器,没有的只限于借鉴) 首先确认,我们 ...
- vba代码阅读
#If Vba7 Then #如果是运行在64位office上 Declare PtrSafe Sub...#Else #如果是运行在32位office上 Declare Sub...#EndIf 在 ...
- 3.Hbase数据模型
3.1.Hbase数据模型: 概念视图: 物理视图 Hbase数据在存储系统中是以列族来体现的[Column Family],任何时候可以随意的添加一列到已经存在的列族中 空的单元格在表中不做存储也不 ...
- vue-cli3 配置全局less 、sass 变量
之前在用vue-cli3框架的时候对于常用的less .sass 变量都是需要时就在单文件中引入文件,这样做比较麻烦.那么基于 vue-cli3 如何配置全局的less .sass 变量? <1 ...