mapper

List<ReworkDeviceDetailDTO> getListByPartIds(List<Long> partIds);

sql语句

<select id="getListByPartIds" resultType="com.dep.pms.entity.dto.ReworkDeviceDetailDTO">......where ptm.state = 0and ppms.id in<foreach collection="ids" index="index" item="id" open="(" separator="," close=")">#{id}</foreach>

报错
Servlet.service() for servlet [dispatcherServlet] in context with path [/pms-api] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'ids' not found. Available parameters are [collection, list]] with root cause org.apache.ibatis.binding.BindingException: Parameter 'ids' not found. Available parameters are [collection, list]

解决方法

         <foreach collection="ids" index="index" item="id" open="(" separator="," close=")">#{id}</foreach>

改成

     <foreach collection="list" index="index" item="id" open="(" separator="," close=")">#{id}</foreach>

具体原因不清楚

如果mapper中的参数改成对象的话,无论是<foreach collection="list"还是<foreach collection="ids"都可以查询成功

@Data
public class ReworkDeviceDetailFindReq {private List<Long> ReworkIds;}

sql语句使用foreach报错相关推荐

  1. 执行update和delete的SQL语句时,报错:Error Code: 1175. You are using safe update mode and you tried to update a

    执行SQL语句时,报错: 13:36:42 delete from users where username='lisi' Error Code: 1175. You are using safe u ...

  2. 数据库关键字问题mysql 运行sql语句check关键字报错

    mysql 运行sql语句check关键字报错.出错:因为check为 mysql的保留关键字,改名即可. 遇到数据库语句问题可以参考下这个问题,之前的access数据库用的check作为表明,代码迁 ...

  3. # Sql语句过长报错、查询慢优化方案探索

    Sql 过长查询报错.in过多.查询慢优化方案探索 目录 文章目录 Sql 过长查询报错.in过多.查询慢优化方案探索 目录 背景描述 解决方案 方案1(内存中过滤) 存在问题 方案2 In 查询的内 ...

  4. MyBatis中编写sql语句小于号报错

    场景 在编写Mybatis的xml文件时使用>可以但是使用<报错. 解决 1.调换位置 比如a < b 改为b > a 2.使用代替符号

  5. sql语句Order by 报错列名不明确

    select top 10 column1,column2,column3 from table1 where table1.id not in(select top 0 table1.id from ...

  6. slf4j mysql_能显示sql语句,没有报错,但是MySQL里没有表?还有,slf4j是必须的吗?...

    org.hibernate.dialect.MySQLDialect true true update ssh/domain/Product.hbm.xml jdbc.driverClass=com. ...

  7. 怎么sql语句错了 不报错 还继续执行?

    <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="C ...

  8. sql注入 1-1_基于报错的注入

    sql注入 1-1_ 基于报错注入 1.判断是否存在报错注入 通过 id =1 可以看到服务器返回正常页面 通过 id=1 and 1=1 通过 id=1 and 1=2 服务器也返回正常 通过 id ...

  9. SQL注入之floor报错注入

    SQL注入之floor报错注入 原理 一.count()函数.group by 二.floor()函数 三.rand()函数 四.报错初体验 五.报错注入 1.获取当前数据库 2.获取当前用户 六.靶 ...

最新文章

  1. 火狐浏览器设置cookie失败_IE、谷歌Cookie记录失败,火狐成功(IE和Firefox下的Cookie兼容问题)...
  2. Android 反编译Apk提取XML文件
  3. Linux 内核抓包功能实现基础(四) 手动查找邻居缓存填充MAC地址
  4. 用SI 和 DI实现字符串的复制
  5. StackExchange.Redis性能调优
  6. 推荐一个Python的开源小工具大合集!
  7. Halcon 学习总结——制作标定板(函数gen_caltab)
  8. 洛谷 P2486 [SDOI2011]染色 树链剖分
  9. Srping MVC中Controller的void方法声明误区
  10. 2级c语言程序设计无忧考试,无忧考吧二级c模拟考试系统
  11. PhpSpreadsheet 设置常用格式
  12. 微信小程序查询数据库总条数
  13. KBL406-ASEMI整流桥KBL406
  14. Android 图片虚化,虚化图片,模糊图片
  15. mybatis动态查询字段、动态更新字段
  16. 腾讯地图javascript API实现地图模糊搜索标记,经纬度输入及点击双向定位
  17. 1分钟学会PS背景虚化
  18. 【Solidworks崩溃解决办法之一】【关闭OpenGL】
  19. 2019专业创业赛事活动平台
  20. 开源神器:让你一键卸载 Windows 默认程序!

热门文章

  1. 【c基础】之 文件及其操作
  2. Linux0.11内核--加载可执行二进制文件之1.copy_strings
  3. Atitit.mybatis的测试  以及spring与mybatis在本项目中的集成配置说明
  4. tomcat URL乱码问题
  5. 12天学好C语言——记录我的C语言学习之路(Day 12)
  6. vs 本地调试(IIS)
  7. bootstrap Table的使用方法
  8. jenkins定时任务
  9. leetcode第一刷_Combinations
  10. WPF的自定义控件 依赖属性,DependencyProperty 路由事件RoutedEvent