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

jdbc连接增加allowMultiQueries=true即可

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

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>
posted @ 2018-07-13 10:02  tracy11111  阅读(114)  评论(0)    收藏  举报