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. ...
随机推荐
- ES6入门五:箭头函数、函数与ES6新语法
箭头函数的基本用法与特点 函数与ES6新语法 一.箭头函数的基本用法与特点 声明箭头函数采用声明变量和常量的关键字:var.let.const 箭头函数的参数:没有参数用"()"空 ...
- java面试6
1.Redis是单线程还是多线程?为什么能支持访问量和高并发?并举例解释? 1)Redis是单线程的 2)Redis是单线程加多路IO复用 3)例子:上课老师解决同学们的提问 2.Nginx有哪些基本 ...
- ado.net 断开 非断开
非断开 SqlConnection SqlCommand / SqlDataReader 接 断开 SqlConnection SqlDataAdapter / DataSet 接
- STM32WB HSE校准
通过改变RCC_HSECR寄存器中的HSETUNE[5:0]位域的值来校准HSE的输出频率 1.将HSE时钟配置为MCO模式输出到PA8引脚 HAL_RCC_MCOConfig(RCC_MCO1, R ...
- python常用模块:模块练习
今日作业: 1.简述 什么是模块 模块就将一些函数功能封装在一个文件内,以‘文件名.py’命名,以“import 文件名”方式调用 模块有哪些来源 自定义.内置.DLL编译器.包模块的格式要求有哪些 ...
- Centos下编译安装nginx
1.安装依赖 yum install -y pcre-devel zlib-devel gcc openssl-devel gd-devel 2.下载安装包 不同版本的nginx下载地址:http:/ ...
- 执行sudo pip3 ...报错 Traceback (most recent call last): File "/usr/bin/pip3", line 9, in <module> from pip import main ImportError: cannot import name 'main'
对于普通pip,把pip3改成pip即可,其他的修改一样 1.执行命令 sudo gedit /usr/bin/pip3 2.改成下面的形式 from pip import __main__ # 需要 ...
- LeetCode3.无重复字符的最大子串
给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度. 示例 1: 输入: "abcabcbb"输出: 3 解释: 因为无重复字符的最长子串是 "abc&quo ...
- unzip解压3G或者4G以上文件失败的解决方法
Linux下,使用unzip解压时,报错:End-of-central-directory signature not found. Either this file is nota zipfile ...
- [转]DSL-让你的 Ruby 代码更优秀
https://ruby-china.org/topics/38428 以下摘录 DSL和Gpl DSL : domain-specific language.比如HTML是用于组织网页的‘语言’, ...