做项目时在一个mybatis中放入2条更新sql ,但是执行出异常,说是语法错误
update miniapp_subject_members set
member_status= -1 where subject_id=#{subject_id} and user_id =#{user_id};
update miniapp_subject set actual_participants_number=actual_participants_number-1
where subject_id=#{subject_id};
jdbc连接默认 一次执行一条,如过需要一次执行多个sql 需要开启开关。添加
allowMultiQueries=true 并且注意 每句sql以封号隔开“;”
jdbc:mysql://127.0.0.1:3306/testdb?characterEncoding=utf-8&allowMultiQueries=true