<?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.ruoyi.project.business.mapper.contract.TqContractLiftHistoryMapper">
    
    <resultMap type="TqContractLiftHistory" id="TqContractLiftHistoryResult">
        <result property="id"    column="id"    />
        <result property="contractNo"    column="contract_no"    />
        <result property="contractName"    column="contract_name"    />
        <result property="areaId"    column="area_id"    />
        <result property="countryId"    column="country_id"    />
        <result property="city"    column="city"    />
        <result property="salesman"    column="salesman"    />
        <result property="endCustomers"    column="end_customers"    />
        <result property="tradeTerms"    column="trade_terms"    />
        <result property="agentId"    column="agent_id"    />
        <result property="paymentMethod"    column="payment_method"    />
        <result property="currencyId"    column="currency_id"    />
        <result property="amountOfMoney"    column="amount_of_money"    />
        <result property="signingDate"    column="signing_date"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="remark"    column="remark"    />
        <result property="permissionChar"    column="permission_char"    />
        <result property="productionOrderNo"    column="production_order_no"    />
        <result property="contractNoVersionNo"    column="contract_no_version_no"    />
        <result property="salesModel"    column="sales_model"    />
        <result property="contractAmendmentDate"    column="contract_amendment_date"    />
        <result property="productCategory"    column="product_category"    />
        <result property="elevatorModel"    column="elevator_model"    />
        <result property="specification"    column="specification"    />
        <result property="count"    column="count"    />
        <result property="unitPrice"    column="unit_price"    />
        <result property="quotationDiscount"    column="quotation_discount"    />
        <result property="expectedProductionScheduleDate"    column="expected_production_schedule_date"    />
        <result property="hopeToScheduleProductionDate"    column="hope_to_schedule_production_date"    />
        <result property="actualProductionScheduleDate"    column="actual_production_schedule_date"    />
        <result property="productionScheduleDate"    column="production_schedule_date"    />
        <result property="reasonForProjectCancellationAndSus"    column="reason_for_project_cancellation_and_sus"    />
        <result property="reasonForDelayedOverdueShipment"    column="reason_for_delayed_overdue_shipment"    />
        <result property="reasonForNonScheduling"    column="reason_for_non_scheduling"    />
        <result property="hopeForDeliveryDate"    column="hope_for_delivery_date"    />
        <result property="actualDeliveryDate"    column="actual_delivery_date"    />
        <result property="port"    column="port"    />
        <result property="productionOrderStatus"    column="production_order_status"    />
        <result property="reviewDiscount"    column="review_discount"    />
        <result property="reviewShippingCosts"    column="review_shipping_costs"    />
        <result property="reviewCommission"    column="review_commission"    />
        <result property="commissionPaymentDate"    column="commission_payment_date"    />
        <result property="payoutDate"    column="payout_date"    />
        <result property="receivingBank"    column="receiving_bank"    />
        <result property="receivedAmount"    column="received_amount"    />
        <result property="paymentRatio"    column="payment_ratio"    />
        <result property="accountsReceivableBalance"    column="accounts_receivable_balance"    />
        <result property="planAdjustmentDate"    column="plan_adjustment_date"    />
        <result property="actualInlandFreightCost"    column="actual_inland_freight_cost"    />
        <result property="actualOceanFreight"    column="actual_ocean_freight"    />
        <result property="invoiceDate"    column="invoice_date"    />
        <result property="customsDeclarationMonth"    column="customs_declaration_month"    />
        <result property="subsequentCollectionOfShippingFees"    column="subsequent_collection_of_shipping_fees"    />
        <result property="collectionDate"    column="collection_date"    />
        <result property="planInlandFreightCost"    column="plan_inland_freight_cost"    />
        <result property="planOceanFreight"    column="plan_ocean_freight"    />
        <result property="projectStatus"    column="project_status"    />
        <result property="rate4ProductionScheduling"    column="rate_4_production_scheduling"    />
        <result property="rate4Shipment"    column="rate_4_shipment"    />
        <result property="rate4SigningContracts"    column="rate_4_signing_contracts"    />
        <result property="elevatorCode"    column="elevator_code"    />
        <result property="origin"    column="origin"    />
        <result property="elevatorType"    column="elevator_type"    />
        <result property="quotationNoVersion"    column="quotation_no_version"    />
        <result property="projectName"    column="project_name"    />
        <result property="quoter"    column="quoter"    />
        <result property="additionalCost"    column="additional_cost"    />
        <result property="version"    column="version"    />
        <result property="otherCost"    column="other_cost"    />
        <result property="liftAmount"    column="lift_amount"    />
    </resultMap>

    <sql id="selectTqContractLiftHistoryVo">
        select id, contract_no, contract_name, area_id, country_id, city, salesman, end_customers, trade_terms, agent_id, payment_method, currency_id, amount_of_money, signing_date, del_flag, create_time, create_by, update_time, update_by, remark, permission_char, production_order_no, contract_no_version_no, sales_model, contract_amendment_date, product_category, elevator_model, specification, count, unit_price, quotation_discount, expected_production_schedule_date, hope_to_schedule_production_date, actual_production_schedule_date, production_schedule_date, reason_for_project_cancellation_and_sus, reason_for_delayed_overdue_shipment, reason_for_non_scheduling, hope_for_delivery_date, actual_delivery_date, port, production_order_status, review_discount, review_shipping_costs, review_commission, commission_payment_date, payout_date, receiving_bank, received_amount, payment_ratio, accounts_receivable_balance, plan_adjustment_date, actual_inland_freight_cost, actual_ocean_freight, invoice_date, customs_declaration_month, subsequent_collection_of_shipping_fees, collection_date, plan_inland_freight_cost, plan_ocean_freight, project_status, rate_4_production_scheduling, rate_4_shipment, rate_4_signing_contracts, elevator_code, origin, elevator_type, quotation_no_version, project_name, quoter, additional_cost, version,other_cost,lift_amount from tq_contract_lift_history
    </sql>

    <select id="selectTqContractLiftHistoryList" parameterType="TqContractLiftHistory" resultMap="TqContractLiftHistoryResult">
        <include refid="selectTqContractLiftHistoryVo"/>
        <where>  
            <if test="contractNo != null  and contractNo != ''"> and contract_no = #{contractNo}</if>
            <if test="contractName != null  and contractName != ''"> and contract_name like concat('%', #{contractName}, '%')</if>
            <if test="areaId != null "> and area_id = #{areaId}</if>
            <if test="countryId != null "> and country_id = #{countryId}</if>
            <if test="city != null  and city != ''"> and city = #{city}</if>
            <if test="salesman != null "> and salesman = #{salesman}</if>
            <if test="endCustomers != null  and endCustomers != ''"> and end_customers = #{endCustomers}</if>
            <if test="tradeTerms != null  and tradeTerms != ''"> and trade_terms = #{tradeTerms}</if>
            <if test="agentId != null "> and agent_id = #{agentId}</if>
            <if test="paymentMethod != null  and paymentMethod != ''"> and payment_method = #{paymentMethod}</if>
            <if test="currencyId != null  and currencyId != ''"> and currency_id = #{currencyId}</if>
            <if test="amountOfMoney != null "> and amount_of_money = #{amountOfMoney}</if>
            <if test="signingDate != null "> and signing_date = #{signingDate}</if>
            <if test="permissionChar != null  and permissionChar != ''"> and permission_char = #{permissionChar}</if>
            <if test="productionOrderNo != null  and productionOrderNo != ''"> and production_order_no = #{productionOrderNo}</if>
            <if test="contractNoVersionNo != null  and contractNoVersionNo != ''"> and contract_no_version_no = #{contractNoVersionNo}</if>
            <if test="salesModel != null  and salesModel != ''"> and sales_model = #{salesModel}</if>
            <if test="contractAmendmentDate != null "> and contract_amendment_date = #{contractAmendmentDate}</if>
            <if test="productCategory != null  and productCategory != ''"> and product_category = #{productCategory}</if>
            <if test="elevatorModel != null  and elevatorModel != ''"> and elevator_model = #{elevatorModel}</if>
            <if test="specification != null  and specification != ''"> and specification = #{specification}</if>
            <if test="count != null "> and count = #{count}</if>
            <if test="unitPrice != null "> and unit_price = #{unitPrice}</if>
            <if test="quotationDiscount != null  and quotationDiscount != ''"> and quotation_discount = #{quotationDiscount}</if>
            <if test="expectedProductionScheduleDate != null "> and expected_production_schedule_date = #{expectedProductionScheduleDate}</if>
            <if test="hopeToScheduleProductionDate != null "> and hope_to_schedule_production_date = #{hopeToScheduleProductionDate}</if>
            <if test="actualProductionScheduleDate != null "> and actual_production_schedule_date = #{actualProductionScheduleDate}</if>
            <if test="productionScheduleDate != null "> and production_schedule_date = #{productionScheduleDate}</if>
            <if test="reasonForProjectCancellationAndSus != null  and reasonForProjectCancellationAndSus != ''"> and reason_for_project_cancellation_and_sus = #{reasonForProjectCancellationAndSus}</if>
            <if test="reasonForDelayedOverdueShipment != null  and reasonForDelayedOverdueShipment != ''"> and reason_for_delayed_overdue_shipment = #{reasonForDelayedOverdueShipment}</if>
            <if test="reasonForNonScheduling != null  and reasonForNonScheduling != ''"> and reason_for_non_scheduling = #{reasonForNonScheduling}</if>
            <if test="hopeForDeliveryDate != null "> and hope_for_delivery_date = #{hopeForDeliveryDate}</if>
            <if test="actualDeliveryDate != null "> and actual_delivery_date = #{actualDeliveryDate}</if>
            <if test="port != null  and port != ''"> and port = #{port}</if>
            <if test="productionOrderStatus != null  and productionOrderStatus != ''"> and production_order_status = #{productionOrderStatus}</if>
            <if test="reviewDiscount != null  and reviewDiscount != ''"> and review_discount = #{reviewDiscount}</if>
            <if test="reviewShippingCosts != null "> and review_shipping_costs = #{reviewShippingCosts}</if>
            <if test="reviewCommission != null "> and review_commission = #{reviewCommission}</if>
            <if test="commissionPaymentDate != null "> and commission_payment_date = #{commissionPaymentDate}</if>
            <if test="payoutDate != null "> and payout_date = #{payoutDate}</if>
            <if test="receivingBank != null  and receivingBank != ''"> and receiving_bank = #{receivingBank}</if>
            <if test="receivedAmount != null "> and received_amount = #{receivedAmount}</if>
            <if test="paymentRatio != null  and paymentRatio != ''"> and payment_ratio = #{paymentRatio}</if>
            <if test="accountsReceivableBalance != null "> and accounts_receivable_balance = #{accountsReceivableBalance}</if>
            <if test="planAdjustmentDate != null "> and plan_adjustment_date = #{planAdjustmentDate}</if>
            <if test="actualInlandFreightCost != null "> and actual_inland_freight_cost = #{actualInlandFreightCost}</if>
            <if test="actualOceanFreight != null "> and actual_ocean_freight = #{actualOceanFreight}</if>
            <if test="invoiceDate != null "> and invoice_date = #{invoiceDate}</if>
            <if test="customsDeclarationMonth != null "> and customs_declaration_month = #{customsDeclarationMonth}</if>
            <if test="subsequentCollectionOfShippingFees != null "> and subsequent_collection_of_shipping_fees = #{subsequentCollectionOfShippingFees}</if>
            <if test="collectionDate != null "> and collection_date = #{collectionDate}</if>
            <if test="planInlandFreightCost != null "> and plan_inland_freight_cost = #{planInlandFreightCost}</if>
            <if test="planOceanFreight != null "> and plan_ocean_freight = #{planOceanFreight}</if>
            <if test="projectStatus != null  and projectStatus != ''"> and project_status = #{projectStatus}</if>
            <if test="rate4ProductionScheduling != null "> and rate_4_production_scheduling = #{rate4ProductionScheduling}</if>
            <if test="rate4Shipment != null "> and rate_4_shipment = #{rate4Shipment}</if>
            <if test="rate4SigningContracts != null "> and rate_4_signing_contracts = #{rate4SigningContracts}</if>
            <if test="elevatorCode != null  and elevatorCode != ''"> and elevator_code = #{elevatorCode}</if>
            <if test="origin != null  and origin != ''"> and origin = #{origin}</if>
            <if test="elevatorType != null  and elevatorType != ''"> and elevator_type = #{elevatorType}</if>
            <if test="quotationNoVersion != null  and quotationNoVersion != ''"> and quotation_no_version = #{quotationNoVersion}</if>
            <if test="projectName != null  and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
            <if test="quoter != null  and quoter != ''"> and quoter = #{quoter}</if>
            <if test="additionalCost != null "> and additional_cost = #{additionalCost}</if>
            <if test="version != null "> and version = #{version}</if>
            <if test="otherCost != null "> and l.other_cost = #{otherCost}</if>
        </where>
    </select>
    
    <select id="selectTqContractLiftHistoryById" parameterType="Long" resultMap="TqContractLiftHistoryResult">
        <include refid="selectTqContractLiftHistoryVo"/>
        where id = #{id}
    </select>
    <select id="selectVersionMaxFromHistory" resultType="java.lang.Long">
        select version from tq_contract_history where del_flag = '0' and contract_no = #{contractNo}  limit 1
    </select>

    <insert id="insertTqContractLiftHistory" parameterType="TqContractLiftHistory" useGeneratedKeys="true" keyProperty="id">
        insert into tq_contract_lift_history
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="contractNo != null">contract_no,</if>
            <if test="contractName != null">contract_name,</if>
            <if test="areaId != null">area_id,</if>
            <if test="countryId != null">country_id,</if>
            <if test="city != null">city,</if>
            <if test="salesman != null">salesman,</if>
            <if test="endCustomers != null">end_customers,</if>
            <if test="tradeTerms != null">trade_terms,</if>
            <if test="agentId != null">agent_id,</if>
            <if test="paymentMethod != null">payment_method,</if>
            <if test="currencyId != null">currency_id,</if>
            <if test="amountOfMoney != null">amount_of_money,</if>
            <if test="signingDate != null">signing_date,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="remark != null">remark,</if>
            <if test="permissionChar != null">permission_char,</if>
            <if test="productionOrderNo != null">production_order_no,</if>
            <if test="contractNoVersionNo != null">contract_no_version_no,</if>
            <if test="salesModel != null">sales_model,</if>
            <if test="contractAmendmentDate != null">contract_amendment_date,</if>
            <if test="productCategory != null">product_category,</if>
            <if test="elevatorModel != null">elevator_model,</if>
            <if test="specification != null">specification,</if>
            <if test="count != null">count,</if>
            <if test="unitPrice != null">unit_price,</if>
            <if test="quotationDiscount != null">quotation_discount,</if>
            <if test="expectedProductionScheduleDate != null">expected_production_schedule_date,</if>
            <if test="hopeToScheduleProductionDate != null">hope_to_schedule_production_date,</if>
            <if test="actualProductionScheduleDate != null">actual_production_schedule_date,</if>
            <if test="productionScheduleDate != null">production_schedule_date,</if>
            <if test="reasonForProjectCancellationAndSus != null">reason_for_project_cancellation_and_sus,</if>
            <if test="reasonForDelayedOverdueShipment != null">reason_for_delayed_overdue_shipment,</if>
            <if test="reasonForNonScheduling != null">reason_for_non_scheduling,</if>
            <if test="hopeForDeliveryDate != null">hope_for_delivery_date,</if>
            <if test="actualDeliveryDate != null">actual_delivery_date,</if>
            <if test="port != null">port,</if>
            <if test="productionOrderStatus != null">production_order_status,</if>
            <if test="reviewDiscount != null">review_discount,</if>
            <if test="reviewShippingCosts != null">review_shipping_costs,</if>
            <if test="reviewCommission != null">review_commission,</if>
            <if test="commissionPaymentDate != null">commission_payment_date,</if>
            <if test="payoutDate != null">payout_date,</if>
            <if test="receivingBank != null">receiving_bank,</if>
            <if test="receivedAmount != null">received_amount,</if>
            <if test="paymentRatio != null">payment_ratio,</if>
            <if test="accountsReceivableBalance != null">accounts_receivable_balance,</if>
            <if test="planAdjustmentDate != null">plan_adjustment_date,</if>
            <if test="actualInlandFreightCost != null">actual_inland_freight_cost,</if>
            <if test="actualOceanFreight != null">actual_ocean_freight,</if>
            <if test="invoiceDate != null">invoice_date,</if>
            <if test="customsDeclarationMonth != null">customs_declaration_month,</if>
            <if test="subsequentCollectionOfShippingFees != null">subsequent_collection_of_shipping_fees,</if>
            <if test="collectionDate != null">collection_date,</if>
            <if test="planInlandFreightCost != null">plan_inland_freight_cost,</if>
            <if test="planOceanFreight != null">plan_ocean_freight,</if>
            <if test="projectStatus != null">project_status,</if>
            <if test="rate4ProductionScheduling != null">rate_4_production_scheduling,</if>
            <if test="rate4Shipment != null">rate_4_shipment,</if>
            <if test="rate4SigningContracts != null">rate_4_signing_contracts,</if>
            <if test="elevatorCode != null">elevator_code,</if>
            <if test="origin != null">origin,</if>
            <if test="elevatorType != null">elevator_type,</if>
            <if test="quotationNoVersion != null">quotation_no_version,</if>
            <if test="projectName != null">project_name,</if>
            <if test="quoter != null">quoter,</if>
            <if test="additionalCost != null">additional_cost,</if>
            <if test="version != null">version,</if>
            <if test="otherCost != null">other_cost,</if>
            <if test="liftAmount != null">lift_amount,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="contractNo != null">#{contractNo},</if>
            <if test="contractName != null">#{contractName},</if>
            <if test="areaId != null">#{areaId},</if>
            <if test="countryId != null">#{countryId},</if>
            <if test="city != null">#{city},</if>
            <if test="salesman != null">#{salesman},</if>
            <if test="endCustomers != null">#{endCustomers},</if>
            <if test="tradeTerms != null">#{tradeTerms},</if>
            <if test="agentId != null">#{agentId},</if>
            <if test="paymentMethod != null">#{paymentMethod},</if>
            <if test="currencyId != null">#{currencyId},</if>
            <if test="amountOfMoney != null">#{amountOfMoney},</if>
            <if test="signingDate != null">#{signingDate},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="remark != null">#{remark},</if>
            <if test="permissionChar != null">#{permissionChar},</if>
            <if test="productionOrderNo != null">#{productionOrderNo},</if>
            <if test="contractNoVersionNo != null">#{contractNoVersionNo},</if>
            <if test="salesModel != null">#{salesModel},</if>
            <if test="contractAmendmentDate != null">#{contractAmendmentDate},</if>
            <if test="productCategory != null">#{productCategory},</if>
            <if test="elevatorModel != null">#{elevatorModel},</if>
            <if test="specification != null">#{specification},</if>
            <if test="count != null">#{count},</if>
            <if test="unitPrice != null">#{unitPrice},</if>
            <if test="quotationDiscount != null">#{quotationDiscount},</if>
            <if test="expectedProductionScheduleDate != null">#{expectedProductionScheduleDate},</if>
            <if test="hopeToScheduleProductionDate != null">#{hopeToScheduleProductionDate},</if>
            <if test="actualProductionScheduleDate != null">#{actualProductionScheduleDate},</if>
            <if test="productionScheduleDate != null">#{productionScheduleDate},</if>
            <if test="reasonForProjectCancellationAndSus != null">#{reasonForProjectCancellationAndSus},</if>
            <if test="reasonForDelayedOverdueShipment != null">#{reasonForDelayedOverdueShipment},</if>
            <if test="reasonForNonScheduling != null">#{reasonForNonScheduling},</if>
            <if test="hopeForDeliveryDate != null">#{hopeForDeliveryDate},</if>
            <if test="actualDeliveryDate != null">#{actualDeliveryDate},</if>
            <if test="port != null">#{port},</if>
            <if test="productionOrderStatus != null">#{productionOrderStatus},</if>
            <if test="reviewDiscount != null">#{reviewDiscount},</if>
            <if test="reviewShippingCosts != null">#{reviewShippingCosts},</if>
            <if test="reviewCommission != null">#{reviewCommission},</if>
            <if test="commissionPaymentDate != null">#{commissionPaymentDate},</if>
            <if test="payoutDate != null">#{payoutDate},</if>
            <if test="receivingBank != null">#{receivingBank},</if>
            <if test="receivedAmount != null">#{receivedAmount},</if>
            <if test="paymentRatio != null">#{paymentRatio},</if>
            <if test="accountsReceivableBalance != null">#{accountsReceivableBalance},</if>
            <if test="planAdjustmentDate != null">#{planAdjustmentDate},</if>
            <if test="actualInlandFreightCost != null">#{actualInlandFreightCost},</if>
            <if test="actualOceanFreight != null">#{actualOceanFreight},</if>
            <if test="invoiceDate != null">#{invoiceDate},</if>
            <if test="customsDeclarationMonth != null">#{customsDeclarationMonth},</if>
            <if test="subsequentCollectionOfShippingFees != null">#{subsequentCollectionOfShippingFees},</if>
            <if test="collectionDate != null">#{collectionDate},</if>
            <if test="planInlandFreightCost != null">#{planInlandFreightCost},</if>
            <if test="planOceanFreight != null">#{planOceanFreight},</if>
            <if test="projectStatus != null">#{projectStatus},</if>
            <if test="rate4ProductionScheduling != null">#{rate4ProductionScheduling},</if>
            <if test="rate4Shipment != null">#{rate4Shipment},</if>
            <if test="rate4SigningContracts != null">#{rate4SigningContracts},</if>
            <if test="elevatorCode != null">#{elevatorCode},</if>
            <if test="origin != null">#{origin},</if>
            <if test="elevatorType != null">#{elevatorType},</if>
            <if test="quotationNoVersion != null">#{quotationNoVersion},</if>
            <if test="projectName != null">#{projectName},</if>
            <if test="quoter != null">#{quoter},</if>
            <if test="additionalCost != null">#{additionalCost},</if>
            <if test="version != null">#{version},</if>
            <if test="otherCost != null">#{otherCost},</if>
            <if test="liftAmount != null">#{liftAmount},</if>
         </trim>
    </insert>

    <insert id="insertTqContractLiftHistoryBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
        insert into tq_contract_lift_history
        (contract_no, contract_name, area_id, country_id, city, salesman, end_customers, trade_terms,
        agent_id, payment_method, currency_id, amount_of_money, signing_date, del_flag, create_time, create_by,
        update_time, update_by, remark, permission_char, production_order_no, contract_no_version_no, sales_model,
        contract_amendment_date, product_category, elevator_model, specification, count, unit_price,
        quotation_discount, expected_production_schedule_date, hope_to_schedule_production_date, actual_production_schedule_date,
        production_schedule_date, reason_for_project_cancellation_and_sus, reason_for_delayed_overdue_shipment,
        reason_for_non_scheduling, hope_for_delivery_date, actual_delivery_date, port, production_order_status,
        review_discount, review_shipping_costs, review_commission, commission_payment_date, payout_date, receiving_bank,
        received_amount, payment_ratio, accounts_receivable_balance, plan_adjustment_date, actual_inland_freight_cost,
        actual_ocean_freight, invoice_date, customs_declaration_month, subsequent_collection_of_shipping_fees, collection_date,
        plan_inland_freight_cost, plan_ocean_freight, project_status, rate_4_production_scheduling,
        rate_4_shipment,  rate_4_signing_contracts,elevator_code,
        origin,elevator_type,quotation_no_version,project_name,quoter,additional_cost,version,other_cost,lift_amount
        )
        values
        <foreach collection="list" item="item"  separator=",">
            (#{item.contractNo},#{item.contractName},#{item.areaId},#{item.countryId},#{item.city},
            #{item.salesman}, #{item.endCustomers},#{item.tradeTerms}, #{item.agentId},#{item.paymentMethod},
            #{item.currencyId},#{item.amountOfMoney},#{item.signingDate},#{item.delFlag},#{item.createTime},
            #{item.createBy},#{item.updateTime},#{item.updateBy},#{item.remark},#{item.permissionChar},
            #{item.productionOrderNo},#{item.contractNoVersionNo},#{item.salesModel},#{item.contractAmendmentDate},
            #{item.productCategory},#{item.elevatorModel},#{item.specification},#{item.count},
            #{item.unitPrice},#{item.quotationDiscount},#{item.expectedProductionScheduleDate},#{item.hopeToScheduleProductionDate},
            #{item.actualProductionScheduleDate},#{item.productionScheduleDate},#{item.reasonForProjectCancellationAndSus},
            #{item.reasonForDelayedOverdueShipment},#{item.reasonForNonScheduling},#{item.hopeForDeliveryDate},
            #{item.actualDeliveryDate},#{item.port},#{item.productionOrderStatus},#{item.reviewDiscount},#{item.reviewShippingCosts},
            #{item.reviewCommission},#{item.commissionPaymentDate},#{item.payoutDate},#{item.receivingBank},#{item.receivedAmount},
            #{item.paymentRatio},#{item.accountsReceivableBalance},#{item.planAdjustmentDate},#{item.actualInlandFreightCost},
            #{item.actualOceanFreight},#{item.invoiceDate},#{item.customsDeclarationMonth},#{item.subsequentCollectionOfShippingFees},
            #{item.collectionDate},#{item.planInlandFreightCost},#{item.planOceanFreight},#{item.projectStatus},
            #{item.rate4ProductionScheduling},#{item.rate4Shipment},
            #{item.rate4SigningContracts},#{item.elevatorCode},
            #{item.origin},#{item.elevatorType},#{item.quotationNoVersion},#{item.projectName},#{item.quoter},#{item.additionalCost},#{item.version},#{item.otherCost},
            #{item.liftAmount}
            )
        </foreach>
    </insert>

    <update id="updateTqContractLiftHistory" parameterType="TqContractLiftHistory">
        update tq_contract_lift_history
        <trim prefix="SET" suffixOverrides=",">
            <if test="contractNo != null">contract_no = #{contractNo},</if>
            <if test="contractName != null">contract_name = #{contractName},</if>
            <if test="areaId != null">area_id = #{areaId},</if>
            <if test="countryId != null">country_id = #{countryId},</if>
            <if test="city != null">city = #{city},</if>
            <if test="salesman != null">salesman = #{salesman},</if>
            <if test="endCustomers != null">end_customers = #{endCustomers},</if>
            <if test="tradeTerms != null">trade_terms = #{tradeTerms},</if>
            <if test="agentId != null">agent_id = #{agentId},</if>
            <if test="paymentMethod != null">payment_method = #{paymentMethod},</if>
            <if test="currencyId != null">currency_id = #{currencyId},</if>
            <if test="amountOfMoney != null">amount_of_money = #{amountOfMoney},</if>
            <if test="signingDate != null">signing_date = #{signingDate},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="permissionChar != null">permission_char = #{permissionChar},</if>
            <if test="productionOrderNo != null">production_order_no = #{productionOrderNo},</if>
            <if test="contractNoVersionNo != null">contract_no_version_no = #{contractNoVersionNo},</if>
            <if test="salesModel != null">sales_model = #{salesModel},</if>
            <if test="contractAmendmentDate != null">contract_amendment_date = #{contractAmendmentDate},</if>
            <if test="productCategory != null">product_category = #{productCategory},</if>
            <if test="elevatorModel != null">elevator_model = #{elevatorModel},</if>
            <if test="specification != null">specification = #{specification},</if>
            <if test="count != null">count = #{count},</if>
            <if test="unitPrice != null">unit_price = #{unitPrice},</if>
            <if test="quotationDiscount != null">quotation_discount = #{quotationDiscount},</if>
            <if test="expectedProductionScheduleDate != null">expected_production_schedule_date = #{expectedProductionScheduleDate},</if>
            <if test="hopeToScheduleProductionDate != null">hope_to_schedule_production_date = #{hopeToScheduleProductionDate},</if>
            <if test="actualProductionScheduleDate != null">actual_production_schedule_date = #{actualProductionScheduleDate},</if>
            <if test="productionScheduleDate != null">production_schedule_date = #{productionScheduleDate},</if>
            <if test="reasonForProjectCancellationAndSus != null">reason_for_project_cancellation_and_sus = #{reasonForProjectCancellationAndSus},</if>
            <if test="reasonForDelayedOverdueShipment != null">reason_for_delayed_overdue_shipment = #{reasonForDelayedOverdueShipment},</if>
            <if test="reasonForNonScheduling != null">reason_for_non_scheduling = #{reasonForNonScheduling},</if>
            <if test="hopeForDeliveryDate != null">hope_for_delivery_date = #{hopeForDeliveryDate},</if>
            <if test="actualDeliveryDate != null">actual_delivery_date = #{actualDeliveryDate},</if>
            <if test="port != null">port = #{port},</if>
            <if test="productionOrderStatus != null">production_order_status = #{productionOrderStatus},</if>
            <if test="reviewDiscount != null">review_discount = #{reviewDiscount},</if>
            <if test="reviewShippingCosts != null">review_shipping_costs = #{reviewShippingCosts},</if>
            <if test="reviewCommission != null">review_commission = #{reviewCommission},</if>
            <if test="commissionPaymentDate != null">commission_payment_date = #{commissionPaymentDate},</if>
            <if test="payoutDate != null">payout_date = #{payoutDate},</if>
            <if test="receivingBank != null">receiving_bank = #{receivingBank},</if>
            <if test="receivedAmount != null">received_amount = #{receivedAmount},</if>
            <if test="paymentRatio != null">payment_ratio = #{paymentRatio},</if>
            <if test="accountsReceivableBalance != null">accounts_receivable_balance = #{accountsReceivableBalance},</if>
            <if test="planAdjustmentDate != null">plan_adjustment_date = #{planAdjustmentDate},</if>
            <if test="actualInlandFreightCost != null">actual_inland_freight_cost = #{actualInlandFreightCost},</if>
            <if test="actualOceanFreight != null">actual_ocean_freight = #{actualOceanFreight},</if>
            <if test="invoiceDate != null">invoice_date = #{invoiceDate},</if>
            <if test="customsDeclarationMonth != null">customs_declaration_month = #{customsDeclarationMonth},</if>
            <if test="subsequentCollectionOfShippingFees != null">subsequent_collection_of_shipping_fees = #{subsequentCollectionOfShippingFees},</if>
            <if test="collectionDate != null">collection_date = #{collectionDate},</if>
            <if test="planInlandFreightCost != null">plan_inland_freight_cost = #{planInlandFreightCost},</if>
            <if test="planOceanFreight != null">plan_ocean_freight = #{planOceanFreight},</if>
            <if test="projectStatus != null">project_status = #{projectStatus},</if>
            <if test="rate4ProductionScheduling != null">rate_4_production_scheduling = #{rate4ProductionScheduling},</if>
            <if test="rate4Shipment != null">rate_4_shipment = #{rate4Shipment},</if>
            <if test="rate4SigningContracts != null">rate_4_signing_contracts = #{rate4SigningContracts},</if>
            <if test="elevatorCode != null">elevator_code = #{elevatorCode},</if>
            <if test="origin != null">origin = #{origin},</if>
            <if test="elevatorType != null">elevator_type = #{elevatorType},</if>
            <if test="quotationNoVersion != null">quotation_no_version = #{quotationNoVersion},</if>
            <if test="projectName != null">project_name = #{projectName},</if>
            <if test="quoter != null">quoter = #{quoter},</if>
            <if test="additionalCost != null">additional_cost = #{additionalCost},</if>
            <if test="version != null">version = #{version},</if>
            <if test="otherCost != null">other_cost = #{otherCost},</if>
            <if test="liftAmount != null">lift_amount = #{liftAmount},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTqContractLiftHistoryById" parameterType="Long">
        delete from tq_contract_lift_history where id = #{id}
    </delete>

    <delete id="deleteTqContractLiftHistoryByIds" parameterType="String">
        delete from tq_contract_lift_history where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>