有这样一个页面,需要做一个批量update的操作。
后台sql如下:
<!-- 批量更新rank-->
<update id="batchUpdateRank" parameterType="Map">
UPDATE help_center
SET rank = CASE helpId
<foreach collection="list" item="obj" index="index">
WHEN #{obj.helpId} THEN #{obj.rank}
</foreach>
END
WHERE helpId IN
<foreach collection="helpIds" item="item" index="index" open="(" separator="," close=")" >
#{item}
</foreach>
</update>