1.判断list是否为空 上面说过,if条件判断可以直接调用对象自身的方法进行逻辑判断,所以list判空。可以调用.size()>0或者.isEmpty() 例如:<if test="userList != null and userList.isEmpty()"></if> , <if test="userList != null and userList.size()>0"></if> <where> t.app_id = a.id <if test="userIds != null and userIds.size>0"> and t.user_id in <foreach collection="userIds" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if> </where>
前端swagger传参[],即可
==================================================================================================