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>

啦啦啦

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM