<?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.orderPlan.mapper.FtmsorderbillsfeesMapper">

    <resultMap type="FTmsorderbillsfees" id="FTmsorderbillsfeesResult">
        <result property="fId" column="f_id"/>
        <result property="fPid" column="f_pid"/>
        <result property="srcMId" column="src_m_id"/>
        <result property="actId" column="act_id"/>
        <result property="orgId" column="org_id"/>
        <result property="fLineno" column="f_lineno"/>
        <result property="fCorpid" column="f_corpid"/>
        <result property="fFeeid" column="f_feeid"/>
        <result property="fFeeunitid" column="f_feeUnitid"/>
        <result property="fQty" column="f_qty"/>
        <result property="fUnitprice" column="f_unitprice"/>
        <result property="fAmount" column="f_amount"/>
        <result property="fCurrency" column="f_currency"/>
        <result property="fExrate" column="f_exrate"/>
        <result property="fTaxrate" column="f_taxrate"/>
        <result property="fDc" column="f_dc"/>
        <result property="fReviewDate" column="f_review_date"/>
        <result property="fBillstatus" column="f_billstatus"/>
        <result property="fStatementNo" column="f_statement_no"/>
        <result property="fAccamount" column="f_accamount"/>
        <result property="fAccamountDate" column="f_accamount_date"/>
        <result property="fStlamountNo" column="f_stlamount_no"/>
        <result property="fStlamount" column="f_stlamount"/>
        <result property="fStlamountDate" column="f_stlamount_date"/>
        <result property="fInvnos" column="f_invnos"/>
        <result property="fInvamount" column="f_invamount"/>
        <result property="fAskamount" column="f_askamount"/>
        <result property="fStatus" column="f_status"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
        <result property="srcId" column="src_id"/>
        <result property="srcBillNo" column="src_bill_no"/>
        <result property="fMblno" column="f_mblno"/>
        <result property="fProductName" column="f_product_name"/>
        <result property="fMarks" column="f_marks"/>
        <result property="fChargedate" column="f_chargedate"/>
        <result property="fBillingDeadline" column="f_billing_deadline"/>
        <result property="fInventoryDays" column="f_inventory_days"/>
        <result property="fAmt" column="f_amt"/>
        <result property="fBillingDays" column="f_billing_days"/>
        <result property="fBillingQty" column="f_billing_qty"/>
        <result property="fBilltype" column="f_billtype"/>
        <result property="fBillingway" column="f_billingway"/>
        <result property="fBsdate" column="f_bsdate"/>
        <result property="fOriginalbilldate" column="f_originalbilldate"/>
        <result property="fStltypeid" column="f_stltypeid"/>
        <result property="remarks" column="remarks"/>
    </resultMap>

    <sql id="selectFTmsorderbillsfeesVo">
        select f_id, f_pid, act_id ,org_id, f_lineno, f_corpid, f_feeid, f_feeUnitid, f_qty, f_unitprice, f_amount, f_currency, f_exrate, f_taxrate, f_dc, f_review_date, f_billstatus, f_statement_no, f_accamount, f_accamount_date, f_stlamount_no, f_stlamount, f_stlamount_date, f_invnos, f_invamount, f_askamount, f_status, del_flag, create_by, create_time, update_by, update_time, remark, src_id, src_bill_no, f_mblno, f_product_name, f_marks, f_chargedate, f_billing_deadline, f_inventory_days, f_amt, f_billing_days, f_billing_qty, f_billtype, f_billingway, f_bsdate, f_originalbilldate, f_stltypeid, remarks from F_TMSORDERBILLSFEES
    </sql>

    <sql id="selectFTmsorderbillsfeesTemporaryStorageVo">
        select f_id, f_pid,src_m_id, act_id ,org_id, f_lineno, f_corpid, f_feeid, f_feeUnitid, f_qty, f_unitprice, f_amount, f_currency, f_exrate, f_taxrate, f_dc, f_review_date, f_billstatus, f_statement_no, f_accamount, f_accamount_date, f_stlamount_no, f_stlamount, f_stlamount_date, f_invnos, f_invamount, f_askamount, f_status, del_flag, create_by, create_time, update_by, update_time, remark, src_id, src_bill_no, f_mblno, f_product_name, f_marks, f_chargedate, f_billing_deadline, f_inventory_days, f_amt, f_billing_days, f_billing_qty, f_billtype, f_billingway, f_bsdate, f_originalbilldate, f_stltypeid, remarks from F_TMSORDERBILLSFEES_MODIFY
    </sql>

    <select id="selectFTmsorderbillsfeesList" parameterType="FTmsorderbillsfees" resultMap="FTmsorderbillsfeesResult">
        <include refid="selectFTmsorderbillsfeesVo"/>
        <where>
            <if test="fPid != null ">and f_pid = #{fPid}</if>
            <if test="actId != null ">and act_id = #{actId}</if>
            <if test="orgId != null ">and org_id = #{orgId}</if>
            <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
            <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
            <if test="fFeeid != null ">and f_feeid = #{fFeeid}</if>
            <if test="fFeeunitid != null ">and f_feeUnitid = #{fFeeunitid}</if>
            <if test="fQty != null ">and f_qty = #{fQty}</if>
            <if test="fUnitprice != null ">and f_unitprice = #{fUnitprice}</if>
            <if test="fAmount != null ">and f_amount = #{fAmount}</if>
            <if test="fCurrency != null  and fCurrency != ''">and f_currency = #{fCurrency}</if>
            <if test="fExrate != null ">and f_exrate = #{fExrate}</if>
            <if test="fTaxrate != null ">and f_taxrate = #{fTaxrate}</if>
            <if test="fDc != null  and fDc != ''">and f_dc = #{fDc}</if>
            <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
            <if test="fBillstatus != null ">and f_billstatus = #{fBillstatus}</if>
            <if test="fStatementNo != null  and fStatementNo != ''">and f_statement_no = #{fStatementNo}</if>
            <if test="fAccamount != null ">and f_accamount = #{fAccamount}</if>
            <if test="fAccamountDate != null ">and f_accamount_date = #{fAccamountDate}</if>
            <if test="fStlamountNo != null  and fStlamountNo != ''">and f_stlamount_no = #{fStlamountNo}</if>
            <if test="fStlamount != null ">and f_stlamount = #{fStlamount}</if>
            <if test="fStlamountDate != null ">and f_stlamount_date = #{fStlamountDate}</if>
            <if test="fInvnos != null  and fInvnos != ''">and f_invnos = #{fInvnos}</if>
            <if test="fInvamount != null ">and f_invamount = #{fInvamount}</if>
            <if test="fAskamount != null ">and f_askamount = #{fAskamount}</if>
            <if test="fStatus != null ">and f_status = #{fStatus}</if>
            <if test="srcId != null ">and src_id = #{srcId}</if>
            <if test="srcBillNo != null  and srcBillNo != ''">and src_bill_no = #{srcBillNo}</if>
            <if test="fMblno != null  and fMblno != ''">and f_mblno = #{fMblno}</if>
            <if test="fProductName != null  and fProductName != ''">and f_product_name like concat('%', #{fProductName},'%')</if>
            <if test="fMarks != null  and fMarks != ''">and f_marks = #{fMarks}</if>
            <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
            <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
            <if test="fInventoryDays != null ">and f_inventory_days = #{fInventoryDays}</if>
            <if test="fAmt != null ">and f_amt = #{fAmt}</if>
            <if test="fBillingDays != null ">and f_billing_days = #{fBillingDays}</if>
            <if test="fBillingQty != null ">and f_billing_qty = #{fBillingQty}</if>
            <if test="fBilltype != null  and fBilltype != ''">and f_billtype = #{fBilltype}</if>
            <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
            <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
            <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
            <if test="fStltypeid != null ">and f_stltypeid = #{fStltypeid}</if>
            <if test="remarks != null  and remarks != ''">and remarks = #{remarks}</if>
        </where>
        ORDER BY f_dc DESC
    </select>

    <select id="selectFTmsorderbillsfeesTemporaryStorageList" parameterType="FTmsorderbillsfees" resultMap="FTmsorderbillsfeesResult">
        <include refid="selectFTmsorderbillsfeesTemporaryStorageVo"/>
        <where>
            <if test="fPid != null ">and f_pid = #{fPid}</if>
            <if test="actId != null ">and act_id = #{actId}</if>
            <if test="srcMId != null ">and src_m_id = #{srcMId}</if>
            <if test="orgId != null ">and org_id = #{orgId}</if>
            <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
            <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
            <if test="fFeeid != null ">and f_feeid = #{fFeeid}</if>
            <if test="fFeeunitid != null ">and f_feeUnitid = #{fFeeunitid}</if>
            <if test="fQty != null ">and f_qty = #{fQty}</if>
            <if test="fUnitprice != null ">and f_unitprice = #{fUnitprice}</if>
            <if test="fAmount != null ">and f_amount = #{fAmount}</if>
            <if test="fCurrency != null  and fCurrency != ''">and f_currency = #{fCurrency}</if>
            <if test="fExrate != null ">and f_exrate = #{fExrate}</if>
            <if test="fTaxrate != null ">and f_taxrate = #{fTaxrate}</if>
            <if test="fDc != null  and fDc != ''">and f_dc = #{fDc}</if>
            <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
            <if test="fBillstatus != null ">and f_billstatus = #{fBillstatus}</if>
            <if test="fStatementNo != null  and fStatementNo != ''">and f_statement_no = #{fStatementNo}</if>
            <if test="fAccamount != null ">and f_accamount = #{fAccamount}</if>
            <if test="fAccamountDate != null ">and f_accamount_date = #{fAccamountDate}</if>
            <if test="fStlamountNo != null  and fStlamountNo != ''">and f_stlamount_no = #{fStlamountNo}</if>
            <if test="fStlamount != null ">and f_stlamount = #{fStlamount}</if>
            <if test="fStlamountDate != null ">and f_stlamount_date = #{fStlamountDate}</if>
            <if test="fInvnos != null  and fInvnos != ''">and f_invnos = #{fInvnos}</if>
            <if test="fInvamount != null ">and f_invamount = #{fInvamount}</if>
            <if test="fAskamount != null ">and f_askamount = #{fAskamount}</if>
            <if test="fStatus != null ">and f_status = #{fStatus}</if>
            <if test="srcId != null ">and src_id = #{srcId}</if>
            <if test="srcBillNo != null  and srcBillNo != ''">and src_bill_no = #{srcBillNo}</if>
            <if test="fMblno != null  and fMblno != ''">and f_mblno = #{fMblno}</if>
            <if test="fProductName != null  and fProductName != ''">and f_product_name like concat('%', #{fProductName},'%')</if>
            <if test="fMarks != null  and fMarks != ''">and f_marks = #{fMarks}</if>
            <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
            <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
            <if test="fInventoryDays != null ">and f_inventory_days = #{fInventoryDays}</if>
            <if test="fAmt != null ">and f_amt = #{fAmt}</if>
            <if test="fBillingDays != null ">and f_billing_days = #{fBillingDays}</if>
            <if test="fBillingQty != null ">and f_billing_qty = #{fBillingQty}</if>
            <if test="fBilltype != null  and fBilltype != ''">and f_billtype = #{fBilltype}</if>
            <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
            <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
            <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
            <if test="fStltypeid != null ">and f_stltypeid = #{fStltypeid}</if>
            <if test="remarks != null  and remarks != ''">and remarks = #{remarks}</if>
        </where>
        ORDER BY f_dc DESC
    </select>

    <select id="selectFTmsorderbillsfeesById" parameterType="Long" resultMap="FTmsorderbillsfeesResult">
        <include refid="selectFTmsorderbillsfeesVo"/>
        where f_id = #{fId}
    </select>

    <select id="selectFTmsorderbillsfeesModifyById" parameterType="Long" resultMap="FTmsorderbillsfeesResult">
        <include refid="selectFTmsorderbillsfeesTemporaryStorageVo"/>
        where f_id = #{fId}
    </select>

    <select id="selectFTmsorderbillsfeesByPId" parameterType="Long" resultMap="FTmsorderbillsfeesResult">
        <include refid="selectFTmsorderbillsfeesVo"/>
        where f_pid = #{fId}
    </select>

    <select id="selectFTmsorderbillsfeesBySrcMId" parameterType="Long" resultMap="FTmsorderbillsfeesResult">
        <include refid="selectFTmsorderbillsfeesTemporaryStorageVo"/>
        where src_m_id = #{srcMId}
    </select>

    <select id="selectFTmsorderbillsfeesCount" parameterType="FTmsorderbillsfees" resultType="int">
        select count(f_id) from F_TMSORDERBILLSFEES
        <where>
            <if test="fPid != null ">and f_pid = #{fPid}</if>
            <if test="actId != null ">and act_id = #{actId}</if>
            <if test="orgId != null ">and org_id = #{orgId}</if>
            <if test="fLineno != null ">and f_lineno = #{fLineno}</if>
            <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
            <if test="fFeeid != null ">and f_feeid = #{fFeeid}</if>
            <if test="fFeeunitid != null ">and f_feeUnitid = #{fFeeunitid}</if>
            <if test="fQty != null ">and f_qty = #{fQty}</if>
            <if test="fUnitprice != null ">and f_unitprice = #{fUnitprice}</if>
            <if test="fAmount != null ">and f_amount = #{fAmount}</if>
            <if test="fCurrency != null  and fCurrency != ''">and f_currency = #{fCurrency}</if>
            <if test="fExrate != null ">and f_exrate = #{fExrate}</if>
            <if test="fTaxrate != null ">and f_taxrate = #{fTaxrate}</if>
            <if test="fDc != null  and fDc != ''">and f_dc = #{fDc}</if>
            <if test="fReviewDate != null ">and f_review_date = #{fReviewDate}</if>
            <if test="fBillstatus != null ">and f_billstatus = #{fBillstatus}</if>
            <if test="fStatementNo != null  and fStatementNo != ''">and f_statement_no = #{fStatementNo}</if>
            <if test="fAccamount != null ">and f_accamount = #{fAccamount}</if>
            <if test="fAccamountDate != null ">and f_accamount_date = #{fAccamountDate}</if>
            <if test="fStlamountNo != null  and fStlamountNo != ''">and f_stlamount_no = #{fStlamountNo}</if>
            <if test="fStlamount != null ">and f_stlamount = #{fStlamount}</if>
            <if test="fStlamountDate != null ">and f_stlamount_date = #{fStlamountDate}</if>
            <if test="fInvnos != null  and fInvnos != ''">and f_invnos = #{fInvnos}</if>
            <if test="fInvamount != null ">and f_invamount = #{fInvamount}</if>
            <if test="fAskamount != null ">and f_askamount = #{fAskamount}</if>
            <if test="fStatus != null ">and f_status = #{fStatus}</if>
            <if test="srcId != null ">and src_id = #{srcId}</if>
            <if test="srcBillNo != null  and srcBillNo != ''">and src_bill_no = #{srcBillNo}</if>
            <if test="fMblno != null  and fMblno != ''">and f_mblno = #{fMblno}</if>
            <if test="fProductName != null  and fProductName != ''">and f_product_name like concat('%', #{fProductName},'%')</if>
            <if test="fMarks != null  and fMarks != ''">and f_marks = #{fMarks}</if>
            <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
            <if test="fBillingDeadline != null ">and f_billing_deadline = #{fBillingDeadline}</if>
            <if test="fInventoryDays != null ">and f_inventory_days = #{fInventoryDays}</if>
            <if test="fAmt != null ">and f_amt = #{fAmt}</if>
            <if test="fBillingDays != null ">and f_billing_days = #{fBillingDays}</if>
            <if test="fBillingQty != null ">and f_billing_qty = #{fBillingQty}</if>
            <if test="fBilltype != null  and fBilltype != ''">and f_billtype = #{fBilltype}</if>
            <if test="fBillingway != null ">and f_billingway = #{fBillingway}</if>
            <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
            <if test="fOriginalbilldate != null ">and f_originalbilldate = #{fOriginalbilldate}</if>
            <if test="fStltypeid != null ">and f_stltypeid = #{fStltypeid}</if>
            <if test="remarks != null  and remarks != ''">and remarks = #{remarks}</if>
        </where>
    </select>

    <insert id="insertFTmsorderbillsfees" parameterType="FTmsorderbillsfees" useGeneratedKeys="true" keyProperty="fId">
        insert into F_TMSORDERBILLSFEES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fId != null">f_id,</if>
            <if test="fPid != null">f_pid,</if>
            <if test="actId != null">act_id,</if>
            <if test="orgId != null">org_id,</if>
            <if test="fLineno != null">f_lineno,</if>
            <if test="fCorpid != null">f_corpid,</if>
            <if test="fFeeid != null">f_feeid,</if>
            <if test="fFeeunitid != null">f_feeUnitid,</if>
            <if test="fQty != null">f_qty,</if>
            <if test="fUnitprice != null">f_unitprice,</if>
            <if test="fAmount != null">f_amount,</if>
            <if test="fCurrency != null">f_currency,</if>
            <if test="fExrate != null">f_exrate,</if>
            <if test="fTaxrate != null">f_taxrate,</if>
            <if test="fDc != null">f_dc,</if>
            <if test="fReviewDate != null">f_review_date,</if>
            <if test="fBillstatus != null">f_billstatus,</if>
            <if test="fStatementNo != null">f_statement_no,</if>
            <if test="fAccamount != null">f_accamount,</if>
            <if test="fAccamountDate != null">f_accamount_date,</if>
            <if test="fStlamountNo != null">f_stlamount_no,</if>
            <if test="fStlamount != null">f_stlamount,</if>
            <if test="fStlamountDate != null">f_stlamount_date,</if>
            <if test="fInvnos != null">f_invnos,</if>
            <if test="fInvamount != null">f_invamount,</if>
            <if test="fAskamount != null">f_askamount,</if>
            <if test="fStatus != null">f_status,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="srcId != null">src_id,</if>
            <if test="srcBillNo != null">src_bill_no,</if>
            <if test="fMblno != null">f_mblno,</if>
            <if test="fProductName != null">f_product_name,</if>
            <if test="fMarks != null">f_marks,</if>
            <if test="fChargedate != null">f_chargedate,</if>
            <if test="fBillingDeadline != null">f_billing_deadline,</if>
            <if test="fInventoryDays != null">f_inventory_days,</if>
            <if test="fAmt != null">f_amt,</if>
            <if test="fBillingDays != null">f_billing_days,</if>
            <if test="fBillingQty != null">f_billing_qty,</if>
            <if test="fBilltype != null">f_billtype,</if>
            <if test="fBillingway != null">f_billingway,</if>
            <if test="fBsdate != null">f_bsdate,</if>
            <if test="fOriginalbilldate != null">f_originalbilldate,</if>
            <if test="fStltypeid != null">f_stltypeid,</if>
            <if test="remarks != null">remarks,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fId != null">#{fId},</if>
            <if test="fPid != null">#{fPid},</if>
            <if test="actId != null">#{actId},</if>
            <if test="orgId != null">#{orgId},</if>
            <if test="fLineno != null">#{fLineno},</if>
            <if test="fCorpid != null">#{fCorpid},</if>
            <if test="fFeeid != null">#{fFeeid},</if>
            <if test="fFeeunitid != null">#{fFeeunitid},</if>
            <if test="fQty != null">#{fQty},</if>
            <if test="fUnitprice != null">#{fUnitprice},</if>
            <if test="fAmount != null">#{fAmount},</if>
            <if test="fCurrency != null">#{fCurrency},</if>
            <if test="fExrate != null">#{fExrate},</if>
            <if test="fTaxrate != null">#{fTaxrate},</if>
            <if test="fDc != null">#{fDc},</if>
            <if test="fReviewDate != null">#{fReviewDate},</if>
            <if test="fBillstatus != null">#{fBillstatus},</if>
            <if test="fStatementNo != null">#{fStatementNo},</if>
            <if test="fAccamount != null">#{fAccamount},</if>
            <if test="fAccamountDate != null">#{fAccamountDate},</if>
            <if test="fStlamountNo != null">#{fStlamountNo},</if>
            <if test="fStlamount != null">#{fStlamount},</if>
            <if test="fStlamountDate != null">#{fStlamountDate},</if>
            <if test="fInvnos != null">#{fInvnos},</if>
            <if test="fInvamount != null">#{fInvamount},</if>
            <if test="fAskamount != null">#{fAskamount},</if>
            <if test="fStatus != null">#{fStatus},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="srcId != null">#{srcId},</if>
            <if test="srcBillNo != null">#{srcBillNo},</if>
            <if test="fMblno != null">#{fMblno},</if>
            <if test="fProductName != null">#{fProductName},</if>
            <if test="fMarks != null">#{fMarks},</if>
            <if test="fChargedate != null">#{fChargedate},</if>
            <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
            <if test="fInventoryDays != null">#{fInventoryDays},</if>
            <if test="fAmt != null">#{fAmt},</if>
            <if test="fBillingDays != null">#{fBillingDays},</if>
            <if test="fBillingQty != null">#{fBillingQty},</if>
            <if test="fBilltype != null">#{fBilltype},</if>
            <if test="fBillingway != null">#{fBillingway},</if>
            <if test="fBsdate != null">#{fBsdate},</if>
            <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
            <if test="fStltypeid != null">#{fStltypeid},</if>
            <if test="remarks != null">#{remarks},</if>
        </trim>
    </insert>

    <insert id="insertFTmsorderbillsfeesTemporaryStorage" parameterType="FTmsorderbillsfees" useGeneratedKeys="true" keyProperty="fId">
        insert into F_TMSORDERBILLSFEES_MODIFY
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fId != null">f_id,</if>
            <if test="fPid != null">f_pid,</if>
            <if test="srcMId != null">src_m_id,</if>
            <if test="actId != null">act_id,</if>
            <if test="orgId != null">org_id,</if>
            <if test="fLineno != null">f_lineno,</if>
            <if test="fCorpid != null">f_corpid,</if>
            <if test="fFeeid != null">f_feeid,</if>
            <if test="fFeeunitid != null">f_feeUnitid,</if>
            <if test="fQty != null">f_qty,</if>
            <if test="fUnitprice != null">f_unitprice,</if>
            <if test="fAmount != null">f_amount,</if>
            <if test="fCurrency != null">f_currency,</if>
            <if test="fExrate != null">f_exrate,</if>
            <if test="fTaxrate != null">f_taxrate,</if>
            <if test="fDc != null">f_dc,</if>
            <if test="fReviewDate != null">f_review_date,</if>
            <if test="fBillstatus != null">f_billstatus,</if>
            <if test="fStatementNo != null">f_statement_no,</if>
            <if test="fAccamount != null">f_accamount,</if>
            <if test="fAccamountDate != null">f_accamount_date,</if>
            <if test="fStlamountNo != null">f_stlamount_no,</if>
            <if test="fStlamount != null">f_stlamount,</if>
            <if test="fStlamountDate != null">f_stlamount_date,</if>
            <if test="fInvnos != null">f_invnos,</if>
            <if test="fInvamount != null">f_invamount,</if>
            <if test="fAskamount != null">f_askamount,</if>
            <if test="fStatus != null">f_status,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="srcId != null">src_id,</if>
            <if test="srcBillNo != null">src_bill_no,</if>
            <if test="fMblno != null">f_mblno,</if>
            <if test="fProductName != null">f_product_name,</if>
            <if test="fMarks != null">f_marks,</if>
            <if test="fChargedate != null">f_chargedate,</if>
            <if test="fBillingDeadline != null">f_billing_deadline,</if>
            <if test="fInventoryDays != null">f_inventory_days,</if>
            <if test="fAmt != null">f_amt,</if>
            <if test="fBillingDays != null">f_billing_days,</if>
            <if test="fBillingQty != null">f_billing_qty,</if>
            <if test="fBilltype != null">f_billtype,</if>
            <if test="fBillingway != null">f_billingway,</if>
            <if test="fBsdate != null">f_bsdate,</if>
            <if test="fOriginalbilldate != null">f_originalbilldate,</if>
            <if test="fStltypeid != null">f_stltypeid,</if>
            <if test="remarks != null">remarks,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fId != null">#{fId},</if>
            <if test="fPid != null">#{fPid},</if>
            <if test="srcMId != null">#{srcMId},</if>
            <if test="actId != null">#{actId},</if>
            <if test="orgId != null">#{orgId},</if>
            <if test="fLineno != null">#{fLineno},</if>
            <if test="fCorpid != null">#{fCorpid},</if>
            <if test="fFeeid != null">#{fFeeid},</if>
            <if test="fFeeunitid != null">#{fFeeunitid},</if>
            <if test="fQty != null">#{fQty},</if>
            <if test="fUnitprice != null">#{fUnitprice},</if>
            <if test="fAmount != null">#{fAmount},</if>
            <if test="fCurrency != null">#{fCurrency},</if>
            <if test="fExrate != null">#{fExrate},</if>
            <if test="fTaxrate != null">#{fTaxrate},</if>
            <if test="fDc != null">#{fDc},</if>
            <if test="fReviewDate != null">#{fReviewDate},</if>
            <if test="fBillstatus != null">#{fBillstatus},</if>
            <if test="fStatementNo != null">#{fStatementNo},</if>
            <if test="fAccamount != null">#{fAccamount},</if>
            <if test="fAccamountDate != null">#{fAccamountDate},</if>
            <if test="fStlamountNo != null">#{fStlamountNo},</if>
            <if test="fStlamount != null">#{fStlamount},</if>
            <if test="fStlamountDate != null">#{fStlamountDate},</if>
            <if test="fInvnos != null">#{fInvnos},</if>
            <if test="fInvamount != null">#{fInvamount},</if>
            <if test="fAskamount != null">#{fAskamount},</if>
            <if test="fStatus != null">#{fStatus},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="srcId != null">#{srcId},</if>
            <if test="srcBillNo != null">#{srcBillNo},</if>
            <if test="fMblno != null">#{fMblno},</if>
            <if test="fProductName != null">#{fProductName},</if>
            <if test="fMarks != null">#{fMarks},</if>
            <if test="fChargedate != null">#{fChargedate},</if>
            <if test="fBillingDeadline != null">#{fBillingDeadline},</if>
            <if test="fInventoryDays != null">#{fInventoryDays},</if>
            <if test="fAmt != null">#{fAmt},</if>
            <if test="fBillingDays != null">#{fBillingDays},</if>
            <if test="fBillingQty != null">#{fBillingQty},</if>
            <if test="fBilltype != null">#{fBilltype},</if>
            <if test="fBillingway != null">#{fBillingway},</if>
            <if test="fBsdate != null">#{fBsdate},</if>
            <if test="fOriginalbilldate != null">#{fOriginalbilldate},</if>
            <if test="fStltypeid != null">#{fStltypeid},</if>
            <if test="remarks != null">#{remarks},</if>
        </trim>
    </insert>


    <update id="updateFTmsorderbillsfees" parameterType="FTmsorderbillsfees">
        update F_TMSORDERBILLSFEES
        <trim prefix="SET" suffixOverrides=",">
            <if test="fPid != null">f_pid = #{fPid},</if>
            <if test="actId != null">act_id = #{actId},</if>
            <if test="srcMId != null">src_m_id = #{srcMId},</if>
            <if test="orgId != null">org_id = #{orgId},</if>
            <if test="fLineno != null">f_lineno = #{fLineno},</if>
            <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
            <if test="fFeeid != null">f_feeid = #{fFeeid},</if>
            <if test="fFeeunitid != null">f_feeUnitid = #{fFeeunitid},</if>
            <if test="fQty != null">f_qty = #{fQty},</if>
            <if test="fUnitprice != null">f_unitprice = #{fUnitprice},</if>
            <if test="fAmount != null">f_amount = #{fAmount},</if>
            <if test="fCurrency != null">f_currency = #{fCurrency},</if>
            <if test="fExrate != null">f_exrate = #{fExrate},</if>
            <if test="fTaxrate != null">f_taxrate = #{fTaxrate},</if>
            <if test="fDc != null">f_dc = #{fDc},</if>
            <if test="fReviewDate != null">f_review_date = #{fReviewDate},</if>
            <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
            <if test="fStatementNo != null">f_statement_no = #{fStatementNo},</if>
            <if test="fAccamount != null">f_accamount = #{fAccamount},</if>
            <if test="fAccamountDate != null">f_accamount_date = #{fAccamountDate},</if>
            <if test="fStlamountNo != null">f_stlamount_no = #{fStlamountNo},</if>
            <if test="fStlamount != null">f_stlamount = #{fStlamount},</if>
            <if test="fStlamountDate != null">f_stlamount_date = #{fStlamountDate},</if>
            <if test="fInvnos != null">f_invnos = #{fInvnos},</if>
            <if test="fInvamount != null">f_invamount = #{fInvamount},</if>
            <if test="fAskamount != null">f_askamount = #{fAskamount},</if>
            <if test="fStatus != null">f_status = #{fStatus},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="srcId != null">src_id = #{srcId},</if>
            <if test="srcBillNo != null">src_bill_no = #{srcBillNo},</if>
            <if test="fMblno != null">f_mblno = #{fMblno},</if>
            <if test="fProductName != null">f_product_name = #{fProductName},</if>
            <if test="fMarks != null">f_marks = #{fMarks},</if>
            <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
            <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
            <if test="fInventoryDays != null">f_inventory_days = #{fInventoryDays},</if>
            <if test="fAmt != null">f_amt = #{fAmt},</if>
            <if test="fBillingDays != null">f_billing_days = #{fBillingDays},</if>
            <if test="fBillingQty != null">f_billing_qty = #{fBillingQty},</if>
            <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
            <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
            <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
            <if test="fOriginalbilldate != null">f_originalbilldate = #{fOriginalbilldate},</if>
            <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
        </trim>
        where f_id = #{fId}
    </update>

    <update id="updateFTmsorderbillsfeesModify" parameterType="FTmsorderbillsfees">
        update F_TMSORDERBILLSFEES_MODIFY
        <trim prefix="SET" suffixOverrides=",">
            <if test="fPid != null">f_pid = #{fPid},</if>
            <if test="actId != null">act_id = #{actId},</if>
            <if test="srcMId != null">src_m_id = #{srcMId},</if>
            <if test="orgId != null">org_id = #{orgId},</if>
            <if test="fLineno != null">f_lineno = #{fLineno},</if>
            <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
            <if test="fFeeid != null">f_feeid = #{fFeeid},</if>
            <if test="fFeeunitid != null">f_feeUnitid = #{fFeeunitid},</if>
            <if test="fQty != null">f_qty = #{fQty},</if>
            <if test="fUnitprice != null">f_unitprice = #{fUnitprice},</if>
            <if test="fAmount != null">f_amount = #{fAmount},</if>
            <if test="fCurrency != null">f_currency = #{fCurrency},</if>
            <if test="fExrate != null">f_exrate = #{fExrate},</if>
            <if test="fTaxrate != null">f_taxrate = #{fTaxrate},</if>
            <if test="fDc != null">f_dc = #{fDc},</if>
            <if test="fReviewDate != null">f_review_date = #{fReviewDate},</if>
            <if test="fBillstatus != null">f_billstatus = #{fBillstatus},</if>
            <if test="fStatementNo != null">f_statement_no = #{fStatementNo},</if>
            <if test="fAccamount != null">f_accamount = #{fAccamount},</if>
            <if test="fAccamountDate != null">f_accamount_date = #{fAccamountDate},</if>
            <if test="fStlamountNo != null">f_stlamount_no = #{fStlamountNo},</if>
            <if test="fStlamount != null">f_stlamount = #{fStlamount},</if>
            <if test="fStlamountDate != null">f_stlamount_date = #{fStlamountDate},</if>
            <if test="fInvnos != null">f_invnos = #{fInvnos},</if>
            <if test="fInvamount != null">f_invamount = #{fInvamount},</if>
            <if test="fAskamount != null">f_askamount = #{fAskamount},</if>
            <if test="fStatus != null">f_status = #{fStatus},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="srcId != null">src_id = #{srcId},</if>
            <if test="srcBillNo != null">src_bill_no = #{srcBillNo},</if>
            <if test="fMblno != null">f_mblno = #{fMblno},</if>
            <if test="fProductName != null">f_product_name = #{fProductName},</if>
            <if test="fMarks != null">f_marks = #{fMarks},</if>
            <if test="fChargedate != null">f_chargedate = #{fChargedate},</if>
            <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
            <if test="fInventoryDays != null">f_inventory_days = #{fInventoryDays},</if>
            <if test="fAmt != null">f_amt = #{fAmt},</if>
            <if test="fBillingDays != null">f_billing_days = #{fBillingDays},</if>
            <if test="fBillingQty != null">f_billing_qty = #{fBillingQty},</if>
            <if test="fBilltype != null">f_billtype = #{fBilltype},</if>
            <if test="fBillingway != null">f_billingway = #{fBillingway},</if>
            <if test="fBsdate != null">f_bsdate = #{fBsdate},</if>
            <if test="fOriginalbilldate != null">f_originalbilldate = #{fOriginalbilldate},</if>
            <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
        </trim>
        where f_id = #{fId}
    </update>

    <delete id="deleteFTmsorderbillsfees" parameterType="FTmsorderbillsfees">
        delete from F_TMSORDERBILLSFEES
        <where>
            <if test="fId != null ">and f_id = #{fId}</if>
            <if test="fPid != null ">and f_pid = #{fPid}</if>
            <if test="actId != null ">and act_id = #{actId}</if>
            <if test="orgId != null ">and org_id = #{orgId}</if>
        </where>
    </delete>

    <delete id="deleteFTmsorderbillsfeesById" parameterType="Long">
        delete from F_TMSORDERBILLSFEES where f_id = #{fId}
    </delete>

    <delete id="deleteFTmsorderbillsfeesModifyById" parameterType="Long">
        delete from F_TMSORDERBILLSFEES_MODIFY where f_id = #{fId}
    </delete>

    <delete id="deleteFTmsorderbillsfeesByPId" parameterType="Long">
        delete from F_TMSORDERBILLSFEES where f_pid = #{fId}
    </delete>

    <delete id="deleteFTmsorderbillsfeesByIds" parameterType="String">
        delete from F_TMSORDERBILLSFEES where f_id in
        <foreach item="fId" collection="array" open="(" separator="," close=")">
            #{fId}
        </foreach>
    </delete>

    <update id="updateFTmsorderbillsfee" parameterType="Map">
        update F_TMSORDERBILLSFEES
        <trim prefix="SET" suffixOverrides=",">
            /*判断确认对账*/
            <if test="map.billType == 'DZ'">
                f_statement_no = #{map.tFee.fBillno},
                f_accamount = f_accamount + #{map.tFeeDo.fAmt},
                f_accamount_date =  #{map.tFee.fAccbilldate}
            </if>
            /*判断撤销对账*/
            <if test="map.billType == 'DZRevoke'">
                f_statement_no =  #{map.tFee.fBillno},
                f_accamount = f_accamount - #{map.tFeeDo.fAmt},
                f_accamount_date = #{map.tFee.fAccbilldate}
            </if>
            /*判断收付款*/
            <if test="map.billType == 'DC'">
                f_stlamount_no = #{map.tFee.fBillno},
                f_stlamount = f_stlamount +  #{map.tFeeDo.fAmt},
                f_stlamount_date =#{map.tFee.fAccbilldate}
            </if>
            /*判断撤销收付款*/
            <if test="map.billType == 'DCRevoke'">
                f_stlamount_no = #{map.tFee.fBillno},
                f_stlamount = f_stlamount -  #{map.tFeeDo.fAmt},
                f_stlamount_date =#{map.tFee.fAccbilldate}
            </if>
        </trim>
        where f_id = #{map.tFeeDo.fSrcid}
    </update>
</mapper>