zoukankan      html  css  js  c++  java
  • invalid comparison: java.util.ArrayList and java.lang.String——bug解决办法

    今天碰到个问题,解决了很久才搞定,来记录下,希望可以帮助到大家

    贴错误源码:

    这是一个根据list集合的查找数据的 sql,在接收list的时候加了判断 list != ‘ ’ “”,引起了集合与Stirng类型的比较,故报错

    <if test="list != null and list != ''">
            and ul.loan_id in
            <foreach collection="list" index="index" item="loanIdList" open="(" separator="," close=")">
              #{loanIdList}
            </foreach>
    </if>
    

     解决方案:   将判断条件改为 : list.size >0

    <if test="list != null and list.size > 0">
            and ul.loan_id in
            <foreach collection="list" index="index" item="loanIdList" open="(" separator="," close=")">
              #{loanIdList}
            </foreach>
    </if>
    
  • 相关阅读:
    一条SQL的执行流程
    LinkedList源码解析
    MinorGC前检查
    AbstractList源码分析
    JVM常用命令
    CountDownLatch源码解析
    ReentrantLock源码解析
    HTTPS简单介绍
    工厂方法模式
    观察者模式
  • 原文地址:https://www.cnblogs.com/zx-n/p/7280306.html
Copyright © 2011-2022 走看看