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


 翻译过来就是

原因: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>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM