mybatis 批量更新数据
int updateBatch(@Param("entities") List<Drug> entities); <update id="updateBatch" parameterType="java.util.List"> UPDATE drug SET num = CASE <foreach collection="entities" item="item" index="index" open="" close="" separator=" "> WHEN id = #{item.id} THEN num + #{item.operNum} </foreach> END, update_time = CURRENT_TIMESTAMP WHERE id IN <foreach collection="entities" item="item" index="index" open="(" close=")" separator=","> #{item.id} </foreach> </update>