InstallmentDetailsMapper.xml 5.71 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.InstallmentDetailsMapper" >

    <insert id="saveInstallmentDetails" keyProperty="recordId" useGeneratedKeys="true" parameterType="cn.com.polysoft.template.entity.InstallmentDetailsEntity">
        insert into installment_details(
        record_id,
        pay_date,
        final_reins_code,
        final_reins_name,
        currency,
        currency_type,
        balance,
        ri_premium,
        ri_commission,
        tax,
        fee_of_uw,
        fee_of_loss,
        paid_loss,
        cash_loss,
        survey_fee,
        premium_reserves_retained,
        loss_reserves_retained,
        profit_commission,
        interest,
        engineering_fee,
        brokerage,
        vat,
        vat_surtax,
        vat_deducion,
        brokerage_vat,
        create_time,
        treaty_fac_id,
        bill_type,
        serial_no,
        outstanding_losses
        ) values (
          #{recordId},
          #{payDate},
          #{finalReinsCode},
          #{finalReinsName},
          #{currency},
          #{currencyType},
          #{balance},
          #{riPremium},
          #{riCommission},
          #{tax},
          #{feeOfUw},
          #{feeOfLoss},
          #{paidLoss},
          #{cashLoss},
          #{surveyFee},
          #{premiumReservesRetained},
          #{lossReservesRetained},
          #{profitCommission},
          #{interest},
          #{engineeringFee},
          #{brokerage},
          #{vat},
          #{vatSurtax},
          #{vatDeducion},
          #{brokerageVat},
          #{createTime},
          #{treatyFacId},
          #{billType},
          #{serialNo},
          #{outstandingLosses}
        )
    </insert>

    <select id="queryInstallmentDetailsByCondition" resultType="cn.com.polysoft.template.entity.InstallmentDetailsEntity">
        select t.*,b.account_no,b.serial_number,b.your_share from installment_details t
        left join treaty_soa_info b on t.treaty_fac_id = b.record_id
        where t.treaty_fac_id = #{treatyFacId} and t.bill_type = #{billType} order by serial_no
    </select>

    <select id="queryByCondition" resultType="cn.com.polysoft.template.entity.InstallmentDetailsEntity">
        select * from installment_details t where 1 = 1 and t.treaty_fac_id = #{treatyFacId} and t.bill_type = #{billType} and t.currency = #{currency}
    </select>

    <select id="queryByBillId" resultType="cn.com.polysoft.template.vo.InstallmentDetailsVO">
        select * from installment_details t where t.treaty_fac_id = #{treatyFacId} and t.bill_type = #{billType} order by serial_no
    </select>

    <update id="updateDetail" parameterType="cn.com.polysoft.template.dto.property.InstallmentDetailsDTO">
        update installment_details
        <set>
            <if test="payDate != null and payDate != ''">pay_date = #{payDate},</if>
            <if test="payDate == null or payDate == ''">pay_date = null,</if>
            <!--<if test="finalReinsCode != null">final_reins_code = #{finalReinsCode},</if>-->
            <!--<if test="finalReinsName != null">final_reins_name = #{finalReinsName},</if>-->
            <if test="currency != null and currency != ''">currency = #{currency},</if>
            <if test="currency == null or currency == ''">currency = null,</if>
            <if test="currencyType != null and currencyType != ''">currency_type = #{currencyType},</if>
            <if test="currencyType == null or currencyType == ''">currency_type = null,</if>
            <if test="balance != null and balance != ''">balance = #{balance},</if>
            <if test="balance == null or balance == ''">balance = null,</if>
            <if test="riPremium != null and riPremium != ''">ri_premium = #{riPremium},</if>
            <if test="riPremium == null or riPremium == ''">ri_premium = null,</if>
            <if test="riCommission != null or riCommission == null">ri_commission = #{riCommission},</if>
            <if test="tax != null or tax == null">tax = #{tax},</if>
            <if test="feeOfUw != null or feeOfUw == null">fee_of_uw = #{feeOfUw},</if>
            <if test="feeOfLoss != null or feeOfLoss == null">fee_of_loss = #{feeOfLoss},</if>
            <if test="paidLoss != null or paidLoss == null">paid_loss = #{paidLoss},</if>
            <if test="cashLoss != null or cashLoss == null">cash_loss = #{cashLoss},</if>
            <if test="surveyFee != null or surveyFee == null">survey_fee = #{surveyFee},</if>
            <if test="premiumReservesRetained != null or premiumReservesRetained == null">premium_reserves_retained = #{premiumReservesRetained},</if>
            <if test="lossReservesRetained != null or lossReservesRetained == null">loss_reserves_retained = #{lossReservesRetained},</if>
            <if test="profitCommission != null or profitCommission == null">profit_commission = #{profitCommission},</if>
            <if test="interest != null or interest == null">interest = #{interest},</if>
            <if test="engineeringFee != null or engineeringFee == null">engineering_fee = #{engineeringFee},</if>
            <!--<if test="brokerage != null">brokerage = #{brokerage},</if>-->
            <if test="vat != null or vat == null">vat = #{vat},</if>
            <!--<if test="vatSurtax != null">vat_surtax = #{vatSurtax},</if>-->
            <!--<if test="vatDeducion != null">vat_deducion = #{vatDeducion},</if>-->
            <!--<if test="brokerageVat != null">brokerage_vat = #{brokerageVat},</if>-->
            <if test="outstandingLosses != null or outstandingLosses == null">outstanding_losses = #{outstandingLosses}</if>
        </set>
        where record_id = #{recordId}
    </update>
</mapper>