1、批量更新update
int updateBatch(Map<String, Object> m); <update id="updateBatch"> update fc_naturaldanger_item_t set checkret_bigd = <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end"> when #{item.id} then #{item.checkretBigd} </foreach> where id in <foreach collection="list" item="item" index="index" separator="," open="(" close=")"> #{item.id,jdbcType=INTEGER} </foreach> </update>
2、批量插入insert
int insertBath(Map<String, Object> m); <insert id="insertBath"> insert into fc_naturaldanger_item_t (dangerstudyid,dangerid, checkret) values <foreach collection="list" item="item" separator=","> (#{dangerstudyid}, #{item.dangerid}, #{item.checkret}) </foreach> </insert> //id为自增长状态