MyBatis中提示:invalid comparison: java.util.LinkedHashMap and java.lang.String
生活随笔
收集整理的這篇文章主要介紹了
MyBatis中提示:invalid comparison: java.util.LinkedHashMap and java.lang.String
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
場景
在使用MyBatis傳遞多個參數(shù)并且傳遞的參數(shù)作為判斷條件時提示:
invalid comparison: java.util.LinkedHashMap and java.lang.String
?
注:
博客:
https://blog.csdn.net/badao_liumang_qizhi
關(guān)注公眾號
霸道的程序猿
獲取編程相關(guān)電子書、教程推送與免費下載。
實現(xiàn)
在Mapper文件中使用動態(tài)sql時,對傳遞的參數(shù)進行判斷時使用了如下的
??????? <where><if test="#{lx} != null? and #{lx}!= ''"> and g.ryfl = #{lx}</if></where>在test語句中使用了#{lx}
正確應(yīng)該是直接使用參數(shù)名
??????? <where><if test="lx != null? and lx!= ''"> and g.ryfl = #{lx}</if></where>?
總結(jié)
以上是生活随笔為你收集整理的MyBatis中提示:invalid comparison: java.util.LinkedHashMap and java.lang.String的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MyBatis中提示:Invalid B
- 下一篇: MyBatis中动态sql的模糊搜索、f