首页 数据库 mybatis批量插入数据

mybatis批量插入数据

[2018-08-20 14:28 类别:数据库 阅读(394) ]

1.service层

int i=0;                    try {
                        i =         fqDao.insertBatch_BFQ(bfqs);//批量插入
                    } catch (Exception e) {
                        e.printStackTrace();
                    }

2.dao层

//批量插入不复权数据 public int insertBatch_BFQ(List<GSXQ_K_LineOfDay> list);

3.map文件

<!-- 批量插入不复权数据 --><insert id ="insertBatch_BFQ" parameterType="java.util.List" >
      insert into bfq_gsxq
      (uuid, qyname, gpdm, time,kpj,spj,zgj,zdj,cjsl,cjje,zf,hsl,gpgs)
      values       <foreach collection ="list" item="bfq" index= "index" separator =",">
           (
           #{bfq.uuid}, #{bfq.qyname},#{bfq.gpdm},
           #{bfq.time},#{bfq.kpj}, #{bfq.spj},
           #{bfq.zgj},#{bfq.zdj}, #{bfq.cjsl},
           #{bfq.cjje},#{bfq.zf}, #{bfq.hsl},#{bfq.gpgs}
           )       </foreach ></insert >


关于博主Jansens