欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

mysql批量添加数据

程序员文章站 2022-07-13 13:08:40
...

批量添加数据库数据:
Mapper方法:

 int batchInsert(List<Account> accountList);

Sql:

<insert id="batchInsert" parameterType="java.util.List">
    insert into tb_account(account_no, account_name, account_province, account_city, account_district, account_address, create_time) values
    <foreach collection="list" item="item" separator=",">
      (#{item.accountNo},#{item.accountName},#{item.accountProvince},#{item.accountCity},#{item.accountDistrict},#{item.accountAddress},now())
    </foreach>
  </insert>
相关标签: mysql java