mybatis批量操作出現的錯誤 the error occurred while setting parameters
前提:批量操作可以直接使用循環,然後循環內調用 mybatis-plus提供的insert、update 等方法,但是考慮到執行效率的問題及減小數據庫連接次數(一定的數據量操作),故使用SQL拼接語句進行批量insert or update or delete
所遇到問題: the error occurred while setting parameters
問題解決方式:是由於mysql的配置導致的,一般來說 “allowMultiQueries” 這個屬性默認值爲false ,只需要將該屬性設置爲true 即可,如下:
url:jdbc:mysql://localhost:3306/mei?characterEncoding=utf8&allowMultiQueries=true