org.apache.ibatis.binding.BindingException: Parameter 'xxx' not found.
1. 情景重现
1.1 Mapper 代码
public interface DeviceFileInfoVOMapper {
List<QueryFileDTO> selectVideoByField(String devId, Long chl, Date startTime, Date endTime, Pagination pagination);
}
1.2 XML 代码
<select id="selectVideoByField" resultMap="videoFileMap">
SELECT file_id
FROM t_device_file_info WHERE 1=1
<trim>
<if test="devId != null">
AND dev_id=#{devId,jdbcType=VARCHAR}
</if>
<if test="chl != null">
AND chl=#{chl,jdbcType=BIGINT}
</if>
<if test="startTime != null">
AND start_time >= #{startTime,jdbcType=TIMESTAMP}
</if>
<if test="endTime != null">
AND end_time <= #{endTime,jdbcType=TIMESTAMP}
</if>
</trim>
</select>
1.3 错误详情

2. 解决方法
在 Mapper 中定义的方法参数添加 @Param 注解,@Param 注解的值和xml中引用的参数名一致即可。
@Param("devId"),则在xml中使用 #{devId}
public interface DeviceFileInfoVOMapper {
List<QueryFileDTO> selectVideoByField(@Param("devId") String devId, @Param("chl") Long chl, @Param("startTime") Date startTime, @Param("endTime") Date endTime, Pagination pagination);
}
org.apache.ibatis.binding.BindingException: Parameter 'xxx' not found.的更多相关文章
- SpringBoot整合Mybatis注解版---update出现org.apache.ibatis.binding.BindingException: Parameter 'XXX' not found. Available parameters are [arg1, arg0, param1, param2]
SpringBoot整合Mybatis注解版---update时出现的问题 问题描述: 1.sql建表语句 DROP TABLE IF EXISTS `department`; CREATE TABL ...
- org.apache.ibatis.binding.BindingException: Parameter 'xxx' not found. Available parameters are [arg1, arg0, param1, param2]
这个异常说明参数没有加上@Param注解,加上这个注解就行了. 默认情况下mybatis把参数按顺序转化为[0, 1, param1, param2],也就是说#{0} 和 #{param1} 是一样 ...
- 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 ...
- ### 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 ...
- MyBatis 传List参数 nested exception is org.apache.ibatis.binding.BindingException: Parameter 'idList' not found.
在MyBatis传入List参数时,MyBatis报错:nested exception is org.apache.ibatis.binding.BindingException: Paramete ...
- org.apache.ibatis.binding.BindingException: Parameter 'start' not found. Available parameters are [1, 0, param1, param2]
DEBUG 2018-05-30 08:43:26,091 org.springframework.jdbc.datasource.DataSourceTransactionManager: Roll ...
- Springboot-001-解决nested exception is org.apache.ibatis.binding.BindingException: Parameter 'env' not found. Available parameters are [arg1, arg0, param1, param2]
环境:Springboot + Mybatis + MySQL + VUE 场景: 前端发出数据比对请求,在服务后台与数据库交互时,接口提示错误信息如下所示: { "code": ...
- org.apache.ibatis.binding.BindingException: Parameter 'idList' not found解决办法
https://blog.csdn.net/qq_28379809/article/details/83342196 问题描述 使用Mybatis查询数据库报错: org.apache.ibatis. ...
随机推荐
- redis的keys常用操作及redis的特性
redis的keys常用操作 1.获得所有的keys: keys * 2.可以模糊查询 keys:keys my* 3.删除keys:del mymkey1 mykey2 4.是否存在keys:ex ...
- Python中GUI库PyQt5的安装和配置
在使用Tkinter开发GUI程序时,发现相关文档比较少,开发起来太累.经过综合比较,决定使用PyQt这个库.下面是简单的安装步骤. 1.安装 PyQt5 : pip install PyQt5 -i ...
- ETL 工具和 BI 工具
ETL是数据仓库中的非常重要的一环,是承前启后的必要的一步.ETL负责将分布的.异构数据源中的数据如关系数据.平面数据文件等抽取到临时中间层后进行清洗.转换.集成,最后加载到数据仓库或数据集市中,成为 ...
- 红队基础设施建设:隐藏你的C2
0x01 前言 待定
- odoo 关系字段(关联关系)
Many-to-one关联 publisher_id = fields.Many2one(comodel_name= 'res.partner', domain='',context={},ondel ...
- hive--构建于hadoop之上、让你像写SQL一样编写MapReduce程序
hive介绍 什么是hive? hive:由Facebook开源用于解决海量结构化日志的数据统计 hive是基于hadoop的一个数据仓库工具,可以将结构化的数据映射为数据库的一张表,并提供类SQL查 ...
- onItemSelected 获取选中的 信息 3种方法
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) ...
- xenserver 下载模板
cd /tmp rm -rf Auto.sh wget http://os.xensystem.net/XenSystem/download/Customer/Auto.sh sh Auto.sh
- PTA ”写出这个数“
读入一个正整数 n,计算其各位数字之和,用汉语拼音写出和的每一位数字. 输入格式: 每个测试输入包含 1 个测试用例,即给出自然数 n 的值.这里保证 n 小于 10的100次方. 输出格式: 在 ...
- java线程基础巩固---同步代码块以及同步方法之间的区别和关系
在上一次中[http://www.cnblogs.com/webor2006/p/8040369.html]采用同步代码块的方式来实现对线程的同步,如下: 对于同步方法我想都知道,就是将同步关键字声明 ...