1、mybatis批量更新mapper
<update id="updateBatchById">
<foreach collection="list" item="s" separator=";">
update
`tableName`
set
`name` = #{name},
where
id = #{id}
</foreach>
</update>
通过在数据库连接URL中指定allowMultiQueries参数值为true告诉数据库以支持";"号分隔的多条语句的执行。
spring.datasource.url=jdbc:mysql://localhost:3306/test?allowMultiQueries=true
1261

被折叠的 条评论
为什么被折叠?



