<if test="deviceIds != null and deviceIds.size>0">
and device_id in
<foreach item="item" collection="deviceIds" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
- collection:集合名称
- item:单个对象在后续语句中的名称
- index:序号
- open:这段代码以这个字符开头
- close:这段代码以这个字符结尾
- separator:使用对应的字符进行分割