mybatis判断一个参数集合是否为空或者判断其大小是否为零
<if test="list!= null and list.size>0"></if>
要对list集合进行展示处理处理
<foreach item="item" collection="list" separator="," open="(" close=")" index=""></foreach>
即变成(,,)的形式,通常与IN连用
例如
SELECT MIN(p.pool_task_id) AS pool_task_id
FROM pool_task p
WHERE r_type != 2
<if test="moCodeList != null and moCodeList.size>0">
AND p.mo_code IN
<foreach collection="moCodeList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>