zoukankan      html  css  js  c++  java
  • mysql批量新增的语法

    ?useUnicode=true//语序编码反射光hi

    &characterEncoding=UTF-8//字符

    &autoReconnect=true//自动连接

    &useAffectedRows=true

    &zeroDateTimeBehavior=convertToNull//时区转换

    &autoReconnect=true//自动连接

    &failOverReadOnly=false

    &allowMultiQueries=true   批量处理多条sql语句

    根据列的选择进行批量插入,列需要就插入值,列不需要就不插入值,allowMultiQueries=true

    List<OrderInfoProduct> orderInfoProducts= (List<OrderInfoProduct>) orderRequestAddParam.getOrderInfoProducts();
    <foreach collection="list" item="item" index="index" separator =";"> //分号分隔,符合mysql语法特点
    insert into ORDER_INFO_PRODUCT
    <trim prefix="(" suffix=")" suffixOverrides=",">
    <if test="item.customerId != null">
    CUSTOMER_ID,
    </if>
    <if test="item.customerName != null">
    CUSTOMER_NAME,
    </if>
    </trim>
    <trim prefix="VALUES(" suffix=")" suffixOverrides=",">
    <if test="item.customerId != null">
    #{item.customerId,jdbcType=VARCHAR},
    </if>
    <if test="item.customerName != null">
    #{item.customerName,jdbcType=VARCHAR},
    </if>
    </trim>
    </foreach>
     
    一点点学习,一丝丝进步。不懈怠,才不会被时代淘汰
  • 相关阅读:
    用windows脚本实现文件下载
    pku1325 Machine Schedule
    中位数
    pku1468 Rectangles
    最小密度路径
    合并序列
    PowerDesigner(5)转载
    责任链模式
    PowerDesigner(3)转载
    解释器模式
  • 原文地址:https://www.cnblogs.com/wangbiaohistory/p/14271543.html
Copyright © 2011-2022 走看看