java.sql.SQLException:Parameter index out of range (1>number of parameters, which is 0)


  執行根據某條件查詢數據,報錯如下:

  網上搜索了下,說是mysql預查詢語句中的問號個數和傳入的參數個數不符。再看自己的mybatis代碼:

            <if test="model != null and model != ''">
              and model like CONCAT("%", "#{model}", "%")
            </if>

  發現參數#{model}加上了引號,去掉引號就OK了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM