<!--批量更新机型数据-->
<update id="batchUpdateBsVendingModelBoxs" parameterType="java.util.List">
update bs_vending_model_box v
<trim prefix="SET" suffixOverrides=",">
<trim prefix="deviceId=case" suffix="end,">
<foreach collection="bsVendingModelBoxVoList" item="item" index="index">
<if test="item.deviceId!=null">
when logid=#{item.logid} then #{item.deviceId}
</if>
</foreach>
</trim>
<trim prefix="factoryId=case" suffix="end,">
<foreach collection="bsVendingModelBoxVoList" item="item" index="index">
<if test="item.factoryId!=null">
when logid=#{item.logid} then #{item.factoryId}
</if>
</foreach>
</trim>
<trim prefix="deviceCode=case" suffix="end,">
<foreach collection="bsVendingModelBoxVoList" item="item" index="index">
<if test="item.deviceCode!=null">
when logid=#{item.logid} then #{item.deviceCode}
</if>
</foreach>
</trim>
<trim prefix="cabinetType=case" suffix="end,">
<foreach collection="bsVendingModelBoxVoList" item="item" index="index">
<if test="item.cabinetType!=null">
when logid=#{item.logid} then #{item.cabinetType}
</if>
</foreach>
</trim>
<trim prefix="boxCode=case" suffix="end,">
<foreach collection="bsVendingModelBoxVoList" item="item" index="index">
<if test="item.boxCode!=null">
when logid=#{item.logid} then #{item.boxCode}
</if>
</foreach>
</trim>
<trim prefix="boxType=case" suffix="end,">
<foreach collection="bsVendingModelBoxVoList" item="item" index="index">
<if test="item.boxType!=null">
when logid=#{item.logid} then #{item.boxType}
</if>
</foreach>
</trim>
<trim prefix="bCol=case" suffix="end,">
<foreach collection="bsVendingModelBoxVoList" item="item" index="index">
<if test="item.bCol!=null">
when logid=#{item.logid} then #{item.bCol}
</if>
</foreach>
</trim>
<trim prefix="bRow=case" suffix="end,">
<foreach collection="bsVendingModelBoxVoList" item="item" index="index">
<if test="item.bRow!=null">
when logid=#{item.logid} then #{item.bRow}
</if>
</foreach>
</trim>
<trim prefix="createTime=case" suffix="end,">
<foreach collection="bsVendingModelBoxVoList" item="item" index="index">
<if test="item.createTime!=null">
when logid=#{item.logid} then #{item.createTime}
</if>
</foreach>
</trim>
<trim prefix="corpId=case" suffix="end,">
<foreach collection="bsVendingModelBoxVoList" item="item" index="index">
<if test="item.corpId!=null">
when logid=#{item.logid} then #{item.corpId}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="bsVendingModelBoxVoList" separator="or" item="item" index="index">
logid=#{item.logid}
</foreach>
</update>
批量更新另一种形式
<!--批量修改站点箱子-->
<update id="batchUpdateVendingLane" parameterType="java.util.Map">
update bs_vending_lane
<trim prefix="SET" suffixOverrides=",">
<trim prefix="logid =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.logid!=null">
when logid=#{item.logid} then #{item.logid}
</if>
</foreach>
</trim>
<trim prefix="slaneId =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.slaneId!=null">
when logid=#{item.logid} then #{item.slaneId}
</if>
</foreach>
</trim>
<trim prefix="siteId =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.siteId!=null">
when logid=#{item.logid} then #{item.siteId}
</if>
</foreach>
</trim>
<trim prefix="factoryId =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.factoryId!=null">
when logid=#{item.logid} then #{item.factoryId}
</if>
</foreach>
</trim>
<trim prefix="deviceCode =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.deviceCode!=null">
when logid=#{item.logid} then #{item.deviceCode}
</if>
</foreach>
</trim>
<trim prefix="cabinetType =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.cabinetType!=null">
when logid=#{item.logid} then #{item.cabinetType}
</if>
</foreach>
</trim>
<trim prefix="seqId =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.seqId!=null">
when logid=#{item.logid} then #{item.seqId}
</if>
</foreach>
</trim>
<trim prefix="boxId =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.boxId!=null">
when logid=#{item.logid} then #{item.boxId}
</if>
</foreach>
</trim>
<trim prefix="boxCode =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.boxCode!=null">
when logid=#{item.logid} then #{item.boxCode}
</if>
</foreach>
</trim>
<trim prefix="boxType =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.boxType!=null">
when logid=#{item.logid} then #{item.boxType}
</if>
</foreach>
</trim>
<trim prefix="bCol =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.bCol!=null">
when logid=#{item.logid} then #{item.bCol}
</if>
</foreach>
</trim>
<trim prefix="bRow =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.bRow!=null">
when logid=#{item.logid} then #{item.bRow}
</if>
</foreach>
</trim>
<trim prefix="curState =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.curState!=null">
when logid=#{item.logid} then #{item.curState}
</if>
</foreach>
</trim>
<trim prefix="stateTime =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.stateTime!=null">
when logid=#{item.logid} then #{item.stateTime}
</if>
</foreach>
</trim>
<trim prefix="useType =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.useType!=null">
when logid=#{item.logid} then #{item.useType}
</if>
</foreach>
</trim>
<trim prefix="orderId =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.orderId!=null">
when logid=#{item.logid} then #{item.orderId}
</if>
</foreach>
</trim>
<trim prefix="userId =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.userId!=null">
when logid=#{item.logid} then #{item.userId}
</if>
</foreach>
</trim>
<trim prefix="createTime =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.createTime!=null">
when logid=#{item.logid} then #{item.createTime}
</if>
</foreach>
</trim>
<trim prefix="corpId =case" suffix="end,">
<foreach collection="vendingLaneList" item="item" index="index">
<if test="item.corpId!=null">
when logid=#{item.logid} then #{item.corpId}
</if>
</foreach>
</trim>
</trim>
<where>
<foreach collection="vendingLaneList" separator="or" item="item" index="index">
logid=#{item.logid}
</foreach>
</where>
</update>
数据层参数的传递
Map<String, Object> map = new HashMap<String, Object>();
map.put("vendingLaneList", vendingLaneList);
return super.getSqlSession().update("VendingLane.batchUpdateVendingLane", map);