之前一直在用,今天突然忘记怎么写了,记一下,日后方便查阅
循环ids批量逻辑删除
<update id="deleteBatch">
<foreach separator=";" collection="array" item="c" index="index">
update tea_activity
<set>
status = 1
</set>
where id = #{c}
</foreach>
</update>
特别注意!
用此语句的时候有可能会报错的是,所以需要我们在连接数据库的地址上修改一下:
数据库链接添加 &allowMultiQueries=true
jdbc:mysql://192.168.1.72:3306/demo?characterEncoding=utf-8&allowMultiQueries=true