<?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.warehouseBusiness.mapper.TWarehousebillsfeesLoggerMapper">
    
    <resultMap type="TWarehousebillsfeesLogger" id="TWarehousebillsfeesLoggerResult">
        <result property="fId"    column="f_id"    />
        <result property="fPid"    column="f_pid"    />
        <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="fBusinessType"    column="f_business_type"    />
        <result property="fSrcTypeId"    column="f_src_type_id"    />
    </resultMap>

    <sql id="selectTWarehousebillsfeesLoggerVo">
        select f_id, f_pid, 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, f_business_type, f_src_type_id from t_warehousebillsfees_logger
    </sql>

    <select id="selectTWarehousebillsfeesLoggerList" parameterType="TWarehousebillsfeesLogger" resultMap="TWarehousebillsfeesLoggerResult">
        <include refid="selectTWarehousebillsfeesLoggerVo"/>
        <where>  
            <if test="fPid != null "> and f_pid = #{fPid}</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="fBusinessType != null  and fBusinessType != ''"> and f_business_type = #{fBusinessType}</if>
            <if test="fSrcTypeId != null "> and f_src_type_id = #{fSrcTypeId}</if>
        </where>
    </select>
    
    <select id="selectTWarehousebillsfeesLoggerById" parameterType="Long" resultMap="TWarehousebillsfeesLoggerResult">
        <include refid="selectTWarehousebillsfeesLoggerVo"/>
        where f_id = #{fId}
    </select>
        
    <insert id="insertTWarehousebillsfeesLogger" parameterType="TWarehousebillsfeesLogger" useGeneratedKeys="true" keyProperty="fId">
        insert into t_warehousebillsfees_logger
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fPid != null">f_pid,</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="fBusinessType != null">f_business_type,</if>
            <if test="fSrcTypeId != null">f_src_type_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fPid != null">#{fPid},</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="fBusinessType != null">#{fBusinessType},</if>
            <if test="fSrcTypeId != null">#{fSrcTypeId},</if>
         </trim>
    </insert>

    <update id="updateTWarehousebillsfeesLogger" parameterType="TWarehousebillsfeesLogger">
        update t_warehousebillsfees_logger
        <trim prefix="SET" suffixOverrides=",">
            <if test="fPid != null">f_pid = #{fPid},</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="fBusinessType != null">f_business_type = #{fBusinessType},</if>
            <if test="fSrcTypeId != null">f_src_type_id = #{fSrcTypeId},</if>
        </trim>
        where f_id = #{fId}
    </update>

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

    <delete id="deleteTWarehousebillsfeesLoggerByIds" parameterType="String">
        delete from t_warehousebillsfees_logger where f_id in 
        <foreach item="fId" collection="array" open="(" separator="," close=")">
            #{fId}
        </foreach>
    </delete>
    <insert id="copyTWarehousebillsfees" parameterType="Long">
        INSERT INTO t_warehousebillsfees_logger
        SELECT
            tf.f_id,
            tf.f_pid,
            tf.f_lineno,
            tf.f_corpid,
            tf.f_feeid,
            tf.f_feeUnitid,
            tf.f_qty,
            tf.f_unitprice,
            tf.f_amount,
            tf.f_currency,
            tf.f_exrate,
            tf.f_taxrate,
            tf.f_dc,
            tf.f_review_date,
            tf.f_billstatus,
            tf.f_statement_no,
            tf.f_accamount,
            tf.f_accamount_date,
            tf.f_stlamount_no,
            tf.f_stlamount,
            tf.f_stlamount_date,
            tf.f_invnos,
            tf.f_invamount,
            tf.f_askamount,
            tf.f_status,
            tf.del_flag,
            tf.create_by,
            tf.create_time,
            tf.update_by,
            tf.update_time,
            tf.remark,
            tf.src_id,
            tf.src_bill_no,
            tf.f_mblno,
            tf.f_product_name,
            tf.f_marks,
            tf.f_chargedate,
            tf.f_billing_deadline,
            tf.f_inventory_days,
            tf.f_amt,
            tf.f_billing_days,
            tf.f_billing_qty,
            tf.f_billtype,
            tf.f_billingway,
            tf.f_bsdate,
            tf.f_originalbilldate,
            tf.f_stltypeid,
            tf.f_business_type,
            tf.f_src_type_id
        FROM
            t_warehousebillsfees tf
        WHERE tf.f_pid = #{fId}
    </insert>
</mapper>