mybatis批量更新(on duplicate key update)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013165110/article/details/54707154

<insert id="merger" parameterType="java.util.List" > 

<![CDATA[ INSERT INTO table_name ( A_B,B_C,C_D,D_E ) VALUES ]]>

<foreach collection="list" item="item" index="index" separator=",">

( #{item.aB, jdbcType=VARCHAR},

#{item.bC,jdbcType=VARCHAR},

#{item.cD,jdbcType=VARCHAR},

#{item.dE,jdbcType=VARCHAR} )

</foreach>

ON DUPLICATE KEY UPDATE

A_B = VALUES(A_B),

B_C = VALUES(dashboB_C),

C_D = VALUES(C_D),

D_E = VALUES(D_E) )

</insert>

猜你喜欢

转载自blog.csdn.net/u013165110/article/details/54707154