mybatis批量插入数据

1.service层

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

2.dao层

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

3.map文件

 1 <!-- 批量插入不复权数据 -->
 2     <insert id ="insertBatch_BFQ" parameterType="java.util.List" >
 3           insert into bfq_gsxq
 4           (uuid, qyname, gpdm, time,kpj,spj,zgj,zdj,cjsl,cjje,zf,hsl,gpgs)
 5           values
 6            <foreach collection ="list" item="bfq" index= "index" separator =",">
 7                (
 8                #{bfq.uuid}, #{bfq.qyname},#{bfq.gpdm},
 9                #{bfq.time},#{bfq.kpj}, #{bfq.spj},
10                #{bfq.zgj},#{bfq.zdj}, #{bfq.cjsl},
11                #{bfq.cjje},#{bfq.zf}, #{bfq.hsl},#{bfq.gpgs}
12                )
13            </foreach >
14     </insert >
View Code

 

posted @ 2018-07-17 10:39  有猿人  阅读(1865)  评论(2编辑  收藏  举报