解决: invalid comparison: java.util.ArrayList and java.lang.String

报错信息:

Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: java.lang.IllegalArgumentException: invalid comparison: >java.util.ArrayList and java.lang.String
### Cause: java.lang.IllegalArgumentException: invalid comparison: java.util.ArrayList and >java.lang.String

原因:

– 在xml写sql中使用了list集合和字符串进行了比较

解决:

– 使用 list.size > 0 不使用list != ''

<if test="list != null and list.size > 0">
 and ydp.id in
   <foreach item="id" collection="project_ids" open="(" separator="," close=")">
       #{id}
   foreach>
if>

你可能感兴趣的:(Java,bug记录)