Cause: java.lang.IllegalArgumentException: invalid comparison: java.util.ArrayList and java.lang.String

时间:2019-02-22 17:13:30   收藏:0   阅读:906

 翻译过来就是

原因:java.lang.IllegalArgumentException:无效比较:java.util.ArrayList和java.lang.String

 

这个情况在list集合查找数据的sql中出的问题,在接受list的时候加了判断  list!=‘‘ ,引起了集合与String类型的比较

<choose>
      <when test="names!= null and names.size!=‘‘">
        and name in
        <foreach collection="names" item="name" index="index" open="(" close=")" separator=",">
          #{name}
        </foreach>
      </when>
      <otherwise>
        and name= ‘‘
      </otherwise>
    </choose>

换成

<choose>
      <when test="names!= null and names.size>0">
        and name in
        <foreach collection="names" item="name" index="index" open="(" close=")" separator=",">
          #{name}
        </foreach>
      </when>
      <otherwise>
        and name= ‘‘
      </otherwise>
    </choose>

 

原文:https://www.cnblogs.com/companionspace/p/10419466.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!