場景
在使用MyBatis傳遞多個參數並且傳遞的參數作為判斷條件時提示:
invalid comparison: java.util.LinkedHashMap and java.lang.String
注:
博客:
https://blog.csdn.net/badao_liumang_qizhi
關注公眾號
霸道的程序猿
獲取編程相關電子書、教程推送與免費下載。
實現
在Mapper文件中使用動態sql時,對傳遞的參數進行判斷時使用了如下的
<where> <if test="#{lx} != null and #{lx}!= ''"> and g.ryfl = #{lx}</if> </where>
在test語句中使用了#{lx}
正確應該是直接使用參數名
<where> <if test="lx != null and lx!= ''"> and g.ryfl = #{lx}</if> </where>