這是一個根據list集合的查找數據的 sql,在接收list的時候加了判斷 list != ‘ ’ “”,引起了集合與Stirng類型的比較,故報錯
<if test="list != null and list != '' "> AND roo_id IN <foreach collection="list" item="id" index="index" open="(" close=")" separator=","> #{id} </foreach> </if>
解決方案: 將判斷條件改爲 : list.size >0
<if test="list != null and list.size > 0 "> AND roo_id IN <foreach collection="list" item="id" index="index" open="(" close=")" separator=","> #{id} </foreach> </if>