0
点赞
收藏
分享

微信扫一扫

MyBatis - update list

<update id="updateWorkflowQaaSampleList" parameterType="java.util.List">
<foreach collection="list" item="sample" index="index" open="" close="" separator=";">
update sample
<set>
<if test="sample.sampleNo != null">
`sample_no` = #{sample.sampleNo,jdbcType=VARCHAR}
</if>
</set>
where `id` = #{sample.id,jdbcType=INTEGER}
</foreach>
</update>

注意:这种方法必须在配置连接数据库url后面带一个参数 &allowMultiQueries=true,表示允许批量操作,

mysql:
url: jdbc:mysql://localhost:3306/application?...&allowMultiQueries=true


举报

相关推荐

0 条评论