环境:Springboot + Mybatis + MySQL + VUE

场景:

前端发出数据比对请求,在服务后台与数据库交互时,接口提示错误信息如下所示:

{
"code": 999,
"success": false,
"msg": "nested exception is org.apache.ibatis.binding.BindingException: Parameter 'env' not found. Available parameters are [arg1, arg0, param1, param2]",
"menu": "DATABASE",
"action": "DATABASE_COMPARE",
"operator": "ANON",
"datetime": "2018-10-23 11:26:17.877"
}

控制台日志响应如下所示:

解决:

由错误信息可知,Mybatis在操作数据库前未接收到请求参数,实际为Respository/Mapper中的SQL语句中引用的参数未获取到所导致的报错信息。查看源码可知,如下代码中蓝色加粗部分缺失导致的,添加后,问题解决。

    @Select("select * from `data` " +
"where eng = #{eng} and env like '%${env}%' ")
@Results({
@Result(property = "id", column = "id"),
@Result(property = "env", column = "env"),
@Result(property = "eng", column = "eng"),
})
List<Database> findAllComp(@Param("eng") String eng, @Param("env") String env);

Springboot-001-解决nested exception is org.apache.ibatis.binding.BindingException: Parameter 'env' not found. Available parameters are [arg1, arg0, param1, param2]的更多相关文章

  1. org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'userId' not found. Available parameters are [arg1, arg0, param1, param2]

    2018-06-27 16:43:45.552  INFO 16932 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : ...

  2. 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 ...

  3. 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 ...

  4. ### 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 ...

  5. org.apache.ibatis.binding.BindingException: Parameter '0' not found. Available parameters are [arg1, arg0, param1, param2]

    报错信息如下: org.apache.ibatis.binding.BindingException: Parameter '0' not found. Available parameters ar ...

  6. org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'employeeId' not found. Available parameters are [page, map, param1, param2] 解决方法

    原因很简单就是没映射到接口添加 @Param 注解 ->@Param("map") 然后在mapper.xml map.employeeId 再次测试 已经解决 ->

  7. Mybatis报错 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'parentCode' not found. Available parameters are [0, 1, param1, param2]

    orcal数据库使用mybatis接收参数,如果传的是多个参数,需要使用#{0},#{1},...等代替具体参数名,0 代表第一个参数,1 代表第二个参数,以此类推. 错误语句: <select ...

  8. org.apache.ibatis.binding.BindingException: Parameter 'xxx' not found. Available parameters are [arg1, arg0, param1, param2]

    这个异常说明参数没有加上@Param注解,加上这个注解就行了. 默认情况下mybatis把参数按顺序转化为[0, 1, param1, param2],也就是说#{0} 和 #{param1} 是一样 ...

  9. 怪事年年有,今天特别多!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 ...

随机推荐

  1. selenium之 webdriver与三大浏览器版本映射表(更新至v2.29)

    1.chrome浏览器 chromedriver版本 支持的Chrome版本 v2.29 v56-58 v2.28 v55-57 v2.27 v54-56 v2.26 v53-55 v2.25 v53 ...

  2. 如何新建PDF文档,新建PDF文档的方法

    新建PDF文件的话,有两种方式,一种是直接通过使用PDF编辑器http://bianji.xjpdf.com/来新建PDF文件,,还有一种就是将PDF文件转换成Word文件,然后在Word文件中添加, ...

  3. C++中几个输入函数的用法和区别(cin、cin.get()、cin.getline()、getline()、gets()、getchar())

    1.cin>> 用法1:最基本,也是最常用的用法,输入一个数字: #include <iostream>using namespace std;main (){int a,b; ...

  4. Mongodb字段自增长

    MongoClient client = new MongoClient("mongodb://xxx.xxx.x.xx:27017"); var mongServer = cli ...

  5. Codeforces 461D. Appleman and Complicated Task 构造,计数

    原文链接https://www.cnblogs.com/zhouzhendong/p/CF461D.html 题解 首先我们可以发现如果确定了第一行,那么方案就唯一了. 然后,我们来看看一个点的值确定 ...

  6. Stock Chase 拓扑

    题意 给出n个公司  m条信息 当某条信息构成环了  则这条信息是错误的 统计有多少个信息是错误的 这题是一条一条读入  虽然分在拓扑排序类里面 但是不会用拓扑排序来做 可以用floyd思想来做 如果 ...

  7. Class--2019-04-14

    获取class对象,有三种方法: 1.通过类名.class直接访问 Class c = Integer.class; 2.通过Class.forName(类名)函数获取 Class c = Class ...

  8. JavaScript(二)

    获取元素方法一 可以使用内置对象document上的getElementById方法来获取页面上设置了id属性的元素,获取到的是一个html对象,然后将它赋值给一个变量,比如: <script ...

  9. angular.isElement()

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  10. OI回忆录——一个过气OIer的制杖历程

    初中 初一参加学校信息学选修课,一周一节课,学pascal. 初一寒假(大约是)入选(其实是钦定吧)当时加上我只有3人的校队(我当然是最弱的一个. 当时甚至有幸得到叉姐授课(现在才知道这是多么难得的机 ...