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>

啦啦啦

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

时间: 2024-10-10 02:47:53

Mybatis -- 批量添加 -- insertBatch的相关文章

myBatis批量添加,修改和删除

摘自: http://blog.csdn.net/myjlvzlp/article/details/8434376 1.批量添加元素session.insert(String string,Object o) public void batchInsertStudent(){ List<Student> ls = new ArrayList<Student>(); for(int i = 5;i < 8;i++){ Student student = new Student(

mybatis 批量添加对象

<!-- [添加 批量] insertBatch --> <insert id="insertBatch" parameterType="list"> insert e_Kpnr(id,ghdw_id,hwhyslwmc, ggxh, dw, sl, dj, je, shlv, se) values <foreach collection="list" item="obj" index="

Mybatis批量添加对象List

1.对应的xml文件: <!--批量添加--><insert id="insertStandardItemInfo" parameterType="hashmap"> insert into t_standard_item(standard_id,item_id) values <foreach collection="itemIdList" index="index" item="it

mybatis批量添加、批量删除

<!-- 批量添加 --> <insert id="insertNameListSynHisBatch" parameterType="java.util.List" useGeneratedKeys="false"> insert into tb_namelist_syn_his (SERIAL, RECORDNUMBER, HASHTBNAME, CTLTYPE, SOURCE, CREATETIME, CKEY, C

MyBatis批量添加和删除

p.MsoNormal,li.MsoNormal,div.MsoNormal { margin: 0cm; margin-bottom: .0001pt; text-align: justify; font-size: 10.5pt; font-family: 等线 } h1 { margin-right: 0cm; margin-left: 0cm; font-size: 24.0pt; font-family: 宋体; font-weight: bold } p { margin-right

Mybatis批量添加,删除与修改

1.批量添加元素session.insert(String string,object O) public void batchInsertStudent(){ List<Student> ls = new ArrayList<Student>(); for(int i = 5;i < 8;i++){ Student student = new Student(); student.setId(i); student.setName("maoyuanjun"

mybatis批量添加数据的三种方式

原文地址:https://www.cnblogs.com/gxyandwmm/p/9565002.html 原文地址:https://www.cnblogs.com/liu1275271818/p/12117925.html

【mybatis】之批量添加

mybatis批量添加xml <insert id="batchCreate"> INSERT INTO `roomer` (`order`,name,idCard,mobile,timePreCheckin,timePreCheckout,hotel) values <foreach collection="collection" item="item" index="index" separator=&q

mybatis批量导入 ,出现异常全部不添加(回滚)

public int importModel(MultipartFile file) throws Exception{ String fileName = file.getOriginalFilename(); String suffxName = fileName.substring(fileName.lastIndexOf(".",fileName.length()) ); //System.out.println(fileName+",后缀名:"+suffx