Not much to say, the above Liezi:
<update id="updateBath" parameterType="java.util.List">
update biaoming
<trim prefix="set" suffixOverrides=",">
<trim prefix="update_time =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.updateTime != null">
when handle_id = #{item.handleId} then #{item.updateTime}
</if>
</foreach>
</trim>
<trim prefix="update_by =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.updateBy != null and item.updateBy != ''">
when handle_id = #{item.handleId} then #{item.updateBy}
</if>
</foreach>
</trim>
<trim prefix="transfer_object =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.transferObject != null and item.transferObject != ''">
when handle_id = #{item.handleId} then #{item.transferObject}
</if>
</foreach>
</trim>
<trim prefix="transfer_price =case" suffix="end,">
<foreach collection="list" item="item" index="index">
<if test="item.transferPrice != null and item.transferPrice != ''">
when handle_id = #{item.handleId} then #{item.transferPrice}
</if>
</foreach>
</trim>
</trim>
</update>
Mapper writing:
/**
* 批量修改
*
* @param list
* @return
*/
int updateBath(List<HandleInfo> list);