在使用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. springboot启动流程(四)application配置文件加载过程

    所有文章 https://www.cnblogs.com/lay2017/p/11478237.html 触发监听器加载配置文件 在上一篇文章中,我们看到了Environment对象的创建方法.同时也 ...

  2. React/组件通信

    组件通信可以分为以下几种: 父组件向子组件通信 子组件向父组件通信 跨级组件的通信及context 没有嵌套关系的组件通信 父组件向子组件通信   父组件通过props向子组件传递需要的信息.   子 ...

  3. AngularJS入门教程之与服务器(Ajax)交互操作示例

    AngularJS从Web服务器请求资源都是通过Ajax来完成,所有的操作封装在$http服务中,$http服务是只能接收一个参数的函数,这个参数是一个对象,用来完成HTTP请求的一些配置,函数返回一 ...

  4. laravel中引入composer安装在vendor中的第三方组件

    一.安装第三方组件 方法一:使用命令行安装第三方(已phpword为例): composer require phpoffce/phpword ^v0..* 方法二: 修改主项目composer.js ...

  5. Cannot determine value type from string 'xxxxxx'

    Cannot determine value type from string 'xxxxxx' 查了一下,意思就是字段和属性名没有对上. 反复查看代码,字段名和属性名一致. 最后翻阅资料得知是因为构 ...

  6. 如何解决Win10不能新建项目的问题?

    在Win10系统中,我们有时候会遇到右键菜单中没有新建项的情况,这时我们就无法进行文件的新建,非常耽误我们使用电脑.下面雨后清风就来分享一下Win10系统右键菜单没有新建项的解决方法. Win10系统 ...

  7. bash基础——grep、基本正则表达式、扩展正则表达式、fgrep

    grep grep全称:Globally search a Regular Expression and Print 全局搜索正则表达式 正规表达式本质上是一种"表示方法", 只要 ...

  8. 网络OSI 7层模型

    OSI 的英文全程为Open Systems Interconnection ,中文全程为开放系统互联参考模型.是一个逻辑上的定义.主要用途使通信和计算系统自由互联,而不依赖其他架构或技.主要目标就是 ...

  9. vscode开发

    基于 Electron 开发.typescript编写.底层 Node.js 打造的一个编辑器 , 不是IDE,被称为“披着IDE外衣的编辑器”

  10. nodejs常用框架使用样例

    Koa const Koa = require('koa'); const router = require('koa-router')(); const app = new Koa(); const ...