Cause:: invalid comparison:

时间:2025-02-07 07:55:37

翻译过来就是:

原因::无效比较:和

问题原因:

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

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

换成

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