有多种方式

其中效率高 要求低的方式 是 把sql拼接出来 后一次性commit;

eg:

public int insertBatch(List<PeccDetailModel> list) {
return super.insert("com.hshc.web.pec.dao.PeccDetailDao.insertBatch",list);
}
<insert id="insertBatch">

    insert ignore into table_
(
id, pecc_id,
pecc_no,
plate_no,
infomation_code,
pecc_time,
pecc_addr,
pecc_reason,
pecc_amount,
status,
department,
pecc_score,
pecc_code,
violation_code,
archive_no,
phone,
excute_location,
excute_department,
category, late_fees,
basis_punishment,
illegal_entry,
location_id,
pecc_location_code,
location_name,
source_id,
record_type,
handle_time,
parties, version,
create_emp,
create_emp_id,
create_time,
modify_emp_id,
modify_emp,
modify_time,
vin_no,
engine_no,
city_id
)
values
<foreach collection="list" separator="," item="item">
(
#{item.id},
#{item.peccId},
#{item.peccNo},
#{item.plateNo},
#{item.infomationCode},
#{item.peccTime},
#{item.peccAddr},
#{item.peccReason},
#{item.peccAmount},
#{item.status},
#{item.department},
#{item.peccScore},
#{item.peccCode},
#{item.violationCode},
#{item.archiveNo},
#{item.phone},
#{item.excuteLocation},
#{item.excuteDepartment},
#{item.category},
#{item.lateFees},
#{item.basisPunishment},
#{item.illegalEntry},
#{item.locationId},
#{item.peccLocationCode},
#{item.locationName},
#{item.sourceId},
#{item.recordType},
#{item.handleTime},
#{item.parties},
#{item.version},
#{item.createEmp},
#{item.createEmpId},
#{item.createTime},
#{item.modifyEmpId},
#{item.modifyEmp},
#{item.modifyTime},
#{item.vinNo},
#{item.engineNo},
#{item.cityId}
)
</foreach>
</insert>

mysql批量插入的更多相关文章

  1. Oracle/Mysql批量插入的sql,效率比较高

    1.oracle 批量插入: insert into tableName(col1,col2,col3...)    select 1,'第一行第一列值','第二列值' from dual union ...

  2. mysql批量插入简单测试数据

    mysql批量插入简单测试数据 # 参考网址: https://www.2cto.com/database/201703/618280.html 1.mysql创建测试表 CREATE TABLE ` ...

  3. MySQL 批量插入值

    MySQL 批量插入值 今天遇到个问题,需要从类似以下语句中的各个小括号[其实也有中括号等]抽取相关字段进行组合[相关规则,此处略去不提],并保存到数据库中,此时如果每次插入一条,会连续进行多次插入, ...

  4. mybatis + mysql 批量插入、删除、更新

    mybatis + mysql 批量插入.删除.更新 Student 表结构 批量插入 public int insertBatchStudent(List<Student> studen ...

  5. mybatis+mysql批量插入和批量更新、存在及更新

    mybatis+mysql批量插入和批量更新 一.批量插入 批量插入数据使用的sql语句是: insert into table (字段一,字段二,字段三) values(xx,xx,xx),(oo, ...

  6. mybatis oracle mysql 批量插入时的坑爹问题--需谨记

    mybatis oracle mysql 批量插入一.oracle的批量插入方式insert into db(id, zgbh, shbzh) select '1', '2', '3' from du ...

  7. MySQL 批量插入 Update时Replace

    建一张试验表如下: 一.批量插入 MySQL的INSERT有一种写法如下: INSERT INTO person VALUES (NULL,'关羽', '2016-04-22 10:00:00'), ...

  8. MYSQL批量插入数据库实现语句性能分析

    假定我们的表结构如下 代码如下   CREATE TABLE example ( example_id INT NOT NULL, name VARCHAR( 50 ) NOT NULL, value ...

  9. mybatis mysql 批量插入

    场景描述: 使用mybatis操作mysql数据库,进行批量插入数据,提高代码质量和执行效率. 环境: mybatis spring mysql java xml配置文件 <insert id ...

  10. mysql批量插入语句执行失败的话,是部分失败还是全部失败

    项目开发中,正好遇到这个问题. 将一批从外部第三方接口获取到的数据存储到本地mysql数据库,假设接口返回的数据类型为A,经过A到B的转换规则转换后, 要插入数据库的数据类型为B.那么在A获取到100 ...

随机推荐

  1. GIMP使用笔记

    一:背景透明化 1:选中背景:选择——按颜色——点击图片背景 2:透明化:图层——透明化——颜色到Alpha——选择背景颜色,转换为alpha透明 二:裁剪图片 1:选择:工具箱——选择套具——使用套 ...

  2. 信用评分及模型原理解析(以P2P网贷为例)

    本博文将针对消费贷款领域的信用评分及其模型进行相关研究探讨.虽然人人都可以通过对借款方在Lending Club(国外最大的P2P网站)和Prosper上的历史借贷数据进行分析,但我相信,了解消费信贷 ...

  3. springboot nginx 配置

    安装nginx参考本人另一篇博客:http://www.cnblogs.com/gmq-sh/p/5750833.html spring-boot需要启动nginx的,用于监听启动的端口.一.配置ng ...

  4. npm 发布包和删除包(2019最新攻略)

  5. 获取硬盘序列号的Fortran程序

    以前写了个获取硬盘序列号的fortran程序,但未经实证 program FortranDemo Use Kernel32 Implicit None Interface SUBROUTINE Get ...

  6. xml序列化与反序列化工具

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...

  7. H3C Comware V3 端口聚合

    通常链路聚合有三种模式:手工汇聚.静态LACP汇聚和动态LACP汇聚. 但是V3版本下只提供了 手工聚合模式 manual 和 静态LACP聚合模式 static 两种 V3版本配置链路聚合 1,创建 ...

  8. 浅谈.net中数据库操作事务

    .net中的事务 关键几点 概念:1:什么是事务 2:什么时候用事务 3:基本的语法 (1): 事务(Transaction)是访问并可能更新数据库中各种数据项的一个程序执行单元(unit).事务通常 ...

  9. C语言 · 超级玛丽

    算法提高 超级玛丽   时间限制:1.0s   内存限制:256.0MB      问题描述 大家都知道"超级玛丽"是一个很善于跳跃的探险家,他的拿手好戏是跳跃,但它一次只能向前跳 ...

  10. 【算法】八皇后问题 Python实现

    [八皇后问题] 问题: 国际象棋棋盘是8 * 8的方格,每个方格里放一个棋子.皇后这种棋子可以攻击同一行或者同一列或者斜线(左上左下右上右下四个方向)上的棋子.在一个棋盘上如果要放八个皇后,使得她们互 ...