在使用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] 解析的更多相关文章

  1. 初学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 ...

  2. 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 ...

  3. 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. ...

  4. Mybatis报错:Parameter 'list' not found. Available parameters are [groupList, param1]

    GroupDao.java 里面定义的方法: void batchInsertLog(@Param("groupList") List<MktPromotionIntegra ...

  5. ### 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 ...

  6. 怪事年年有,今天特别多!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 ...

  7. IDEA下运行 mybatis报错 Parameter 'arg0' not found. Available parameters are [autoRecharge, id, param1, param2]

    电脑换系统之后重新安装一了 一下idea 项目运行时出现了以下错误, [autoRecharge, id, param1, param2] 或 [arg0, id, arg1, param2] 参考地 ...

  8. mybatis 批量更新 Parameter '__frch_item_0' not found. Available parameters are [list]

    一次在做批量更新数据的时候报错 Parameter '__frch_item_0' not found. Available parameters are [list] 记过反复查找,最后才发现是一个 ...

  9. 解决Parameter '__frch_item_0' not found. Available parameters 问题

    1. 问题描述: 出现如下问题,执行报错信息 Caused by: org.mybatis.spring.MyBatisSystemException: nested exception is org ...

随机推荐

  1. SQL查询月、天、周、年(MySql的实例对比)

    SQL Server实现 日期部分 缩写 year yy, yyyy quarter qq, q month mm, m dayofyear dy, y day dd, d week wk, ww w ...

  2. JS实现数组去重(重复元素保留一个)

    1.遍历数组法 它是最简单的数组去重方法(indexOf方法) 实现思路:新建一个数组,遍历去要重的数组,当值不在新数组的时候(indexOf为-1)就加入该新数组中: var arr=[2,8,5, ...

  3. mac使用sourcetree跳过注册

    转自https://blog.csdn.net/qq_32890891/article/details/89216954 打开sourcetree 关闭sourcetree 命令终端输入default ...

  4. linux 基础11-例行性命令

    1. 什么是例行性命令 1.1 linux工作排程的种类: linux例行性命令主要有两种: at:仅执行一次就从linux的任务中取消 cron:将持续例行性的工作下去 1.2 系统常见的例行性命令 ...

  5. Ubuntu 手动挂载exfat格式的U盘

    1.默认Ubuntu不支持exFat格式的U盘,先要安装支持: sudo apt-get install exfat-fuse 2.挂载磁盘,我选择挂在mnt下面 a.创建挂载目录:sudo mkdi ...

  6. mongodb的基本操作之更新不存在的数据

    查找y为100的数据 db.test_collection.find({y:100}) 发现没有,这时候将y为100的数据更新为y为999的数据 db.test_collection.update({ ...

  7. 51Nod - 1714 B君的游戏

    每个数的SG值之和他有多少个1相关 打表复杂度:找K个有序的<n的非负数的复杂度为nk/(k!) 则这题的SG打表复杂度为648/7! 为1e10左右 void dfs(int cur, int ...

  8. [ 转载 ] Java基础

    1.String a = “123”; String b = “123”; a==b的结果是什么? 这包含了内存,String存储方式等诸多知识点.ans:同样序列的字符串直接量为一个实例,所以其实引 ...

  9. php 的一个异常处理程序

    <?php//exceptionHandle.php xiecongwen 20140620 //define('DEBUG',true); /** * Display all errors w ...

  10. python自动华 (十)

    Python自动化 [第十篇]:Python进阶-多进程/协程/事件驱动与Select\Poll\Epoll异步IO 本节内容: 多进程 协程 事件驱动与Select\Poll\Epoll异步IO   ...