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. ...
随机推荐
- O029、教你看懂OpenStack日志
参考https://www.cnblogs.com/CloudMan6/p/5456484.html instance 从创建到删除的整个生命周期都是有 Nova 管理的,后面各小节我们以inst ...
- textarea回填数据显示自适应高度
queryTextArea(){ var textAll = document.getElementById('templaInner').querySelectorAll("textare ...
- idea中无法自动提示相关jar包
遇到的问题:今天在pom.xml导入数据库坐标后,发现在在配置数据相关属性时,idea无法使用我引入的jar包,后面才发现是因为在下载包时,没网络了,jar包下载失败 解决办法:cmd进入自己的mav ...
- kubernetes之requests和limits
说明 1.当集群中的计算资源不很充足, 如果集群中的pod负载突然加大, 就会使某个node的资源严重不足, 为了避免系统挂掉, 该node会选择清理某些pod来释放资源, 此时每个pod都可能成为牺 ...
- shell脚本基础和grep文本处理工具企业应用4
文本处理工具: egrep: 支持扩展的正则表达式实现类似于grep文本过滤功能:grep -E egrep [OPTIONS] PATTERN [FILE...] ...
- Elasticsearch中Mapping
映射(Mapping) 概念:创建索引时,可以预先定义字段的类型以及相关属性.从而使得索引建立得更加细致和完善.如果不预先设置映射,会自动识别输入的字段类型. 官方文档(字段数据类型):https:/ ...
- 生产者消费者问题--lock
# 代码: public class App { public static void main(String[] args) { Depot depot = new Depot(100); Prod ...
- P4294 [WC2008]游览计划 (斯坦纳树)
题目链接 差不多是斯坦纳树裸题,不过边权化成了点权,这样在合并两棵子树时需要去掉根结点的权值,防止重复. 题目还要求输出解,只要在转移时记录下路径,然后dfs一遍就好了. #include<bi ...
- ios 打包 异常
1. 问题:Xcode9升级到Xcode10后运行App报错: 2. 原因分析: Xcode10中libstdc++.6.0.9和libstdc++被移除,Frameworks中libstdc++.6 ...
- 08-sp_who2和inputbuffer的使用,连接数
一.sp_who2的使用 1.存储过程的位置 sp_who官方解释地址:https://docs.microsoft.com/zh-cn/sql/relational-databases/system ...