设置允许mybatis一次执行多条sql

来源:互联网 发布:c语言开源项目 编辑:程序博客网 时间:2024/06/02 05:31

jdbc连接增加allowMultiQueries=true即可

jdbc.jdbcUrl=jdbc:mysql://127.0.0.1:3306/database?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true

sql之间使用;分隔

demo

<update id="down">    UPDATE table SET         order_num = order_num - 1    WHERE order_num = #{orderNum} + 1;    UPDATE table SET         order_num = order_num + 1    WHERE id = #{id};</update>
原创粉丝点击