直接上代码:不需要在数据库链接处追加&allowMultiQueries=true
<update id="updateList" parameterType="list">
update menu_function_authority
<trim prefix="set" suffixOverrides=",">
<trim prefix="visible =case" suffix="end,">
<foreach collection="list" item="item" index="index">
when id=#{item.id} then #{item.visible}
</foreach>
</trim>
<trim prefix="update_date =case" suffix="end,">
<foreach collection="list" item="item" index="index">
when id=#{item.id} then #{item.updateDate}
</foreach>
</trim>
</trim>
where id in
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item.id}
</foreach>
</update>
亲测有效
或者
<update id="updateBatchAudittypeById" parameterType="com.longhu.nn.entity.CustomerUser">
update CUSTOMER_USER set
auditType=
<foreach collection="list" item="item" index="index" separator=" " open="case id" close="end">
when #{item.id,jdbcType=VARCHAR} then #{item.audittype,jdbcType=VARCHAR}
</foreach>
where id in
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item.id}
</foreach>
</update>