1. mybatis if语句模糊查询
如果name不为null and name前后去掉空格也不为‘’
<if test="name!=null and name.trim()!='' ">
and em.name like concat('%',#{name},'%')
</if>
2.mybatis 循环
先判断数组是否为null 在去判断数组的长度不能为0
<if test="siteIds !=null and siteIds.length!=0">
rs.id in
<foreach collection='siteIds' item='siteId' open='(' separator=',' close=')'>
#{siteId}
</foreach>
</if>