mybatis多个参数查询问题

一.话不多数,错误如下

  Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'userName' not found. Available parameters are [arg1, arg0, param1, param2]

翻译如下:

请求处理失败;嵌套异常为org.mybatis.spring.mybatissSystemException:嵌套异常为org.apache.ibatis.binding.bindingException:未找到参数“username”。可用参数为[arg1、arg0、param1、param2]

 

二.解决如下

出现上述原因是因为在执行sql的时候无法匹配sql语句的通配符造成的,

第一种:在每个参数前加上@Param()注解

第二种:将通配符改为0,1 匹配(第二种仅供参考,这种方法我没有解决我的问题

解决问题本人参考的这位大佬

https://blog.csdn.net/crazy_java1234/article/details/53022011

 

 

 

 

posted @ 2019-06-03 11:12  波比图  阅读(2435)  评论(0编辑  收藏  举报