<update id="updateBatch" parameterType="java.util.ArrayList">
UPDATE USER
<trim prefix="set" suffixOverrides=",">
<trim prefix="USER_NAME =case" suffix="end,">
<foreach collection="userList" item="user" index="index">
when userId=#{user.userId} then #{user.userName}
</foreach>
</trim>
<trim prefix="USER_AGE =case" suffix="end,">
<foreach collection="userList" item="user" index="index">
when userId=#{user.userId} then #{user.userAge}
</foreach>
</trim>
</trim>
WHERE userId in
<foreach collection="userList" index="index" item="user" separator="," open="(" close=")">
#{user.userId}
</foreach>
</update>
mybatis批量更新
最新推荐文章于 2022-11-07 14:46:47 发布