BillSubItemMapper.xml 8.1 KB
<?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="cn.com.polysoft.template.dao.BillSubItemMapper" >

    <insert id="saveBillSubItemMapper" parameterType="cn.com.polysoft.template.dto.BillSubItemDTO" keyProperty="id" useGeneratedKeys="true">
        insert into t_bill_sub_item(
        id,
        sub_item_num,
        contract_sub_item,
        sub_item_name,
        currency_orig,
        item_value_orig,
        currency,
        currency_balance,
        share_out,
        reinsurance_premium,
        brokerage,
        indemnity,
        outstanding_claims,
        happen_outstanding_claims,
        premium_added_tax,
        premium_added_tax_additional,
        premium_added_tax_deduction,
        bill_id,
        broker_added_tax,
        broker_added_tax_additional,
        broker_added_tax_deduction,
        broker_tax_add_deduction,
        service_charge,
        status,
        document_num,
        create_time,
        serial_number,
        it_remarks,
        sepe_flag,
        settle_type,
        stage_num,
        should_settlement_date,
        last_settlement_date,
        premium_tax_added_deduction,
        underwriting_other_expenses,
        claim_other_expenses,
        cash_indemnity,
        item_exp_en,
        tax,
        premium_reserve,
        loss_reserves,
        profit_commission,
        interest,
        survey_fee,
        adjustment_fee,
        added_tax_mark
        )values (
            #{id},
            #{subItemNum},
            #{contractSubItem},
            #{subItemName},
            #{currencyOrig},
            #{itemValueOrig},
            #{currency},
            #{currencyBalance},
            #{shareOut},
            #{reinsurancePremium},
            #{brokerage},
            #{indemnity},
            #{outstandingClaims},
            #{happenOutstandingClaims},
            #{premiumAddedTax},
            #{premiumAddedTaxAdditional},
            #{premiumAddedTaxDeduction},
            #{billId},
            #{brokerAddedTax},
            #{brokerAddedTaxAdditional},
            #{brokerAddedTaxDeduction},
            #{brokerTaxAddDeduction},
            #{serviceCharge},
            #{status},
            #{documentNum},
            now(),
            #{serialNumber},
            #{itRemarks},
            #{sepeFlag},
            #{settleType},
            #{stageNum},
            #{shouldSettlementDate},
            #{lastSettlementDate},
            #{premiumTaxAddedDeduction},
            #{underwritingOtherExpenses},
            #{claimOtherExpenses},
            #{cashIndemnity},
            #{itemExpEn},
            #{tax},
            #{premiumReserve},
            #{lossReserves},
            #{profitCommission},
            #{interest},
            #{surveyFee},
            #{adjustmentFee},
            #{addedTaxMark}
        )
    </insert>

    <update id="updateSubItem" parameterType="cn.com.polysoft.template.dto.BillSubItemDTO">
        update t_bill_sub_item
        <set>
            <if test="subItemNum != null">sub_item_num = #{subItemNum},</if>
            <if test="contractSubItem != null">contract_sub_item = #{contractSubItem},</if>
            <if test="subItemName != null">sub_item_name = #{subItemName},</if>
            <if test="currencyOrig != null">currency_orig = #{currencyOrig},</if>
            <if test="itemValueOrig != null">item_value_orig = #{itemValueOrig},</if>
            <if test="currency != null">currency = #{currency},</if>
            <if test="currencyBalance != null">currency_balance = #{currencyBalance},</if>
            <if test="shareOut != null">share_out = #{shareOut},</if>
            <if test="reinsurancePremium != null">reinsurance_premium = #{reinsurancePremium},</if>
            <if test="brokerage != null">brokerage = #{brokerage},</if>
            <if test="indemnity != null">indemnity = #{indemnity},</if>
            <if test="outstandingClaims != null">outstanding_claims = #{outstandingClaims},</if>
            <if test="happenOutstandingClaims != null">happen_outstanding_claims = #{happenOutstandingClaims},</if>
            <if test="premiumAddedTax != null">premium_added_tax = #{premiumAddedTax},</if>
            <if test="premiumAddedTaxAdditional != null">premium_added_tax_additional = #{premiumAddedTaxAdditional},</if>
            <if test="premiumAddedTaxDeduction != null">premium_added_tax_deduction = #{premiumAddedTaxDeduction},</if>
            <if test="brokerAddedTax != null">broker_added_tax = #{brokerAddedTax},</if>
            <if test="brokerAddedTaxAdditional != null">broker_added_tax_additional = #{brokerAddedTaxAdditional},</if>
            <if test="brokerAddedTaxDeduction != null">broker_added_tax_deduction = #{brokerAddedTaxDeduction},</if>
            <if test="brokerTaxAddDeduction != null">broker_tax_add_deduction = #{brokerTaxAddDeduction},</if>
            <if test="serviceCharge != null">service_charge = #{serviceCharge},</if>
            <if test="status != null">status = #{status},</if>
            <if test="documentNum != null">document_num = #{documentNum},</if>
            <if test="itRemarks != null">it_remarks = #{itRemarks},</if>
            <if test="sepeFlag != null">sepe_flag = #{sepeFlag},</if>
            <if test="settleType != null">settle_type = #{settleType},</if>
            <if test="stageNum != null">stage_num = #{stageNum},</if>
            <if test="shouldSettlementDate != null">should_settlement_date = #{shouldSettlementDate},</if>
            <if test="lastSettlementDate != null">last_settlement_date = #{lastSettlementDate},</if>
            <if test="premiumTaxAddedDeduction != null">premium_tax_added_deduction = #{premiumTaxAddedDeduction},</if>
            <if test="underwritingOtherExpenses != null">underwriting_other_expenses = #{underwritingOtherExpenses},</if>
            <if test="claimOtherExpenses != null">claim_other_expenses = #{claimOtherExpenses},</if>
            <if test="cashIndemnity != null">cash_indemnity = #{cashIndemnity},</if>
            <if test="tax != null">tax = #{tax},</if>
            <if test="premiumReserve != null">premium_reserve = #{premiumReserve},</if>
            <if test="lossReserves != null">loss_reserves = #{lossReserves},</if>
            <if test="profitCommission != null">profit_commission = #{profitCommission},</if>
            <if test="interest != null">interest = #{interest},</if>
            <if test="surveyFee != null">survey_fee = #{surveyFee},</if>
            <if test="adjustmentFee != null">adjustment_fee = #{adjustmentFee},</if>
            <if test="addedTaxMark != null">added_tax_mark = #{addedTaxMark},</if>
            modify_time = now()
        </set>
        where id = #{id}
    </update>

    <select id="getSubItemByBillId" resultType="cn.com.polysoft.template.vo.BillSubItemInfoVO">
        select * from t_bill_sub_item where bill_id = #{billId} and currency = #{currency}
    </select>

    <select id="getCurrencyByBillId" resultType="string">
        select currency from t_bill_sub_item where bill_id = #{billId} group by currency
    </select>

    <select id="getItemByBillId" resultType="cn.com.polysoft.template.vo.BillSubItemInfoVO">
        select a.*,b.articlecode_ss from t_bill_sub_item a
        inner join t_bill_base_info b on a.bill_id = b.id
        where a.bill_id = #{billId} and a.id = #{subItemId}
    </select>

    <select id="getMaxSerialNumber" resultType="string">
        select SUBSTR(serial_number, 3) from t_bill_sub_item where serial_number is not null  order by SUBSTR(serial_number, 3) desc limit 1
    </select>

    <update id="updateSubItemStatusAndBillNum">
        update t_bill_sub_item set bill_num = #{billNum},status = #{status} where serial_number = #{serialNumber}
    </update>

    <update id="updateFailReason">
        update t_bill_sub_item set status = #{status},fail_reason = #{failReason} where serial_number = #{serialNumber}
    </update>

    <select id="getFailReasonBySerialNumber" resultType="cn.com.polysoft.template.vo.FailReasonVO">
        select serial_number,fail_reason from t_bill_sub_item where serial_number = #{serialNumber}
    </select>
</mapper>