<!--int updateStreamBoxes(@Param("list") List<SBox> list);-->
<update id="updateStreamBoxes" parameterType="list">
update stream_box
<trim prefix="set" suffixOverrides=",">
<trim prefix="use_state =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when stream_box_id=#{i.streamBoxId} then #{i.useState}
</foreach>
</trim>
<trim prefix=" set_id =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when stream_box_id=#{i.streamBoxId} then #{i.setId}
</foreach>
</trim>
<trim prefix=" pre_set_id =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when stream_box_id=#{i.streamBoxId} then #{i.preSetId}
</foreach>
</trim>
<trim prefix=" pre_use_capability =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when stream_box_id=#{i.streamBoxId} then #{i.preUseCapability}
</foreach>
</trim>
<trim prefix=" last_set_id =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when stream_box_id=#{i.streamBoxId} then #{i.lastSetId}
</foreach>
</trim>
<trim prefix=" last_use_capability =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when stream_box_id=#{i.streamBoxId} then #{i.lastUseCapability}
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
id=#{i.streamBoxId}
</foreach>
</update>
其中白色字体部分中,带
_
下划线部分是数据库中的字段,驼峰命名的是数据库字段对应的javaBean的属性。