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