mybatis异常: invalid comparison: java.util.ArrayList and java.lang.String] with root cause

mybatis中使用动态sql,报错: invalid comparison: java.util.ArrayList and java.lang.String] with root cause

是由于  list != ' ' 导致的,引起了集合与string类型的比较

<if test="lsit != null and list != ''">
B.COMMID IN (
<foreach collection="list" item="commId" index="index" separator=",">
#{commId,jdbcType=VARCHAR}
</foreach>
)
</if>

修改为

<if test="lsit != null and list.size > 0">
B.COMMID IN (
<foreach collection="list" item="commId" index="index" separator=",">
#{commId,jdbcType=VARCHAR}
</foreach>
)
</if>
上一篇:(转载)顺序栈c++实现


下一篇:使用PHP实现用户登录和注册的功能