oracle批量保存sql信息

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zto.cloudcall.mapper.ZtoSupplierContractDetailMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.zto.cloudcall.model.ZtoSupplierContractDetail">
        <id column="ID" property="id"/>
        <result column="SUPPLIER_CONTRACT_ID" property="supplierContractId"/>
        <result column="CONTRACT_NO" property="contractNo"/>
        <result column="CONTRACT_NAME" property="contractName"/>
        <result column="BILLING_THEME" property="billingTheme"/>
        <result column="BILLING_STYLE" property="billingStyle"/>
        <result column="BILLING_UNIT" property="billingUnit"/>
        <result column="TAX_RATE" property="taxRate"/>
        <result column="UNIT_PRICE" property="unitPrice"/>
        <result column="PURCHASE_PATTERN" property="purchasePattern"/>
        <result column="CREATOR" property="creator"/>
        <result column="GMT_CREATE" property="gmtCreate"/>
        <result column="MODIFIER" property="modifier"/>
        <result column="GMT_MODIFIED" property="gmtModified"/>
        <result column="DELETED" property="deleted"/>
        <result column="VERSION" property="version"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        ID, SUPPLIER_CONTRACT_ID, CONTRACT_NO, CONTRACT_NAME, BILLING_THEME, BILLING_STYLE,BILLING_UNIT, TAX_RATE,UNIT_PRICE, PURCHASE_PATTERN, CREATOR, GMT_CREATE, MODIFIER, GMT_MODIFIED, DELETED, VERSION
    </sql>
    <sql id="Contract_Detail_Column_List">
        ID, SUPPLIER_CONTRACT_ID, CONTRACT_NO, CONTRACT_NAME, BILLING_THEME, BILLING_STYLE,BILLING_UNIT, TAX_RATE,UNIT_PRICE, PURCHASE_PATTERN, CREATOR, GMT_CREATE
    </sql>


    <!--值的列表-->
    <sql id="Supplier_Contract_Detail_Column_List">
        -- 合同ID
        <if test="supplierContractId != null and  supplierContractId != ''">
            SUPPLIER_CONTRACT_ID,
        </if>
        -- 合同编码
        <if test="contractNo != null and item.contractNo != ''">
            CONTRACT_NO,
        </if>
        -- 合同名称
        <if test="contractName != null and contractName != ''">
            CONTRACT_NAME,
        </if>
        -- 计费主题
        <if test="billingTheme != null and  billingTheme != ''">
            BILLING_THEME,
        </if>
        <if test="billingStyle != null and billingStyle != ''">
            BILLING_STYLE,
        </if>
        <if test="billingUnit != null and billingUnit != ''">
            BILLING_UNIT,
        </if>
        <if test="taxRate != null">
            TAX_RATE,
        </if>
        <if test="unitPrice != null ">
            UNIT_PRICE,
        </if>
        <if test="item.purchasePattern != null item.purchasePattern !=''">
            PURCHASE_PATTERN,
        </if>
        <if test="item.creator != null and item.creator != ''">
            CREATOR,
        </if>
        <if test="item.gmtCreate != null">
            GMT_CREATE,
        </if>
    </sql>

    <!--值的列表-->
    <sql id="Supplier_Contract_Detail_Value_List">
        <if test="item.supplierContractId != null and  item.supplierContractId != ''">
            #{item.supplierContractId,jdbcType=VARCHAR},
        </if>
        -- 合同编码
        <if test="item.contractNo != null and item.contractNo != ''">
            #{item.contractNo,jdbcType=VARCHAR},
        </if>
        -- 合同名称
        <if test="item.contractName != null and item.contractName != ''">
            #{item.contractName,jdbcType=VARCHAR},
        </if>
        -- 计费主题
        <if test="item.billingTheme != null and  item.billingTheme != ''">
            #{item.billingThem,jdbcType=VARCHAR},
        </if>
        <if test="item.billingStyle != null and item.billingStyle != ''">
            #{item.billingStyle,jdbcType=VARCHAR},
        </if>
        <if test="item.billingUnit != null and item.billingUnit != ''">
            #{item.billingUnit,jdbcType=VARCHAR},
        </if>
        <if test="item.taxRate != null">
            #{item.taxRate,jdbcType=DECIMAL},
        </if>
        <if test="item.unitPrice != null ">
            #{item.unitPrice,jdbcType=DECIMAL},
        </if>
        <if test="item.purchasePattern != null and item.purchasePattern !='' ">
            #{item.purchasePattern,jdbcType=VARCHAR},
        </if>
        <if test="item.creator != null and item.creator != ''">
            #{item.creator,jdbcType=VARCHAR},
        </if>
        <if test="item.gmtCreate != null">
            #{item.gmtCreate,jdbcType=TIMESTAMP},
        </if>
    </sql>
    <sql id="Base_Batch_Column_List">
        ID, SUPPLIER_CONTRACT_ID, CONTRACT_NO,   CONTRACT_NAME,  BILLING_THEME,  BILLING_STYLE,  BILLING_UNIT, TAX_RATE,  UNIT_PRICE,   PURCHASE_PATTERN, CREATOR,GMT_CREATE,
    </sql>
    <!--新增供应商合同信息-->
    <insert id="addBatchContractDetail" parameterType="java.util.List" useGeneratedKeys="false">
        INSERT INTO ZTO_SUPPLIER_CONTRACT_DETAIL
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Batch_Column_List"/>
        </trim>
        <foreach collection="list" item="item" index="index" separator="union all">
            ( SELECT
            (SELECT SYS_GUID() AS id FROM dual),
            #{item.supplierContractId,jdbcType=VARCHAR},
            #{item.contractNo,jdbcType=VARCHAR},
            #{item.contractName,jdbcType=VARCHAR},
            #{item.billingTheme,jdbcType=VARCHAR},
            #{item.billingStyle,jdbcType=VARCHAR},
            #{item.billingUnit,jdbcType=VARCHAR},
            #{item.taxRate,jdbcType=DECIMAL},
            #{item.unitPrice,jdbcType=DECIMAL},
            #{item.purchasePattern,jdbcType=VARCHAR},
            #{item.creator,jdbcType=VARCHAR},
            #{item.gmtCreate,jdbcType=TIMESTAMP}
            FROM dual
            )
        </foreach>
    </insert>


</mapper>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值