码迷,mamicode.com
首页 > 其他好文 > 详细

Mybatis -- 批量添加 -- insertBatch

时间:2017-04-26 15:55:09      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:index   log   批量   int   type   nod   list   插入   item   

啦啦啦

---------------InsertBatch

Class : Dao

    /**
     * 批量插入perfEnvirons
     * 
     * @author Liang
     *
     * 2017年4月25日
     */
    void insertBatch(List<PerfEnviron> perfEnvirons);

XML : 

    <insert id="insertBatch">
        INSERT INTO perf_environ(node_id,`type`,perf_time,pm25_h,pm10_h,temp_h,humi_h,co2_h,tvoc_h)
        VALUES
        <foreach collection="list" close="" index="index" item="item" open="" separator=",">
        (#{item.nodeId},#{item.type},#{item.perfTime},#{item.pm25H},#{item.pm10H},#{item.tempH},#{item.humiH},#{item.co2H},#{item.tvocH})
        </foreach>
    </insert>

啦啦啦

---------------

Mybatis -- 批量添加 -- insertBatch

标签:index   log   批量   int   type   nod   list   插入   item   

原文地址:http://www.cnblogs.com/ClassNotFoundException/p/6768426.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!