一.話不多數,錯誤如下
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