Oracle + MyBatis 批量更新 update

<update id="updateUserDO' parameterType="list"> 
<foreach collection="list" item="param" separator="" open="begin" close="end;">
        update user
        <set>
        <if test="null!=param.account and ''!=param.account">
         account =#{param.account},
        if>
        <if test="null!=param.userName and ''!=param.userName">
        user_name =#{param.userName},
        if>
    set>
    where uuid = #{param.uuid};
foreach>
update>

注意:where最后有个分号
其实最后SQL格式就是
begin
update xxx set xxx where xxx;
update xxx set xxx where xxx;
end;
是一个SQL块

你可能感兴趣的:(oracle,mybatis,数据库)