Parameter 'xxx' not found. Available parameters are [collection, list]

mybatis报错问题:

dao层:
List<HqjTrade> queryHongbao(ArrayList<String> listType);

映射文件下sql:
<select id="queryHongbao" resultType="HqjTrade" >
  select * from hqj_trade where tradetype in
      <foreach collection="listType" open="(" close=")" separator=","
          item="tradetype">
              #{tradetype}
      </foreach>
  </select>

运行报错:Parameter ‘listType‘ not found. Available parameters are [collection, list]

解决:1.通用方法,在dao层参数上加上@Param("listType"),所以养成加@Param是个好习惯

2.将sql中Collection="listType"改为 Collection="list"或者"collection"

3.对应方式处理二,如果参数是数组则这么改: Collection="array"

注意:也不是任何参数之前就加上@Param,实体类之前不需要加上注解@Param

会报org.apache.ibatis.binding.BindingException: Parameter ‘xx‘ not found

Parameter 'xxx' not found. Available parameters are [collection, list]

原文地址:https://www.cnblogs.com/caoxs/p/9229128.html

时间: 2024-10-09 02:08:20

Parameter 'xxx' not found. Available parameters are [collection, list]的相关文章

Mybatis错误:Parameter &#39;XXX&#39; not found. Available parameters are [1, 0, param1, param2]

Mybatis错误:Parameter 'XXX' not found. Available parameters are [1, 0, param1, param2] 原因:传递的参数超过一个 记 解决办法: (1)直接把值改成数字 <select id="LoginUser" parameterType="String" resultMap="userMap"> SELECT * FROM user where emplnumb

java 传入多个参数时报&quot;Parameter &#39;XXX&#39; not found. Available parameters are [arg1, arg0, param1,...&quot; 解决方案

@Select("SELECT id FROM ae_post ORDER BY id DESC LIMIT #{page},#{size}") List<Post> getAllForPage(@Param("page") int page, @Param("size")int size); dao层写入,解决方法如上 注:多参数需要添加 @Param("参数名") int 参数名 java 传入多个参数时报&q

org.apache.ibatis.binding.BindingException: Parameter &#39;xxx&#39; not found. Available parameters are [arg1, arg0, param1, param2]

这个异常说明参数没有加上@Param注解,加上这个注解就行了. org.apache.ibatis.binding.BindingException: Parameter 'xxx' not found. Available parameters are [arg1, arg0, param1, param2] 原文地址:https://www.cnblogs.com/FengZeng666/p/12012727.html

MyBatis批量操作报错:Parameter &#39;xxxList&#39; not found. Available parameters are [list]

需求: 根据传入的参数批量 删除数据: DAO: List ll = new ArrayList<Integer>(); for(int i=10;i<25;i++){ ll.add(i); } int res = userMapper.delUser(li); System.out.println(res); xml: <delete id="delUser" parameterType="list" > delete from us

Mybatis报错:Parameter &#39;list&#39; 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,goo

mybatis:Parameter &#39;list&#39; not found. Available parameters are [templateId, param1, param2, valueList]

我的EsdTemplateSealMapper.java里面定义的接口是这样的 public List<EsdTemplateSeal> getFilteOutSeal(@Param("filterList")List<String> list,@Param("templateId")String templateId); 然后我的EsdTemplateSealMapper.xml里面的sql是这样的: <select id="

解决Parameter &#39;__frch_item_0&#39; not found. Available parameters 问题

1. 问题描述: 出现如下问题,执行报错信息 Caused by: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter '__frch_item_0' not found. Available parameters are [list, param1] at org.mybatis.spring.MyBatisExc

初学Java9:学习Mybatis时报错:Parameter &#39;name&#39; not found. Available parameters are [1, 0, param1, param2]

报错-->Parameter 'name' not found. Available parameters are [1, 0, param1, param2] 百度找到这篇文章完成修改 http://blog.csdn.net/w86440044/article/details/29363067 我之前写的操作类是和博主一样,是这样的: 1 // 登录·查询 2 @Select("select * from t_users where uname=#{name} and pswd=#{p

解决Parameter &#39;offset&#39; not found. Available parameters are [0, 1, param1, param2]的方法

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'offset' not found. Available parameters are [0, 1, param1, param2] at org.mybatis.spring.MyBatisExceptionTranslator.translateExcepti