Mybatis -- 批量添加 -- insertBatch

啦啦啦

---------------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>

啦啦啦

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

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