关于mybatis报invalid comparison: java.util.Arrays$ArrayList and java.lang.String异常

来源:互联网 发布:mac下的mysql客户端 编辑:程序博客网 时间:2024/05/22 08:00

最近在对公司项目使用springcloud进行重构时,进行调试接口出现了如下错误:

这是sql代码

<if test="foStatus != null and foStatus!=''">and fco.status in <foreach item="status" index="index" collection="listStatus" open="(" separator="," close=")">        #{status}</foreach></if>
在动态sql语句中如果出现了list!=‘ ’这样的判断,就会把传进来的list当做string处理,因此在循环中就会出错;

但是以前没有用springboot重构前这样写就没问题,也不知是不是springboot框架所导致的==!,真是大坑;(希望有大神解释下)

把list!=‘’去掉即可或者写成 list.size > 0

<if test="foStatus != null and foStatus.size > 0">and fco.status in <foreach item="status" index="index" collection="listStatus" open="(" separator="," close=")">        #{status}</foreach></if>







阅读全文
0 0
原创粉丝点击