今天碰到个问题,解决了很久才搞定,来记录下,希望可以帮助到大家
贴错误源码:
这是一个根据list集合的查找数据的 sql,在接收list的时候加了判断 list != ‘ ’ “”,引起了集合与Stirng类型的比较,故报错
<if test="list != null and list != ''"> and ul.loan_id in <foreach collection="list" index="index" item="loanIdList" open="(" separator="," close=")"> #{loanIdList} </foreach> </if>
解决方案: 将判断条件改为 : list.size >0
<if test="list != null and list.size > 0"> and ul.loan_id in <foreach collection="list" index="index" item="loanIdList" open="(" separator="," close=")"> #{loanIdList} </foreach> </if>