foreach关键字:
批量查找/删除:用where id in<foreach> (xxx,yyy,zzz ...)</foreach>
批量更新:需要开启批量sql,比如druid需要在filter里设置开启批量sql等
<update id="batchUpdateLevel" parameterType="map">
<foreach collection="sysDeptList" item="sysDept" separator=";">
UPDATE sys_dept
SET level = #{dept.level}
WHERE id = #{dept.id}
</foreach>
</update>
批量插入:
<insert id="batchInsert" parameterType="map">
insert into sys_role_acl (role_id, acl_id, operator, operate_time, operate_ip)
values
<foreach collection="roleAclList" item="roleAcl" separator=",">
(#{roleAcl.roleId}, #{roleAcl.aclId}, #{roleAcl.operator}, #{roleAcl.operateTime}, #{roleAcl.operateIp})
</foreach>
</insert>