mybatis注解方式批量插入数据
@Insert("<script>" + "INSERT INTO cms_portal_menu(name,service_type,index_code) VALUES" + "<foreach collection=\"list\" item=\"item1\" index=\"index\" separator=\",\">" + "(#{item1.name},#{item1.serviceType},#{item1.indexCode})" + "</foreach>" + "</script>") int batchInsert(@Param("list")List<Menu> menus);
注意别漏掉script标签