<update id="updateBatchSelective" parameterType="java.util.List">
update 表名
<trim prefix="set" suffixOverrides=",">
<trim prefix="属性= case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.属性!= null">
when 更新条件名称(id)= #{item.id,jdbcType=INTEGER} then #{item.属性,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="属性= case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.属性 != null">
when 更新条件名称(id)= #{item.id,jdbcType=INTEGER} then #{item.属性,jdbcType=CHAR}
</if>
</foreach>
</trim>
where notice_id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.更新条件名称(id),jdbcType=INTEGER}
</foreach>
</update>
sql 结果
update
表名
属性= case
when id= then item.属性内容’’
end,
属性= case
when id= then item.属性内容’’
end,
where
id in
( )