<if test="activityType != null and activityType.size() > 0" > and a.TypeId in <foreach collection="activityType" item="activityType" index="index" open="(" close=")" separator=","> #{activityType} </foreach> </if>