<?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.FtmsorderbillscarsMapper">

    <resultMap type="ftmsorderbillscars" id="ftmsorderbillscarsResult">
        <result property="id"    column="id"    />
        <result property="pId"    column="p_id"    />
        <result property="srcMId"    column="src_m_id"    />
        <result property="orgId"    column="org_id"    />
        <result property="orderNo"    column="order_no"    />
        <result property="cntrId"    column="cntr_id"    />
        <result property="cntrNo"    column="cntr_no"    />
        <result property="carcorPid"    column="carcor_pid"    />
        <result property="carregNo"    column="carreg_no"    />
        <result property="mblno"    column="mblno"    />
        <result property="driverName"    column="driver_name"    />
        <result property="driverTel"    column="driver_tel"    />
        <result property="driverUserId"    column="driver_user_id"    />
        <result property="planDate"    column="plan_date"    />
        <result property="planRemarks"    column="plan_remarks"    />
        <result property="acceptDate"    column="accept_date"    />
        <result property="acceptRemarks"    column="accept_remarks"    />
        <result property="loadDate"    column="load_date"    />
        <result property="loadRemarks"    column="load_remarks"    />
        <result property="mdLoadDate"    column="md_load_date"    />
        <result property="offData"    column="off_data"    />
        <result property="offRemarks"    column="off_remarks"    />
        <result property="mdLoadRemarks"    column="md_load_remarks"    />
        <result property="unLoadDate"    column="un_load_date"    />
        <result property="unLoadRemarks"    column="un_load_remarks"    />
        <result property="waybillDate"    column="waybill_date"    />
        <result property="qtyLoad"    column="qty_load"    />
        <result property="cntrQty"    column="cntr_qty"    />
        <result property="qtyUnLoad"    column="qty_un_load"    />
        <result property="cntrWeight"    column="cntr_weight"    />
        <result property="gopodsLossQty"    column="gopods_loss_qty"    />
        <result property="gopodsLossrate"    column="gopods_lossrate"    />
        <result property="gopodsLossamtCr"    column="gopods_lossamt_cr"    />
        <result property="qtyDr"    column="qty_dr"    />
        <result property="waybillRemarks"    column="waybill_remarks"    />
        <result property="gopodsLossamtDr"    column="gopods_lossamt_dr"    />
        <result property="qtyCr"    column="qty_cr"    />
        <result property="freightPriceDr"    column="freight_price_dr"    />
        <result property="freightPriceCr"    column="freight_price_cr"    />
        <result property="freightAmtDr"    column="freight_amt_dr"    />
        <result property="freightAmtCr"    column="freight_amt_cr"    />
        <result property="feeitemDr"    column="feeitem_dr"    />
        <result property="feeitemDrRemarks"    column="feeitem_dr_remarks"    />
        <result property="feeitemCr"    column="feeitem_cr"    />
        <result property="feeitemCrRemarks"    column="feeitem_cr_remarks"    />
        <result property="amtDr"    column="amt_dr"    />
        <result property="amtCr"    column="amt_cr"    />
        <result property="dueDateDr"    column="due_date_dr"    />
        <result property="dueDateCr"    column="due_date_cr"    />
        <result property="odometerFrom"    column="odometer_from"    />
        <result property="odometerEnd"    column="odometer_end"    />
        <result property="milesEmpty"    column="miles_empty"    />
        <result property="milesLoad"    column="miles_load"    />
        <result property="miles"    column="miles"    />
        <result property="driverbonus"    column="driverbonus"    />
        <result property="costtoll"    column="costtoll"    />
        <result property="costmaintain"    column="costmaintain"    />
        <result property="costOth"    column="cost_oth"    />
        <result property="costRemarks"    column="cost_remarks"    />
        <result property="oilQtyper"    column="oil_qtyper"    />
        <result property="oilQty1"    column="oil_qty1"    />
        <result property="oilPrice1"    column="oil_price1"    />
        <result property="oilAmt1"    column="oil_amt1"    />
        <result property="oilQty2"    column="oil_qty2"    />
        <result property="oilPrice2"    column="oil_price2"    />
        <result property="oilAmt2"    column="oil_amt2"    />
        <result property="oilQty"    column="oil_qty"    />
        <result property="oilPrice"    column="oil_price"    />
        <result property="oilAmt"    column="oil_amt"    />
        <result property="oilQtyBlc"    column="oil_qty_blc"    />
        <result property="oilAmtBlc"    column="oil_amt_blc"    />
        <result property="profit"    column="profit"    />
        <result property="invDrNeed"    column="inv_dr_need"    />
        <result property="invDrStatus"    column="inv_dr_status"    />
        <result property="invDrTaxrate"    column="inv_dr_taxrate"    />
        <result property="invDrTaxamt"    column="inv_dr_taxamt"    />
        <result property="invDrDate"    column="inv_dr_date"    />
        <result property="invDrNo"    column="inv_dr_no"    />
        <result property="accchkStaus"    column="accchk_staus"    />
        <result property="billStatus"    column="bill_status"    />
        <result property="orderStatus"    column="order_status"    />
        <result property="costomAmt01"    column="costom_amt_01"    />
        <result property="costomAmt02"    column="costom_amt_02"    />
        <result property="stlAmtDr"    column="stl_amt_dr"    />
        <result property="costomAmt03"    column="costom_amt_03"    />
        <result property="stlDateDr"    column="stl_date_dr"    />
        <result property="costomAmt04"    column="costom_amt_04"    />
        <result property="stlAmtCr"    column="stl_amt_cr"    />
        <result property="costomAmt05"    column="costom_amt_05"    />
        <result property="stlDateCr"    column="stl_date_cr"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="costomAmt06"    column="costom_amt_06"    />
        <result property="costomStr01"    column="costom_str_01"    />
        <result property="createBy"    column="create_by"    />
        <result property="costomStr02"    column="costom_str_02"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remarks"    column="remarks"    />
        <result property="accchkDateCr"    column="accchk_date_cr"    />
        <result property="mBillNo"    column="m_bill_no"    />
        <result property="billKind"    column="bill_kind"    />
        <result property="profitBill"    column="profit_bill"    />
        <result property="profitCar"    column="profit_car"    />
        <result property="corpId"    column="corp_id"    />
        <result property="invAmtCr"    column="inv_amt_cr"    />
        <result property="invAmtDr"    column="inv_amt_dr"    />
        <result property="invDateCr"    column="inv_date_cr"    />
        <result property="invDateDr"    column="inv_date_dr"    />
        <result property="accchkAmtCr"    column="accchk_amt_cr"    />
        <result property="accchkAmtDr"    column="accchk_amt_dr"    />
        <result property="accchkDateDr"    column="accchk_date_dr"    />
    </resultMap>

    <sql id="selectftmsorderbillscarsVo">
        select id, p_id, org_id, order_no, cntr_id, corp_id, cntr_no, carcor_pid, mblno, carreg_no, driver_name, driver_user_id,
         driver_tel, plan_date, plan_remarks, accept_date, accept_remarks, load_date, load_remarks, md_load_date, off_data,
          off_remarks, md_load_remarks, un_load_date, un_load_remarks, waybill_date, qty_load, qty_un_load, cntr_qty,
           gopods_loss_qty, cntr_weight, gopods_lossrate, waybill_remarks, gopods_lossamt_cr, qty_dr, gopods_lossamt_dr,
            qty_cr, freight_price_dr, freight_price_cr, freight_amt_dr, freight_amt_cr, feeitem_dr, feeitem_dr_remarks,
             feeitem_cr, feeitem_cr_remarks, amt_dr, amt_cr, due_date_dr, due_date_cr, odometer_from, odometer_end, miles_empty,
              miles_load, miles, driverbonus, costtoll, costmaintain, cost_oth, cost_remarks, oil_qtyper, oil_qty1, oil_price1,
               oil_amt1, oil_qty2, oil_price2, oil_amt2, oil_qty, oil_price, oil_amt, oil_qty_blc, oil_amt_blc, profit, inv_dr_need,
                inv_dr_status, inv_dr_taxrate, inv_dr_taxamt, inv_dr_date, inv_dr_no, accchk_staus, bill_status, order_status, accchk_date_cr,
                 costom_amt_01, stl_amt_dr, costom_amt_02, stl_date_dr, costom_amt_03, stl_amt_cr, costom_amt_04, stl_date_cr,
                  costom_amt_05, costom_amt_06, del_flag, costom_str_01, create_by, create_time, costom_str_02, update_by, update_time,
                  m_bill_no, bill_kind, remarks, profit_bill, profit_car, inv_amt_cr, inv_amt_dr, inv_date_cr, inv_date_dr, accchk_amt_cr, accchk_amt_dr,
                   accchk_date_dr from F_TMSORDERBILLSCARS
    </sql>

    <sql id="selectftmsorderbillscarsTemporaryStorageVo">
        select id, p_id, org_id, order_no, cntr_id, corp_id, cntr_no, carcor_pid, mblno, carreg_no, driver_name, driver_user_id,
               driver_tel, plan_date, plan_remarks, accept_date, accept_remarks, load_date, load_remarks, md_load_date, off_data,
               off_remarks, md_load_remarks, un_load_date, un_load_remarks, waybill_date, qty_load, qty_un_load, cntr_qty,
               gopods_loss_qty, cntr_weight, gopods_lossrate, waybill_remarks, gopods_lossamt_cr, qty_dr, gopods_lossamt_dr,
               qty_cr, freight_price_dr, freight_price_cr, freight_amt_dr, freight_amt_cr, feeitem_dr, feeitem_dr_remarks,
               feeitem_cr, feeitem_cr_remarks, amt_dr, amt_cr, due_date_dr, due_date_cr, odometer_from, odometer_end, miles_empty,
               miles_load, miles, driverbonus, costtoll, costmaintain, cost_oth, cost_remarks, oil_qtyper, oil_qty1, oil_price1,
               oil_amt1, oil_qty2, oil_price2, oil_amt2, oil_qty, oil_price, oil_amt, oil_qty_blc, oil_amt_blc, profit, inv_dr_need,
               inv_dr_status, inv_dr_taxrate, inv_dr_taxamt, inv_dr_date, inv_dr_no, accchk_staus, bill_status, order_status, accchk_date_cr,
               costom_amt_01, stl_amt_dr, costom_amt_02, stl_date_dr, costom_amt_03, stl_amt_cr, costom_amt_04, stl_date_cr,
               costom_amt_05, costom_amt_06, del_flag, costom_str_01, create_by, create_time, costom_str_02, update_by, update_time,
               m_bill_no, bill_kind, remarks, profit_bill, profit_car, inv_amt_cr, inv_amt_dr, inv_date_cr, inv_date_dr, accchk_amt_cr, accchk_amt_dr,
               accchk_date_dr from F_TMSORDERBILLSCARS_MODIFY
    </sql>

    <select id="selectftmsorderbillscarsList" parameterType="ftmsorderbillscars" resultMap="ftmsorderbillscarsResult">
        <include refid="selectftmsorderbillscarsVo"/>
        <where>
            <if test="pId != null "> and p_id = #{pId}</if>
            <if test="orgId != null "> and org_id = #{orgId}</if>
            <if test="orderNo != null  and orderNo != ''"> and order_no = #{orderNo}</if>
            <if test="cntrId != null "> and cntr_id = #{cntrId}</if>
            <if test="corpId != null "> and corp_id = #{corpId}</if>
            <if test="cntrNo != null  and cntrNo != ''"> and cntr_no = #{cntrNo}</if>
            <if test="carcorPid != null "> and carcor_pid = #{carcorPid}</if>
            <if test="mblno != null  and mblno != ''"> and mblno = #{mblno}</if>
            <if test="carregNo != null  and carregNo != ''"> and carreg_no = #{carregNo}</if>
            <if test="driverName != null  and driverName != ''"> and driver_name like concat('%', #{driverName}, '%')</if>
            <if test="driverUserId != null "> and driver_user_id = #{driverUserId}</if>
            <if test="driverTel != null  and driverTel != ''"> and driver_tel = #{driverTel}</if>
            <if test="planDate != null "> and plan_date = #{planDate}</if>
            <if test="planRemarks != null  and planRemarks != ''"> and plan_remarks = #{planRemarks}</if>
            <if test="acceptDate != null "> and accept_date = #{acceptDate}</if>
            <if test="acceptRemarks != null  and acceptRemarks != ''"> and accept_remarks = #{acceptRemarks}</if>
            <if test="loadDate != null "> and load_date = #{loadDate}</if>
            <if test="loadRemarks != null  and loadRemarks != ''"> and load_remarks = #{loadRemarks}</if>
            <if test="mdLoadDate != null "> and md_load_date = #{mdLoadDate}</if>
            <if test="offData != null "> and off_data = #{offData}</if>
            <if test="offRemarks != null  and offRemarks != ''"> and off_remarks = #{offRemarks}</if>
            <if test="mdLoadRemarks != null  and mdLoadRemarks != ''"> and md_load_remarks = #{mdLoadRemarks}</if>
            <if test="unLoadDate != null "> and un_load_date = #{unLoadDate}</if>
            <if test="unLoadRemarks != null  and unLoadRemarks != ''"> and un_load_remarks = #{unLoadRemarks}</if>
            <if test="waybillDate != null "> and waybill_date = #{waybillDate}</if>
            <if test="qtyLoad != null "> and qty_load = #{qtyLoad}</if>
            <if test="mBillNo != null "> and m_bill_no = #{mBillNo}</if>
            <if test="billKind != null "> and bill_kind = #{billKind}</if>
            <if test="qtyUnLoad != null "> and qty_un_load = #{qtyUnLoad}</if>
            <if test="cntrQty != null "> and cntr_qty = #{cntrQty}</if>
            <if test="gopodsLossQty != null "> and gopods_loss_qty = #{gopodsLossQty}</if>
            <if test="cntrWeight != null "> and cntr_weight = #{cntrWeight}</if>
            <if test="gopodsLossrate != null "> and gopods_lossrate = #{gopodsLossrate}</if>
            <if test="waybillRemarks != null  and waybillRemarks != ''"> and waybill_remarks = #{waybillRemarks}</if>
            <if test="gopodsLossamtCr != null "> and gopods_lossamt_cr = #{gopodsLossamtCr}</if>
            <if test="qtyDr != null "> and qty_dr = #{qtyDr}</if>
            <if test="gopodsLossamtDr != null "> and gopods_lossamt_dr = #{gopodsLossamtDr}</if>
            <if test="qtyCr != null "> and qty_cr = #{qtyCr}</if>
            <if test="freightPriceDr != null "> and freight_price_dr = #{freightPriceDr}</if>
            <if test="freightPriceCr != null "> and freight_price_cr = #{freightPriceCr}</if>
            <if test="freightAmtDr != null "> and freight_amt_dr = #{freightAmtDr}</if>
            <if test="freightAmtCr != null "> and freight_amt_cr = #{freightAmtCr}</if>
            <if test="feeitemDr != null "> and feeitem_dr = #{feeitemDr}</if>
            <if test="feeitemDrRemarks != null  and feeitemDrRemarks != ''"> and feeitem_dr_remarks = #{feeitemDrRemarks}</if>
            <if test="feeitemCr != null "> and feeitem_cr = #{feeitemCr}</if>
            <if test="feeitemCrRemarks != null  and feeitemCrRemarks != ''"> and feeitem_cr_remarks = #{feeitemCrRemarks}</if>
            <if test="amtDr != null "> and amt_dr = #{amtDr}</if>
            <if test="amtCr != null "> and amt_cr = #{amtCr}</if>
            <if test="dueDateDr != null "> and due_date_dr = #{dueDateDr}</if>
            <if test="dueDateCr != null "> and due_date_cr = #{dueDateCr}</if>
            <if test="odometerFrom != null "> and odometer_from = #{odometerFrom}</if>
            <if test="odometerEnd != null "> and odometer_end = #{odometerEnd}</if>
            <if test="milesEmpty != null "> and miles_empty = #{milesEmpty}</if>
            <if test="milesLoad != null "> and miles_load = #{milesLoad}</if>
            <if test="miles != null "> and miles = #{miles}</if>
            <if test="driverbonus != null "> and driverbonus = #{driverbonus}</if>
            <if test="costtoll != null "> and costtoll = #{costtoll}</if>
            <if test="costmaintain != null "> and costmaintain = #{costmaintain}</if>
            <if test="costOth != null "> and cost_oth = #{costOth}</if>
            <if test="costRemarks != null  and costRemarks != ''"> and cost_remarks = #{costRemarks}</if>
            <if test="oilQtyper != null "> and oil_qtyper = #{oilQtyper}</if>
            <if test="oilQty1 != null "> and oil_qty1 = #{oilQty1}</if>
            <if test="oilPrice1 != null "> and oil_price1 = #{oilPrice1}</if>
            <if test="oilAmt1 != null "> and oil_amt1 = #{oilAmt1}</if>
            <if test="oilQty2 != null "> and oil_qty2 = #{oilQty2}</if>
            <if test="oilPrice2 != null "> and oil_price2 = #{oilPrice2}</if>
            <if test="oilAmt2 != null "> and oil_amt2 = #{oilAmt2}</if>
            <if test="oilQty != null "> and oil_qty = #{oilQty}</if>
            <if test="oilPrice != null "> and oil_price = #{oilPrice}</if>
            <if test="oilAmt != null "> and oil_amt = #{oilAmt}</if>
            <if test="oilQtyBlc != null "> and oil_qty_blc = #{oilQtyBlc}</if>
            <if test="oilAmtBlc != null "> and oil_amt_blc = #{oilAmtBlc}</if>
            <if test="profit != null "> and profit = #{profit}</if>
            <if test="invDrNeed != null  and invDrNeed != ''"> and inv_dr_need = #{invDrNeed}</if>
            <if test="invDrStatus != null  and invDrStatus != ''"> and inv_dr_status = #{invDrStatus}</if>
            <if test="invDrTaxrate != null "> and inv_dr_taxrate = #{invDrTaxrate}</if>
            <if test="invDrTaxamt != null "> and inv_dr_taxamt = #{invDrTaxamt}</if>
            <if test="invDrDate != null "> and inv_dr_date = #{invDrDate}</if>
            <if test="invDrNo != null  and invDrNo != ''"> and inv_dr_no = #{invDrNo}</if>
            <if test="accchkStaus != null  and accchkStaus != ''"> and accchk_staus = #{accchkStaus}</if>
            <if test="billStatus != null "> and bill_status = #{billStatus}</if>
            <if test="orderStatus != null "> and order_status = #{orderStatus}</if>
            <if test="accchkDateCr != null "> and accchk_date_cr = #{accchkDateCr}</if>
            <if test="costomAmt01 != null "> and costom_amt_01 = #{costomAmt01}</if>
            <if test="stlAmtDr != null "> and stl_amt_dr = #{stlAmtDr}</if>
            <if test="costomAmt02 != null "> and costom_amt_02 = #{costomAmt02}</if>
            <if test="stlDateDr != null "> and stl_date_dr = #{stlDateDr}</if>
            <if test="costomAmt03 != null "> and costom_amt_03 = #{costomAmt03}</if>
            <if test="stlAmtCr != null "> and stl_amt_cr = #{stlAmtCr}</if>
            <if test="costomAmt04 != null "> and costom_amt_04 = #{costomAmt04}</if>
            <if test="stlDateCr != null "> and stl_date_cr = #{stlDateCr}</if>
            <if test="costomAmt05 != null "> and costom_amt_05 = #{costomAmt05}</if>
            <if test="costomAmt06 != null "> and costom_amt_06 = #{costomAmt06}</if>
            <if test="costomStr01 != null  and costomStr01 != ''"> and costom_str_01 = #{costomStr01}</if>
            <if test="costomStr02 != null  and costomStr02 != ''"> and costom_str_02 = #{costomStr02}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
        </where>
    </select>

    <select id="selectftmsorderbillscarsCount" parameterType="ftmsorderbillscars" resultType="int">
        select count(id) from F_TMSORDERBILLSCARS
        <where>
            <if test="pId != null "> and p_id = #{pId}</if>
            <if test="orgId != null "> and org_id = #{orgId}</if>
            <if test="orderNo != null  and orderNo != ''"> and order_no = #{orderNo}</if>
            <if test="cntrId != null "> and cntr_id = #{cntrId}</if>
            <if test="cntrNo != null  and cntrNo != ''"> and cntr_no = #{cntrNo}</if>
            <if test="carcorPid != null "> and carcor_pid = #{carcorPid}</if>
            <if test="mblno != null  and mblno != ''"> and mblno = #{mblno}</if>
            <if test="carregNo != null  and carregNo != ''"> and carreg_no = #{carregNo}</if>
            <if test="driverName != null  and driverName != ''"> and driver_name like concat('%', #{driverName}, '%')</if>
            <if test="driverUserId != null "> and driver_user_id = #{driverUserId}</if>
            <if test="driverTel != null  and driverTel != ''"> and driver_tel = #{driverTel}</if>
            <if test="planDate != null "> and plan_date = #{planDate}</if>
            <if test="planRemarks != null  and planRemarks != ''"> and plan_remarks = #{planRemarks}</if>
            <if test="acceptDate != null "> and accept_date = #{acceptDate}</if>
            <if test="acceptRemarks != null  and acceptRemarks != ''"> and accept_remarks = #{acceptRemarks}</if>
            <if test="loadDate != null "> and load_date = #{loadDate}</if>
            <if test="loadRemarks != null  and loadRemarks != ''"> and load_remarks = #{loadRemarks}</if>
            <if test="mdLoadDate != null "> and md_load_date = #{mdLoadDate}</if>
            <if test="offData != null "> and off_data = #{offData}</if>
            <if test="offRemarks != null  and offRemarks != ''"> and off_remarks = #{offRemarks}</if>
            <if test="mdLoadRemarks != null  and mdLoadRemarks != ''"> and md_load_remarks = #{mdLoadRemarks}</if>
            <if test="unLoadDate != null "> and un_load_date = #{unLoadDate}</if>
            <if test="unLoadRemarks != null  and unLoadRemarks != ''"> and un_load_remarks = #{unLoadRemarks}</if>
            <if test="waybillDate != null "> and waybill_date = #{waybillDate}</if>
            <if test="qtyLoad != null "> and qty_load = #{qtyLoad}</if>
            <if test="qtyUnLoad != null "> and qty_un_load = #{qtyUnLoad}</if>
            <if test="cntrQty != null "> and cntr_qty = #{cntrQty}</if>
            <if test="gopodsLossQty != null "> and gopods_loss_qty = #{gopodsLossQty}</if>
            <if test="cntrWeight != null "> and cntr_weight = #{cntrWeight}</if>
            <if test="gopodsLossrate != null "> and gopods_lossrate = #{gopodsLossrate}</if>
            <if test="waybillRemarks != null  and waybillRemarks != ''"> and waybill_remarks = #{waybillRemarks}</if>
            <if test="gopodsLossamtCr != null "> and gopods_lossamt_cr = #{gopodsLossamtCr}</if>
            <if test="qtyDr != null "> and qty_dr = #{qtyDr}</if>
            <if test="gopodsLossamtDr != null "> and gopods_lossamt_dr = #{gopodsLossamtDr}</if>
            <if test="qtyCr != null "> and qty_cr = #{qtyCr}</if>
            <if test="freightPriceDr != null "> and freight_price_dr = #{freightPriceDr}</if>
            <if test="freightPriceCr != null "> and freight_price_cr = #{freightPriceCr}</if>
            <if test="freightAmtDr != null "> and freight_amt_dr = #{freightAmtDr}</if>
            <if test="freightAmtCr != null "> and freight_amt_cr = #{freightAmtCr}</if>
            <if test="feeitemDr != null "> and feeitem_dr = #{feeitemDr}</if>
            <if test="feeitemDrRemarks != null  and feeitemDrRemarks != ''"> and feeitem_dr_remarks = #{feeitemDrRemarks}</if>
            <if test="feeitemCr != null "> and feeitem_cr = #{feeitemCr}</if>
            <if test="feeitemCrRemarks != null  and feeitemCrRemarks != ''"> and feeitem_cr_remarks = #{feeitemCrRemarks}</if>
            <if test="amtDr != null "> and amt_dr = #{amtDr}</if>
            <if test="amtCr != null "> and amt_cr = #{amtCr}</if>
            <if test="dueDateDr != null "> and due_date_dr = #{dueDateDr}</if>
            <if test="dueDateCr != null "> and due_date_cr = #{dueDateCr}</if>
            <if test="odometerFrom != null "> and odometer_from = #{odometerFrom}</if>
            <if test="odometerEnd != null "> and odometer_end = #{odometerEnd}</if>
            <if test="milesEmpty != null "> and miles_empty = #{milesEmpty}</if>
            <if test="milesLoad != null "> and miles_load = #{milesLoad}</if>
            <if test="miles != null "> and miles = #{miles}</if>
            <if test="driverbonus != null "> and driverbonus = #{driverbonus}</if>
            <if test="costtoll != null "> and costtoll = #{costtoll}</if>
            <if test="costmaintain != null "> and costmaintain = #{costmaintain}</if>
            <if test="costOth != null "> and cost_oth = #{costOth}</if>
            <if test="costRemarks != null  and costRemarks != ''"> and cost_remarks = #{costRemarks}</if>
            <if test="oilQtyper != null "> and oil_qtyper = #{oilQtyper}</if>
            <if test="oilQty1 != null "> and oil_qty1 = #{oilQty1}</if>
            <if test="oilPrice1 != null "> and oil_price1 = #{oilPrice1}</if>
            <if test="oilAmt1 != null "> and oil_amt1 = #{oilAmt1}</if>
            <if test="oilQty2 != null "> and oil_qty2 = #{oilQty2}</if>
            <if test="oilPrice2 != null "> and oil_price2 = #{oilPrice2}</if>
            <if test="oilAmt2 != null "> and oil_amt2 = #{oilAmt2}</if>
            <if test="oilQty != null "> and oil_qty = #{oilQty}</if>
            <if test="oilPrice != null "> and oil_price = #{oilPrice}</if>
            <if test="oilAmt != null "> and oil_amt = #{oilAmt}</if>
            <if test="oilQtyBlc != null "> and oil_qty_blc = #{oilQtyBlc}</if>
            <if test="oilAmtBlc != null "> and oil_amt_blc = #{oilAmtBlc}</if>
            <if test="profit != null "> and profit = #{profit}</if>
            <if test="invDrNeed != null  and invDrNeed != ''"> and inv_dr_need = #{invDrNeed}</if>
            <if test="invDrStatus != null  and invDrStatus != ''"> and inv_dr_status = #{invDrStatus}</if>
            <if test="invDrTaxrate != null "> and inv_dr_taxrate = #{invDrTaxrate}</if>
            <if test="invDrTaxamt != null "> and inv_dr_taxamt = #{invDrTaxamt}</if>
            <if test="invDrDate != null "> and inv_dr_date = #{invDrDate}</if>
            <if test="invDrNo != null  and invDrNo != ''"> and inv_dr_no = #{invDrNo}</if>
            <if test="accchkStaus != null  and accchkStaus != ''"> and accchk_staus = #{accchkStaus}</if>
            <if test="billStatus != null "> and bill_status = #{billStatus}</if>
            <if test="orderStatus != null "> and order_status = #{orderStatus}</if>
            <if test="accchkDateCr != null "> and accchk_date_cr = #{accchkDateCr}</if>
            <if test="costomAmt01 != null "> and costom_amt_01 = #{costomAmt01}</if>
            <if test="stlAmtDr != null "> and stl_amt_dr = #{stlAmtDr}</if>
            <if test="costomAmt02 != null "> and costom_amt_02 = #{costomAmt02}</if>
            <if test="stlDateDr != null "> and stl_date_dr = #{stlDateDr}</if>
            <if test="costomAmt03 != null "> and costom_amt_03 = #{costomAmt03}</if>
            <if test="stlAmtCr != null "> and stl_amt_cr = #{stlAmtCr}</if>
            <if test="costomAmt04 != null "> and costom_amt_04 = #{costomAmt04}</if>
            <if test="stlDateCr != null "> and stl_date_cr = #{stlDateCr}</if>
            <if test="costomAmt05 != null "> and costom_amt_05 = #{costomAmt05}</if>
            <if test="costomAmt06 != null "> and costom_amt_06 = #{costomAmt06}</if>
            <if test="costomStr01 != null  and costomStr01 != ''"> and costom_str_01 = #{costomStr01}</if>
            <if test="costomStr02 != null  and costomStr02 != ''"> and costom_str_02 = #{costomStr02}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
        </where>
    </select>

    <select id="selectftmsorderbillscarsIdList" parameterType="ftmsorderbillscars" resultMap="ftmsorderbillscarsResult">
        select id from F_TMSORDERBILLSCARS
        <where>
            <if test="pId != null "> and p_id = #{pId}</if>
            <if test="orgId != null "> and org_id = #{orgId}</if>
            <if test="orderNo != null  and orderNo != ''"> and order_no = #{orderNo}</if>
            <if test="cntrId != null "> and cntr_id = #{cntrId}</if>
            <if test="cntrNo != null  and cntrNo != ''"> and cntr_no = #{cntrNo}</if>
            <if test="carcorPid != null "> and carcor_pid = #{carcorPid}</if>
            <if test="mblno != null  and mblno != ''"> and mblno = #{mblno}</if>
            <if test="carregNo != null  and carregNo != ''"> and carreg_no = #{carregNo}</if>
            <if test="driverName != null  and driverName != ''"> and driver_name like concat('%', #{driverName}, '%')</if>
            <if test="driverUserId != null "> and driver_user_id = #{driverUserId}</if>
            <if test="driverTel != null  and driverTel != ''"> and driver_tel = #{driverTel}</if>
            <if test="planDate != null "> and plan_date = #{planDate}</if>
            <if test="planRemarks != null  and planRemarks != ''"> and plan_remarks = #{planRemarks}</if>
            <if test="acceptDate != null "> and accept_date = #{acceptDate}</if>
            <if test="acceptRemarks != null  and acceptRemarks != ''"> and accept_remarks = #{acceptRemarks}</if>
            <if test="loadDate != null "> and load_date = #{loadDate}</if>
            <if test="loadRemarks != null  and loadRemarks != ''"> and load_remarks = #{loadRemarks}</if>
            <if test="mdLoadDate != null "> and md_load_date = #{mdLoadDate}</if>
            <if test="offData != null "> and off_data = #{offData}</if>
            <if test="offRemarks != null  and offRemarks != ''"> and off_remarks = #{offRemarks}</if>
            <if test="mdLoadRemarks != null  and mdLoadRemarks != ''"> and md_load_remarks = #{mdLoadRemarks}</if>
            <if test="unLoadDate != null "> and un_load_date = #{unLoadDate}</if>
            <if test="unLoadRemarks != null  and unLoadRemarks != ''"> and un_load_remarks = #{unLoadRemarks}</if>
            <if test="waybillDate != null "> and waybill_date = #{waybillDate}</if>
            <if test="qtyLoad != null "> and qty_load = #{qtyLoad}</if>
            <if test="qtyUnLoad != null "> and qty_un_load = #{qtyUnLoad}</if>
            <if test="cntrQty != null "> and cntr_qty = #{cntrQty}</if>
            <if test="gopodsLossQty != null "> and gopods_loss_qty = #{gopodsLossQty}</if>
            <if test="cntrWeight != null "> and cntr_weight = #{cntrWeight}</if>
            <if test="gopodsLossrate != null "> and gopods_lossrate = #{gopodsLossrate}</if>
            <if test="waybillRemarks != null  and waybillRemarks != ''"> and waybill_remarks = #{waybillRemarks}</if>
            <if test="gopodsLossamtCr != null "> and gopods_lossamt_cr = #{gopodsLossamtCr}</if>
            <if test="qtyDr != null "> and qty_dr = #{qtyDr}</if>
            <if test="gopodsLossamtDr != null "> and gopods_lossamt_dr = #{gopodsLossamtDr}</if>
            <if test="qtyCr != null "> and qty_cr = #{qtyCr}</if>
            <if test="freightPriceDr != null "> and freight_price_dr = #{freightPriceDr}</if>
            <if test="freightPriceCr != null "> and freight_price_cr = #{freightPriceCr}</if>
            <if test="freightAmtDr != null "> and freight_amt_dr = #{freightAmtDr}</if>
            <if test="freightAmtCr != null "> and freight_amt_cr = #{freightAmtCr}</if>
            <if test="feeitemDr != null "> and feeitem_dr = #{feeitemDr}</if>
            <if test="feeitemDrRemarks != null  and feeitemDrRemarks != ''"> and feeitem_dr_remarks = #{feeitemDrRemarks}</if>
            <if test="feeitemCr != null "> and feeitem_cr = #{feeitemCr}</if>
            <if test="feeitemCrRemarks != null  and feeitemCrRemarks != ''"> and feeitem_cr_remarks = #{feeitemCrRemarks}</if>
            <if test="amtDr != null "> and amt_dr = #{amtDr}</if>
            <if test="amtCr != null "> and amt_cr = #{amtCr}</if>
            <if test="dueDateDr != null "> and due_date_dr = #{dueDateDr}</if>
            <if test="dueDateCr != null "> and due_date_cr = #{dueDateCr}</if>
            <if test="odometerFrom != null "> and odometer_from = #{odometerFrom}</if>
            <if test="odometerEnd != null "> and odometer_end = #{odometerEnd}</if>
            <if test="milesEmpty != null "> and miles_empty = #{milesEmpty}</if>
            <if test="milesLoad != null "> and miles_load = #{milesLoad}</if>
            <if test="miles != null "> and miles = #{miles}</if>
            <if test="driverbonus != null "> and driverbonus = #{driverbonus}</if>
            <if test="costtoll != null "> and costtoll = #{costtoll}</if>
            <if test="costmaintain != null "> and costmaintain = #{costmaintain}</if>
            <if test="costOth != null "> and cost_oth = #{costOth}</if>
            <if test="costRemarks != null  and costRemarks != ''"> and cost_remarks = #{costRemarks}</if>
            <if test="oilQtyper != null "> and oil_qtyper = #{oilQtyper}</if>
            <if test="oilQty1 != null "> and oil_qty1 = #{oilQty1}</if>
            <if test="oilPrice1 != null "> and oil_price1 = #{oilPrice1}</if>
            <if test="oilAmt1 != null "> and oil_amt1 = #{oilAmt1}</if>
            <if test="oilQty2 != null "> and oil_qty2 = #{oilQty2}</if>
            <if test="oilPrice2 != null "> and oil_price2 = #{oilPrice2}</if>
            <if test="oilAmt2 != null "> and oil_amt2 = #{oilAmt2}</if>
            <if test="oilQty != null "> and oil_qty = #{oilQty}</if>
            <if test="oilPrice != null "> and oil_price = #{oilPrice}</if>
            <if test="oilAmt != null "> and oil_amt = #{oilAmt}</if>
            <if test="oilQtyBlc != null "> and oil_qty_blc = #{oilQtyBlc}</if>
            <if test="oilAmtBlc != null "> and oil_amt_blc = #{oilAmtBlc}</if>
            <if test="profit != null "> and profit = #{profit}</if>
            <if test="invDrNeed != null  and invDrNeed != ''"> and inv_dr_need = #{invDrNeed}</if>
            <if test="invDrStatus != null  and invDrStatus != ''"> and inv_dr_status = #{invDrStatus}</if>
            <if test="invDrTaxrate != null "> and inv_dr_taxrate = #{invDrTaxrate}</if>
            <if test="invDrTaxamt != null "> and inv_dr_taxamt = #{invDrTaxamt}</if>
            <if test="invDrDate != null "> and inv_dr_date = #{invDrDate}</if>
            <if test="invDrNo != null  and invDrNo != ''"> and inv_dr_no = #{invDrNo}</if>
            <if test="accchkStaus != null  and accchkStaus != ''"> and accchk_staus = #{accchkStaus}</if>
            <if test="billStatus != null "> and bill_status = #{billStatus}</if>
            <if test="orderStatus != null "> and order_status = #{orderStatus}</if>
            <if test="accchkDateCr != null "> and accchk_date_cr = #{accchkDateCr}</if>
            <if test="costomAmt01 != null "> and costom_amt_01 = #{costomAmt01}</if>
            <if test="stlAmtDr != null "> and stl_amt_dr = #{stlAmtDr}</if>
            <if test="costomAmt02 != null "> and costom_amt_02 = #{costomAmt02}</if>
            <if test="stlDateDr != null "> and stl_date_dr = #{stlDateDr}</if>
            <if test="costomAmt03 != null "> and costom_amt_03 = #{costomAmt03}</if>
            <if test="stlAmtCr != null "> and stl_amt_cr = #{stlAmtCr}</if>
            <if test="costomAmt04 != null "> and costom_amt_04 = #{costomAmt04}</if>
            <if test="stlDateCr != null "> and stl_date_cr = #{stlDateCr}</if>
            <if test="costomAmt05 != null "> and costom_amt_05 = #{costomAmt05}</if>
            <if test="costomAmt06 != null "> and costom_amt_06 = #{costomAmt06}</if>
            <if test="costomStr01 != null  and costomStr01 != ''"> and costom_str_01 = #{costomStr01}</if>
            <if test="costomStr02 != null  and costomStr02 != ''"> and costom_str_02 = #{costomStr02}</if>
            <if test="remarks != null  and remarks != ''"> and remarks = #{remarks}</if>
        </where>
    </select>

    <select id="selectftmsorderbillscarsMapListModify" parameterType="ftmsorderbills" resultType="com.ruoyi.orderPlan.domain.FtmsorderbillscarsExcel">
        SELECT
        c.id,
        c.src_m_id srcMId,
        c.order_no orderNo,
        c.mblno,
        c.carreg_no carregNo,
        driver.f_name driverName,
        c.driver_tel driverTel,
        CASE
        c.order_status
        WHEN 10 THEN
        '车队安排'
        WHEN 20 THEN
        '司机受理'
        WHEN 40 THEN
        '提箱'
        WHEN 50 THEN
        '装卸货'
        WHEN 60 THEN
        '还卸柜'
        WHEN 80 THEN
        '回单'
        END orderName,
        c.order_status orderStatus,
        p.f_name corpId,
        CASE
        t.bill_type
        WHEN 1 THEN
        '进口'
        WHEN 2 THEN
        '出口'
        WHEN 3 THEN
        '内贸'
        WHEN 4 THEN
        '其他'
        END billType,
        CASE
        t.trans_type
        WHEN 1 THEN
        '集装箱'
        WHEN 2 THEN
        '搭建'
        WHEN 3 THEN
        '散货'
        END transType,
        CASE
        t.trans_type
        WHEN 1 THEN
        '重去重回'
        WHEN 2 THEN
        '重去空回'
        WHEN 3 THEN
        '空去重回'
        END transProp,
        CASE
        c.bill_kind
        WHEN 'NN' THEN
        '直单'
        WHEN 'MM' THEN
        '主单'
        WHEN 'MH' THEN
        '从单'
        END billKind,
        c.m_bill_no mBillNo,
        g.f_name goodsId,
        c.cntr_weight cntrWeight,
        t.qty_plan qtyPlan,
        t.weight_plan weightPlan,
        t.ysl,
        t.voy,
        t.load_addr loadAddr,
        t.load_date tLoadDate,
        t.load_attn loadAttn,
        t.load_attntel loadAttntel,
        t.md_load_addr mdLoadAddr,
        t.md_load_date tMdLoadDate,
        t.md_load_attn mdLoadAttn,
        t.md_load_attn_tel mdLoadAttnTel,
        t.un_load_addr unLoadAddr,
        t.un_load_date tUnLoadDate,
        t.un_load_attn unLoadAttn,
        t.un_load_attn_tel unLoadAttnTel,
        dic.dict_label cntrId,
        pol.f_name polId,
        pod.f_name podId,
        c.accept_date acceptDate,
        c.cntr_qty cntrQty,
        c.off_data offData,
        c.load_date loadDate,
        c.md_load_date mdLoadDate,
        c.un_load_date unLoadDate,
        c.waybill_date waybillDate,
        c.waybill_remarks waybillRemarks,
        c.oil_amt oilAmt,
        c.cost_oth costOth,
        c.driverbonus driverbonus,
        c.cost_remarks costRemarks,
        c.costom_amt_06 costomAmt06,
        c.costom_amt_05 costomAmt05,
        c.costom_amt_04 costomAmt04,
        c.costom_amt_03 costomAmt03,
        c.costom_amt_02 costomAmt02,
        c.costom_amt_01 costomAmt01,
        c.costom_str_02 costomStr02,
        c.costom_str_01 costomStr01
        FROM
        F_TMSORDERBILLSCARS_MODIFY c
        LEFT JOIN F_TMSORDERBILLS t ON t.id = c.org_id
        LEFT JOIN t_corps p ON p.f_id = t.corp_id
        LEFT JOIN t_corps fleet ON fleet.f_id = c.carcor_pid
        LEFT JOIN t_goods g ON g.f_id = t.goods_id
        LEFT JOIN t_address pol ON pol.f_id = t.pol_id
        AND pol.f_types = 1
        LEFT JOIN t_address pod ON pod.f_id = t.pod_id
        AND pod.f_types = 1
        LEFT JOIN sys_dict_data dic ON dic.dict_value = c.cntr_id
        AND dic.dict_type = 'data_cntrId'
        LEFT JOIN t_corps driver ON driver.f_id = c.driver_user_id
        <where>
            <if test="carStatus == null">and c.bill_status &gt;= 6</if>
            <if test="corpId != null">and t.corp_id = #{corpId}</if>
            <if test="billType != null">and t.bill_type = #{billType}</if>
            <if test="transType != null">and t.trans_type = #{transType}</if>
            <if test="transProp != null">and t.trans_prop = #{transProp}</if>
            <if test="goodsId != null">and t.goods_id = #{goodsId}</if>
            <if test="driverTel != null">and c.driver_tel = #{driverTel}</if>
            <if test="orderStatus != null">and c.order_status = #{orderStatus}</if>
            <if test="billKind != null">and c.bill_kind = #{billKind}</if>
            <if test="carStatus != null and carStatus == 'planDate'">and c.order_status = 10</if>
            <if test="carStatus != null and carStatus == 'acceptDate'">and c.order_status = 20</if>
            <if test="carStatus != null and carStatus == 'loadDate'">and c.order_status = 40</if>
            <if test="carStatus != null and carStatus == 'mdLoadDate'">and c.order_status = 50</if>
            <if test="carStatus != null and carStatus == 'unLoadDate'">and c.order_status = 60</if>
            <if test="carStatus != null and carStatus == 'receiptDate'">and c.order_status = 80</if>
            <if test="isFleet != null and isFleet == 1">
                AND fleet.f_id = #{fleetId}
            </if>
            <if test='planDate != null and planDate[0] != null and planDate[0]!= ""'>
                and c.plan_date &gt;= #{planDate[0]}
            </if>
            <if test='planDate != null and planDate[1] != null and planDate[1]!= ""'>
                and c.plan_date &lt;= #{planDate[1]}
            </if>
            <if test='acceptDateList != null and acceptDateList[0] != null and acceptDateList[0]!= ""'>
                and c.accept_date &gt;= #{acceptDateList[0]}
            </if>
            <if test='acceptDateList != null and acceptDateList[1] != null and acceptDateList[1]!= ""'>
                and c.accept_date &lt;= #{acceptDateList[1]}
            </if>
            <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
                and c.load_date &gt;= #{cLoadDate[0]}
            </if>
            <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
                and c.load_date &lt;= #{cLoadDate[1]}
            </if>
            <if test="mblno != null  and mblno != ''">and t.mblno like concat('%', #{mblno}, '%')</if>
            <if test="orderNo != null  and orderNo != ''">and c.order_no like concat('%', #{orderNo}, '%')</if>
            <if test="mBillNo != null  and mBillNo != ''">and c.m_bill_no like concat('%', #{mBillNo}, '%')</if>
            <if test="carregNo != null  and carregNo != ''">and c.carreg_no like concat('%', #{carregNo}, '%')</if>
            <if test="loadAddr != null  and loadAddr != ''">and t.load_addr like concat('%', #{loadAddr}, '%')</if>
            <if test="unLoadAddr != null  and unLoadAddr != ''">and t.un_load_addr like concat('%', #{unLoadAddr},'%')</if>
            <if test="mdLoadAddr != null  and mdLoadAddr != ''">and t.md_load_addr like concat('%', #{mdLoadAddr},'%')</if>
        </where>
        ORDER BY c.id desc
    </select>

    <select id="selectftmsorderbillscarsMapList" parameterType="ftmsorderbills" resultType="com.ruoyi.orderPlan.domain.FtmsorderbillscarsExcel">
        SELECT
            c.id,
            c.order_no orderNo,
            c.mblno,
            c.carreg_no carregNo,
            driver.f_name driverName,
            c.driver_tel driverTel,
            CASE
            c.order_status
            WHEN 10 THEN
            '车队安排'
            WHEN 20 THEN
            '司机受理'
            WHEN 40 THEN
            '提箱'
            WHEN 50 THEN
            '装卸货'
            WHEN 60 THEN
            '还卸柜'
            WHEN 80 THEN
            '回单'
            END orderName,
            c.order_status orderStatus,
            p.f_name corpId,
            CASE
            t.bill_type
            WHEN 1 THEN
            '进口'
            WHEN 2 THEN
            '出口'
            WHEN 3 THEN
            '内贸'
            WHEN 4 THEN
            '其他'
            END billType,
            CASE
            t.trans_type
            WHEN 1 THEN
            '集装箱'
            WHEN 2 THEN
            '搭建'
            WHEN 3 THEN
            '散货'
            END transType,
            CASE
            t.trans_type
            WHEN 1 THEN
            '重去重回'
            WHEN 2 THEN
            '重去空回'
            WHEN 3 THEN
            '空去重回'
            END transProp,
            CASE
            c.bill_kind
            WHEN 'NN' THEN
            '直单'
            WHEN 'MM' THEN
            '主单'
            WHEN 'MH' THEN
            '从单'
            END billKind,
            c.m_bill_no mBillNo,
            g.f_name goodsId,
            c.cntr_weight cntrWeight,
            t.qty_plan qtyPlan,
            t.weight_plan weightPlan,
            t.ysl,
            t.voy,
            t.load_addr loadAddr,
            t.load_date tLoadDate,
            t.load_attn loadAttn,
            t.load_attntel loadAttntel,
            t.md_load_addr mdLoadAddr,
            t.md_load_date tMdLoadDate,
            t.md_load_attn mdLoadAttn,
            t.md_load_attn_tel mdLoadAttnTel,
            t.un_load_addr unLoadAddr,
            t.un_load_date tUnLoadDate,
            t.un_load_attn unLoadAttn,
            t.un_load_attn_tel unLoadAttnTel,
            dic.dict_label cntrId,
            pol.f_name polId,
            pod.f_name podId,
            c.accept_date acceptDate,
            c.cntr_qty cntrQty,
            c.off_data offData,
            c.load_date loadDate,
            c.md_load_date mdLoadDate,
            c.un_load_date unLoadDate,
            c.waybill_date waybillDate,
            c.waybill_remarks waybillRemarks,
            c.oil_amt oilAmt,
            c.cost_oth costOth,
            c.driverbonus driverbonus,
            c.cost_remarks costRemarks,
            c.costom_amt_06 costomAmt06,
            c.costom_amt_05 costomAmt05,
            c.costom_amt_04 costomAmt04,
            c.costom_amt_03 costomAmt03,
            c.costom_amt_02 costomAmt02,
            c.costom_amt_01 costomAmt01,
            c.costom_str_02 costomStr02,
            c.costom_str_01 costomStr01
        FROM
            F_TMSORDERBILLSCARS c
            LEFT JOIN F_TMSORDERBILLS t ON t.id = c.org_id
            LEFT JOIN t_corps p ON p.f_id = t.corp_id
            LEFT JOIN t_corps fleet ON fleet.f_id = c.carcor_pid
            LEFT JOIN t_goods g ON g.f_id = t.goods_id
            LEFT JOIN t_address pol ON pol.f_id = t.pol_id
            AND pol.f_types = 1
            LEFT JOIN t_address pod ON pod.f_id = t.pod_id
            AND pod.f_types = 1
            LEFT JOIN sys_dict_data dic ON dic.dict_value = c.cntr_id
            AND dic.dict_type = 'data_cntrId'
            LEFT JOIN t_corps driver ON driver.f_id = c.driver_user_id
        <where>
            <if test="carStatus == null">and c.bill_status &gt;= 6</if>
            <if test="corpId != null">and t.corp_id = #{corpId}</if>
            <if test="billType != null">and t.bill_type = #{billType}</if>
            <if test="transType != null">and t.trans_type = #{transType}</if>
            <if test="transProp != null">and t.trans_prop = #{transProp}</if>
            <if test="goodsId != null">and t.goods_id = #{goodsId}</if>
            <if test="driverTel != null">and c.driver_tel = #{driverTel}</if>
            <if test="orderStatus != null">and c.order_status = #{orderStatus}</if>
            <if test="billKind != null">and c.bill_kind = #{billKind}</if>
            <if test="carStatus != null and carStatus == 'planDate'">and c.order_status = 10</if>
            <if test="carStatus != null and carStatus == 'acceptDate'">and c.order_status = 20</if>
            <if test="carStatus != null and carStatus == 'loadDate'">and c.order_status = 40</if>
            <if test="carStatus != null and carStatus == 'mdLoadDate'">and c.order_status = 50</if>
            <if test="carStatus != null and carStatus == 'unLoadDate'">and c.order_status = 60</if>
            <if test="carStatus != null and carStatus == 'receiptDate'">and c.order_status = 80</if>
            <if test="isFleet != null and isFleet == 1">
                AND fleet.f_id = #{fleetId}
            </if>
            <if test='planDate != null and planDate[0] != null and planDate[0]!= ""'>
                and c.plan_date &gt;= #{planDate[0]}
            </if>
            <if test='planDate != null and planDate[1] != null and planDate[1]!= ""'>
                and c.plan_date &lt;= #{planDate[1]}
            </if>
            <if test='acceptDateList != null and acceptDateList[0] != null and acceptDateList[0]!= ""'>
                and c.accept_date &gt;= #{acceptDateList[0]}
            </if>
            <if test='acceptDateList != null and acceptDateList[1] != null and acceptDateList[1]!= ""'>
                and c.accept_date &lt;= #{acceptDateList[1]}
            </if>
            <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
                and c.load_date &gt;= #{cLoadDate[0]}
            </if>
            <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
                and c.load_date &lt;= #{cLoadDate[1]}
            </if>
            <if test="mblno != null  and mblno != ''">and t.mblno like concat('%', #{mblno}, '%')</if>
            <if test="orderNo != null  and orderNo != ''">and c.order_no like concat('%', #{orderNo}, '%')</if>
            <if test="mBillNo != null  and mBillNo != ''">and c.m_bill_no like concat('%', #{mBillNo}, '%')</if>
            <if test="carregNo != null  and carregNo != ''">and c.carreg_no like concat('%', #{carregNo}, '%')</if>
            <if test="loadAddr != null  and loadAddr != ''">and t.load_addr like concat('%', #{loadAddr}, '%')</if>
            <if test="unLoadAddr != null  and unLoadAddr != ''">and t.un_load_addr like concat('%', #{unLoadAddr},'%')</if>
            <if test="mdLoadAddr != null  and mdLoadAddr != ''">and t.md_load_addr like concat('%', #{mdLoadAddr},'%')</if>
        </where>
        ORDER BY c.id desc
    </select>

    <select id="getButtonValue" parameterType="ftmsorderbills" resultType="Map">
        SELECT
            COUNT( CASE WHEN c.order_status &lt; 80 THEN 1 END ) AS quantity,
            COUNT( CASE WHEN c.order_status = 10 THEN 1 END ) AS planDate,
            COUNT( CASE WHEN c.order_status = 20 THEN 1 END ) AS acceptDate,
            COUNT( CASE WHEN c.order_status = 40 THEN 1 END ) AS loadDate,
            COUNT( CASE WHEN c.order_status = 50 THEN 1 END ) AS mdLoadDate,
            COUNT( CASE WHEN c.order_status = 60 THEN 1 END ) AS unLoadDate
        FROM
            F_TMSORDERBILLSCARS c
            LEFT JOIN t_corps fleet ON fleet.f_id = c.carcor_pid
        WHERE
            c.bill_status &gt;= 6
            <if test="driverTel != null">and c.driver_tel = #{driverTel}</if>
            <if test="isFleet != null and isFleet == 1">AND fleet.f_id = #{fleetId}</if>
    </select>

    <select id="selectftmsorderbillscarsById" parameterType="Long" resultMap="ftmsorderbillscarsResult">
        <include refid="selectftmsorderbillscarsVo"/>
        where id = #{id}
    </select>

    <select id="selectftmsorderbillscarsByPid" parameterType="Long" resultMap="ftmsorderbillscarsResult">
        <include refid="selectftmsorderbillscarsVo"/>
        where p_id = #{pId}
    </select>

    <select id="selectftmsorderbillscarsTemporaryStorageBySrcMId" parameterType="Long" resultMap="ftmsorderbillscarsResult">
        <include refid="selectftmsorderbillscarsTemporaryStorageVo"/>
        where src_m_id = #{srcMId}
    </select>

    <select id="selectStowageList" parameterType="ftmsorderbills" resultType="Map">
        SELECT
            #{id} id,
            c.mblno,
            c.order_no orderNo,
            c.carreg_no carregNo,
            t.load_addr loadAddr,
            date_format( t.load_date, '%Y-%m-%d' ) AS loadDate
        FROM
            F_TMSORDERBILLS t
            LEFT JOIN F_TMSORDERBILLSCARS c ON c.org_id = t.id
        <where>
            c.id != #{id}
            AND c.bill_status = 6
            AND c.load_date IS NULL
            AND c.bill_kind = "NN"
            AND c.driver_user_id = #{driverUserId}
        </where>
        ORDER BY c.id desc
    </select>

    <select id="planSelectCarsCount" parameterType="ftmsorderbills" resultType="int">
        SELECT
            COUNT(id)
        FROM
            F_TMSORDERBILLSCARS
        WHERE
            org_id = #{id}
            AND order_status &gt;= 30
    </select>

    <select id="selectTmsorderbillsCarsByDriver" parameterType="Long" resultType="Map">
        SELECT
            c.id,
            c.p_id AS pId,
            c.org_id AS orgId,
            c.order_no AS orderNo,
            dic.dict_label cntrName,
            t.corp_id AS fCorpId,
            corp.f_name AS fCorpIds,
            u.nick_name AS planUserId,
            driver.nick_name AS driverUserIds,
            date_format( t.un_load_date, '%Y-%m-%d' ) AS tUnLoadDate,
            t.un_load_addr AS tUnLoadAddr,
            t.un_load_attn AS tUnLoadAttn,
            t.un_load_attn_tel AS tUnLoadAttnTel,
            t.qty_plan AS qtyPlan,
            t.weight_plan AS weightPlan,
            t.bill_type AS billType,
            t.trans_type AS transType,
            t.trans_prop AS transProp,
            t.md_load_addr AS tMdLoadAddr,
            t.md_load_attn AS tMdLoadAttn,
            t.md_load_attn_tel AS tMdLoadAttnTel,
            date_format( t.md_load_date, '%Y-%m-%d' ) AS tMdLoadDate,
            t.load_addr AS tLoadAddr,
            date_format( t.load_date, '%Y-%m-%d' ) AS tLoadDate,
            t.load_attn AS tLoadAttn,
            t.load_attntel AS tLoadAttntel,
            c.mblno,
            c.driver_user_id AS driverUserId,
            c.driverbonus,
            g.f_name AS goodsId,
            c.bill_status AS billStatus,
            c.order_status AS orderStatus,
            c.cntr_qty AS cntrQty,
            c.cntr_weight AS cntrWeight,
            t.ysl,
            t.voy,
            t.pol_id AS polId,
            t.pod_id AS podId,
            c.m_bill_no AS mBillNo,
            c.bill_kind AS billKind,
            c.oil_amt AS oilAmt,
            c.cost_oth AS costOth,
            c.cntr_id AS cntrId,
            c.carreg_no AS carregNo,
            c.carcor_pid AS carcorPid,
            c.driver_tel AS driverTel,
            c.driver_name AS driverName,
            c.cost_remarks AS costRemarks,
            c.odometer_end AS odometerEnd,
            c.odometer_from AS odometerFrom,
            c.freight_price_dr AS freightPriceDr,
            c.freight_price_cr AS freightPriceCr,
            date_format( c.accept_date, '%Y-%m-%d' ) AS acceptDate,
            c.accept_remarks AS acceptRemarks,
            IFNULL( c.costom_amt_01, 0 ) AS costomAmt01,
            IFNULL( c.costom_amt_02, 0 ) AS costomAmt02,
            IFNULL( c.costom_amt_03, 0 ) AS costomAmt03,
            IFNULL( c.costom_amt_04, 0 ) AS costomAmt04,
            IFNULL( c.costom_amt_05, 0 ) AS costomAmt05,
            IFNULL( c.costom_amt_06, 0 ) AS costomAmt06,
            c.costom_str_01 AS costomStr01,
            c.costom_str_02 AS costomStr02,
            c.load_date AS loadDate,
            c.load_remarks AS loadRemarks,
            date_format( c.md_load_date, '%Y-%m-%d' ) AS mdLoadDate,
            c.md_load_remarks AS mdLoadRemarks,
            date_format( c.un_load_date, '%Y-%m-%d' ) AS unLoadDate,
            c.un_load_remarks AS unLoadRemarks,
            date_format( c.waybill_date, '%Y-%m-%d' ) AS waybillDate,
            c.waybill_remarks AS waybillRemarks
        FROM
            F_TMSORDERBILLSCARS c
            LEFT JOIN F_TMSORDERBILLS t ON t.id = c.org_id
            LEFT JOIN sys_user u ON u.user_id = t.plan_user_id
            LEFT JOIN sys_user driver ON driver.user_id = c.driver_user_id
            LEFT JOIN t_corps corp ON corp.f_id = t.corp_id
            LEFT JOIN t_goods g ON g.f_id = t.goods_id
            LEFT JOIN sys_dict_data dic ON dic.dict_value = c.cntr_id
            AND dic.dict_type = 'data_cntrId'
        where
            c.id = #{id}
        ORDER BY c.id desc
    </select>

    <select id="selectMonthlyOrder" parameterType="ftmsorderbillscars" resultType="Map">
        SELECT count( p_id ) countOrders, IFNULL(SUM( miles ),0) miles, IFNULL( SUM( driverbonus ), 0 ) freightAmtDr
        FROM F_TMSORDERBILLSCARS
        <where>
            driver_tel = #{driverTel}
            and order_status &gt;= 7
            <if test='monthList != null and monthList[0] != null and monthList[0]!= ""'>
                and create_time &gt;= #{monthList[0]}
            </if>
            <if test='monthList != null and monthList[1] != null and monthList[1]!= ""'>
                and create_time &lt;= #{monthList[1]}
            </if>
        </where>
    </select>

    <select id="selectHomeUpperRightMapList" parameterType="ftmsorderbills" resultType="Map">
        SELECT
            car.id,
            car.mblno,
            car.carreg_no carregNo,
            car.order_status orderStatus,
            t.f_name corpName
        FROM
            F_TMSORDERBILLSCARS car
            LEFT JOIN F_TMSORDERBILLS bill ON bill.id = car.org_id
            LEFT JOIN t_corps fleet ON fleet.f_id = car.carcor_pid
            LEFT JOIN t_corps t ON t.f_id = bill.corp_id
        <where>
            car.bill_status &gt;= 6
            AND car.order_status != 80
            <if test="isFleet != null and isFleet == 1">
                AND fleet.f_id = #{fleetId}
            </if>
        </where>
        ORDER BY
            car.id DESC
        LIMIT 10
    </select>

    <select id="selectHomeUpperLeftCntrs" parameterType="ftmsorderbills" resultType="Map">
        SELECT
            IFNULL( SUM( p.cntr_qty ), 0 ) planQuantity,
            IFNULL( SUM( ( p.cntr_qty - p.car_qty ) ), 0 ) surplusQuantity
        FROM
            F_TMSORDERBILLSPLANS p
            LEFT JOIN t_corps fleet ON fleet.f_id = p.carcor_pid
        WHERE
            p.create_time &gt;= #{currentDay[0]}
            AND p.create_time &lt;= #{currentDay[1]}
            AND p.bill_status &gt;= 6
            <if test="isFleet != null and isFleet == 1">
                AND fleet.f_id = #{fleetId}
            </if>
    </select>

    <select id="selectHomeUpperLeftCars" parameterType="ftmsorderbills" resultType="int">
        SELECT
            COUNT( car.id )
        FROM
            F_TMSORDERBILLSCARS car
            LEFT JOIN t_corps fleet ON fleet.f_id = car.carcor_pid
        <where>
            car.bill_status &gt;= 6
            and car.create_time &gt;= #{currentDay[0]}
            and car.create_time &lt;= #{currentDay[1]}
            <if test="isFleet != null and isFleet == 1">
                AND fleet.f_id = #{fleetId}
            </if>
        </where>
    </select>

    <select id="selectMissedOrdersCount" parameterType="string" resultType="Integer">
        select count(id) from F_TMSORDERBILLSCARS where driver_tel = #{phoneNumber} and order_status = 10 and bill_status &gt;= 6
    </select>

    <select id="selectftmsorderbillscarsByOrderNo" parameterType="string" resultMap="ftmsorderbillscarsResult">
        <include refid="selectftmsorderbillscarsVo"/>
        where order_no = #{orderNo}
    </select>

    <select id="queryLedgerList" parameterType="com.ruoyi.orderPlan.domain.VehicleLedgerExcel" resultType="com.ruoyi.orderPlan.domain.VehicleLedgerExcel">
        SELECT
            c.id,
            c.carreg_no carregNo,
            c.order_no orderNo,
            date_format( c.accept_date, '%Y-%m-%d' ) AS acceptDate,
            CASE
            c.bill_kind
            WHEN 'NN' THEN
            '直单'
            WHEN 'MM' THEN
            '主单'
            WHEN 'MH' THEN
            '从单'
            END billType,
            c.m_bill_no mBillNo,
            c.mblno inMblno,
            t.load_addr loadAddr,
            t.md_load_addr mdLoadAddr,
            SUM( c.cntr_qty ) cntrQty,
            cntr.dict_label cntrId,
            GROUP_CONCAT( ysl, voy ) boxVolume,
            IF
            ( c.bill_kind = 'MM', c.mblno, NULL ) outMblno,
            c.driver_name driverName,
            '费用名称' fleetId,
            sum( CASE WHEN f.f_feeid = 61 AND f.f_dc = 'D' THEN f_amount ELSE 0 END ) shippingDr,
            sum( CASE WHEN f.f_feeid != 61 AND f.f_dc = 'D' THEN f_amount ELSE 0 END ) otherDr,
            sum( CASE WHEN f.f_feeid = 61 AND f.f_dc = 'C' THEN f_amount ELSE 0 END ) shippingCr,
            sum( CASE WHEN f.f_feeid != 61 AND f.f_dc = 'C' THEN f_amount ELSE 0 END ) otherCr,
            ( sum( CASE f.f_dc WHEN 'D' THEN f_amount ELSE 0 END ) - sum( CASE f.f_dc WHEN 'C' THEN f_amount ELSE 0 END )) profit
        FROM
            F_TMSORDERBILLS t
            LEFT JOIN F_TMSORDERBILLSCARS c ON c.org_id = t.id
            AND c.bill_kind != 'MH'
            LEFT JOIN F_TMSORDERBILLSFEES f ON f.f_pid = c.id
            LEFT JOIN sys_dict_data cntr ON cntr.dict_value = c.cntr_id
            AND cntr.dict_type = 'data_cntrId'
        <where>
            c.id != ''
            AND c.order_no IS NOT NULL
            <if test='tCorpId != null'>and c.corp_id = #{tCorpId}</if>
            <if test='stlStatus != null and stlStatus == "T"'>and (c.stl_amt_dr != 0 or c.stl_amt_cr != 0)</if>
            <if test='stlStatus != null and stlStatus == "F"'>and c.stl_amt_dr = 0 and c.stl_amt_cr = 0</if>
            <if test='accchkStatus != null and accchkStatus == "T"'>and (c.accchk_amt_cr != 0 or c.accchk_amt_cr != 0)</if>
            <if test='accchkStatus != null and accchkStatus == "F"'>and c.accchk_amt_dr = 0 and c.accchk_amt_dr = 0</if>
            <if test='invStatus != null and invStatus == "T"'>and (c.inv_amt_cr != 0 or c.inv_amt_cr != 0)</if>
            <if test='invStatus != null and invStatus == "F"'>and c.inv_amt_dr = 0 and c.inv_amt_dr = 0</if>
            <if test='acceptDateList != null and acceptDateList[0] != null and acceptDateList[0]!= ""'>
                and c.accept_date &gt;= #{acceptDateList[0]}
            </if>
            <if test='acceptDateList != null and acceptDateList[1] != null and acceptDateList[1]!= ""'>
                and c.accept_date &lt;= #{acceptDateList[1]}
            </if>
            <if test='accchkDateList != null and accchkDateList[0] != null and accchkDateList[0]!= ""'>
                and c.accchk_date_dr &gt;= #{accchkDateList[0]}
            </if>
            <if test='accchkDateList != null and accchkDateList[1] != null and accchkDateList[1]!= ""'>
                and c.accchk_date_dr &lt;= #{accchkDateList[1]}
            </if>
            <if test="orderNo != null  and orderNo != ''"> and c.order_no like concat('%', #{orderNo}, '%')</if>
            <if test="mBillNo != null  and mBillNo != ''"> and c.m_bill_no like concat('%', #{mBillNo}, '%')</if>
            <if test="carregNo != null  and carregNo != ''"> and c.carreg_no like concat('%', #{carregNo}, '%')</if>
        </where>
        GROUP BY c.m_bill_no
    </select>

    <select id="selectTmsorderbillsCarsByBillKind" resultType="Map">
        SELECT
            corp.f_name corpName,
            c.carreg_no carregNo,
        CASE
                c.bill_kind
                WHEN 'NN' THEN
                '直单'
                WHEN 'MM' THEN
                '主单'
                WHEN 'MH' THEN
                '从单'
            END billType,
            c.accept_date acceptDate,
            c.mblno,
            t.load_addr loadAddr,
            t.un_load_addr unLoadAddr
        FROM
            F_TMSORDERBILLS t
            LEFT JOIN F_TMSORDERBILLSCARS c ON c.org_id = t.id
            LEFT JOIN t_corps corp ON corp.f_id = c.corp_id
        WHERE
	        c.bill_kind = 'MH'
	        AND c.m_bill_no = #{billKind}
    </select>

    <select id="selectCarsFeeByMBillNo" resultType="com.ruoyi.orderPlan.domain.VehicleLedgerExcel">
        SELECT
            sum( CASE WHEN f.f_feeid = 61 AND f.f_dc = 'D' THEN f_amount ELSE 0 END ) shippingDr,
            sum( CASE WHEN f.f_feeid != 61 AND f.f_dc = 'D' THEN f_amount ELSE 0 END ) otherDr,
            sum( CASE WHEN f.f_feeid = 61 AND f.f_dc = 'C' THEN f_amount ELSE 0 END ) shippingCr,
            sum( CASE WHEN f.f_feeid != 61 AND f.f_dc = 'C' THEN f_amount ELSE 0 END ) otherCr
        FROM
            F_TMSORDERBILLSCARS c
            LEFT JOIN F_TMSORDERBILLSFEES f ON f.f_pid = c.id
            LEFT JOIN t_fees fee ON fee.f_id = f.f_feeid
        WHERE
            c.m_bill_no = #{mBillNo}
    </select>

    <insert id="insertftmsorderbillscars" parameterType="ftmsorderbillscars" useGeneratedKeys="true" keyProperty="id">
        insert into F_TMSORDERBILLSCARS
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="pId != null">p_id,</if>
            <if test="orgId != null">org_id,</if>
            <if test="orderNo != null">order_no,</if>
            <if test="cntrId != null">cntr_id,</if>
            <if test="cntrNo != null">cntr_no,</if>
            <if test="carcorPid != null">carcor_pid,</if>
            <if test="carregNo != null">carreg_no,</if>
            <if test="mblno != null">mblno,</if>
            <if test="driverName != null">driver_name,</if>
            <if test="driverTel != null">driver_tel,</if>
            <if test="driverUserId != null">driver_user_id,</if>
            <if test="planDate != null">plan_date,</if>
            <if test="planRemarks != null">plan_remarks,</if>
            <if test="acceptDate != null">accept_date,</if>
            <if test="acceptRemarks != null">accept_remarks,</if>
            <if test="loadDate != null">load_date,</if>
            <if test="loadRemarks != null">load_remarks,</if>
            <if test="mdLoadDate != null">md_load_date,</if>
            <if test="offData != null">off_data,</if>
            <if test="offRemarks != null">off_remarks,</if>
            <if test="mdLoadRemarks != null">md_load_remarks,</if>
            <if test="unLoadDate != null">un_load_date,</if>
            <if test="unLoadRemarks != null">un_load_remarks,</if>
            <if test="waybillDate != null">waybill_date,</if>
            <if test="qtyLoad != null">qty_load,</if>
            <if test="cntrQty != null">cntr_qty,</if>
            <if test="qtyUnLoad != null">qty_un_load,</if>
            <if test="cntrWeight != null">cntr_weight,</if>
            <if test="gopodsLossQty != null">gopods_loss_qty,</if>
            <if test="gopodsLossrate != null">gopods_lossrate,</if>
            <if test="gopodsLossamtCr != null">gopods_lossamt_cr,</if>
            <if test="qtyDr != null">qty_dr,</if>
            <if test="waybillRemarks != null">waybill_remarks,</if>
            <if test="gopodsLossamtDr != null">gopods_lossamt_dr,</if>
            <if test="qtyCr != null">qty_cr,</if>
            <if test="freightPriceDr != null">freight_price_dr,</if>
            <if test="freightPriceCr != null">freight_price_cr,</if>
            <if test="freightAmtDr != null">freight_amt_dr,</if>
            <if test="freightAmtCr != null">freight_amt_cr,</if>
            <if test="feeitemDr != null">feeitem_dr,</if>
            <if test="feeitemDrRemarks != null">feeitem_dr_remarks,</if>
            <if test="feeitemCr != null">feeitem_cr,</if>
            <if test="feeitemCrRemarks != null">feeitem_cr_remarks,</if>
            <if test="amtDr != null">amt_dr,</if>
            <if test="amtCr != null">amt_cr,</if>
            <if test="dueDateDr != null">due_date_dr,</if>
            <if test="dueDateCr != null">due_date_cr,</if>
            <if test="odometerFrom != null">odometer_from,</if>
            <if test="odometerEnd != null">odometer_end,</if>
            <if test="milesEmpty != null">miles_empty,</if>
            <if test="milesLoad != null">miles_load,</if>
            <if test="miles != null">miles,</if>
            <if test="driverbonus != null">driverbonus,</if>
            <if test="costtoll != null">costtoll,</if>
            <if test="costmaintain != null">costmaintain,</if>
            <if test="costOth != null">cost_oth,</if>
            <if test="costRemarks != null">cost_remarks,</if>
            <if test="oilQtyper != null">oil_qtyper,</if>
            <if test="oilQty1 != null">oil_qty1,</if>
            <if test="oilPrice1 != null">oil_price1,</if>
            <if test="oilAmt1 != null">oil_amt1,</if>
            <if test="oilQty2 != null">oil_qty2,</if>
            <if test="oilPrice2 != null">oil_price2,</if>
            <if test="oilAmt2 != null">oil_amt2,</if>
            <if test="oilQty != null">oil_qty,</if>
            <if test="oilPrice != null">oil_price,</if>
            <if test="oilAmt != null">oil_amt,</if>
            <if test="oilQtyBlc != null">oil_qty_blc,</if>
            <if test="oilAmtBlc != null">oil_amt_blc,</if>
            <if test="profit != null">profit,</if>
            <if test="invDrNeed != null">inv_dr_need,</if>
            <if test="invDrStatus != null">inv_dr_status,</if>
            <if test="invDrTaxrate != null">inv_dr_taxrate,</if>
            <if test="invDrTaxamt != null">inv_dr_taxamt,</if>
            <if test="invDrDate != null">inv_dr_date,</if>
            <if test="invDrNo != null">inv_dr_no,</if>
            <if test="accchkStaus != null">accchk_staus,</if>
            <if test="billStatus != null">bill_status,</if>
            <if test="orderStatus != null">order_status,</if>
            <if test="costomAmt01 != null">costom_amt_01,</if>
            <if test="costomAmt02 != null">costom_amt_02,</if>
            <if test="stlAmtDr != null">stl_amt_dr,</if>
            <if test="costomAmt03 != null">costom_amt_03,</if>
            <if test="stlDateDr != null">stl_date_dr,</if>
            <if test="costomAmt04 != null">costom_amt_04,</if>
            <if test="stlAmtCr != null">stl_amt_cr,</if>
            <if test="costomAmt05 != null">costom_amt_05,</if>
            <if test="stlDateCr != null">stl_date_cr,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="costomAmt06 != null">costom_amt_06,</if>
            <if test="costomStr01 != null">costom_str_01,</if>
            <if test="createBy != null">create_by,</if>
            <if test="costomStr02 != null">costom_str_02,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remarks != null">remarks,</if>
            <if test="accchkDateCr != null">accchk_date_cr,</if>
            <if test="mBillNo != null">m_bill_no,</if>
            <if test="billKind != null">bill_kind,</if>
            <if test="profitBill != null">profit_bill,</if>
            <if test="profitCar != null">profit_car,</if>
            <if test="corpId != null">corp_id,</if>
            <if test="invAmtCr != null">inv_amt_cr,</if>
            <if test="invAmtDr != null">inv_amt_dr,</if>
            <if test="invDateCr != null">inv_date_cr,</if>
            <if test="invDateDr != null">inv_date_dr,</if>
            <if test="accchkAmtCr != null">accchk_amt_cr,</if>
            <if test="accchkAmtDr != null">accchk_amt_dr,</if>
            <if test="accchkDateDr != null">accchk_date_dr,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="pId != null">#{pId},</if>
            <if test="orgId != null">#{orgId},</if>
            <if test="orderNo != null">#{orderNo},</if>
            <if test="cntrId != null">#{cntrId},</if>
            <if test="cntrNo != null">#{cntrNo},</if>
            <if test="carcorPid != null">#{carcorPid},</if>
            <if test="carregNo != null">#{carregNo},</if>
            <if test="mblno != null">#{mblno},</if>
            <if test="driverName != null">#{driverName},</if>
            <if test="driverTel != null">#{driverTel},</if>
            <if test="driverUserId != null">#{driverUserId},</if>
            <if test="planDate != null">#{planDate},</if>
            <if test="planRemarks != null">#{planRemarks},</if>
            <if test="acceptDate != null">#{acceptDate},</if>
            <if test="acceptRemarks != null">#{acceptRemarks},</if>
            <if test="loadDate != null">#{loadDate},</if>
            <if test="loadRemarks != null">#{loadRemarks},</if>
            <if test="mdLoadDate != null">#{mdLoadDate},</if>
            <if test="offData != null">#{offData},</if>
            <if test="offRemarks != null">#{offRemarks},</if>
            <if test="mdLoadRemarks != null">#{mdLoadRemarks},</if>
            <if test="unLoadDate != null">#{unLoadDate},</if>
            <if test="unLoadRemarks != null">#{unLoadRemarks},</if>
            <if test="waybillDate != null">#{waybillDate},</if>
            <if test="qtyLoad != null">#{qtyLoad},</if>
            <if test="cntrQty != null">#{cntrQty},</if>
            <if test="qtyUnLoad != null">#{qtyUnLoad},</if>
            <if test="cntrWeight != null">#{cntrWeight},</if>
            <if test="gopodsLossQty != null">#{gopodsLossQty},</if>
            <if test="gopodsLossrate != null">#{gopodsLossrate},</if>
            <if test="gopodsLossamtCr != null">#{gopodsLossamtCr},</if>
            <if test="qtyDr != null">#{qtyDr},</if>
            <if test="waybillRemarks != null">#{waybillRemarks},</if>
            <if test="gopodsLossamtDr != null">#{gopodsLossamtDr},</if>
            <if test="qtyCr != null">#{qtyCr},</if>
            <if test="freightPriceDr != null">#{freightPriceDr},</if>
            <if test="freightPriceCr != null">#{freightPriceCr},</if>
            <if test="freightAmtDr != null">#{freightAmtDr},</if>
            <if test="freightAmtCr != null">#{freightAmtCr},</if>
            <if test="feeitemDr != null">#{feeitemDr},</if>
            <if test="feeitemDrRemarks != null">#{feeitemDrRemarks},</if>
            <if test="feeitemCr != null">#{feeitemCr},</if>
            <if test="feeitemCrRemarks != null">#{feeitemCrRemarks},</if>
            <if test="amtDr != null">#{amtDr},</if>
            <if test="amtCr != null">#{amtCr},</if>
            <if test="dueDateDr != null">#{dueDateDr},</if>
            <if test="dueDateCr != null">#{dueDateCr},</if>
            <if test="odometerFrom != null">#{odometerFrom},</if>
            <if test="odometerEnd != null">#{odometerEnd},</if>
            <if test="milesEmpty != null">#{milesEmpty},</if>
            <if test="milesLoad != null">#{milesLoad},</if>
            <if test="miles != null">#{miles},</if>
            <if test="driverbonus != null">#{driverbonus},</if>
            <if test="costtoll != null">#{costtoll},</if>
            <if test="costmaintain != null">#{costmaintain},</if>
            <if test="costOth != null">#{costOth},</if>
            <if test="costRemarks != null">#{costRemarks},</if>
            <if test="oilQtyper != null">#{oilQtyper},</if>
            <if test="oilQty1 != null">#{oilQty1},</if>
            <if test="oilPrice1 != null">#{oilPrice1},</if>
            <if test="oilAmt1 != null">#{oilAmt1},</if>
            <if test="oilQty2 != null">#{oilQty2},</if>
            <if test="oilPrice2 != null">#{oilPrice2},</if>
            <if test="oilAmt2 != null">#{oilAmt2},</if>
            <if test="oilQty != null">#{oilQty},</if>
            <if test="oilPrice != null">#{oilPrice},</if>
            <if test="oilAmt != null">#{oilAmt},</if>
            <if test="oilQtyBlc != null">#{oilQtyBlc},</if>
            <if test="oilAmtBlc != null">#{oilAmtBlc},</if>
            <if test="profit != null">#{profit},</if>
            <if test="invDrNeed != null">#{invDrNeed},</if>
            <if test="invDrStatus != null">#{invDrStatus},</if>
            <if test="invDrTaxrate != null">#{invDrTaxrate},</if>
            <if test="invDrTaxamt != null">#{invDrTaxamt},</if>
            <if test="invDrDate != null">#{invDrDate},</if>
            <if test="invDrNo != null">#{invDrNo},</if>
            <if test="accchkStaus != null">#{accchkStaus},</if>
            <if test="billStatus != null">#{billStatus},</if>
            <if test="orderStatus != null">#{orderStatus},</if>
            <if test="costomAmt01 != null">#{costomAmt01},</if>
            <if test="costomAmt02 != null">#{costomAmt02},</if>
            <if test="stlAmtDr != null">#{stlAmtDr},</if>
            <if test="costomAmt03 != null">#{costomAmt03},</if>
            <if test="stlDateDr != null">#{stlDateDr},</if>
            <if test="costomAmt04 != null">#{costomAmt04},</if>
            <if test="stlAmtCr != null">#{stlAmtCr},</if>
            <if test="costomAmt05 != null">#{costomAmt05},</if>
            <if test="stlDateCr != null">#{stlDateCr},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="costomAmt06 != null">#{costomAmt06},</if>
            <if test="costomStr01 != null">#{costomStr01},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="costomStr02 != null">#{costomStr02},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="accchkDateCr != null">#{accchkDateCr},</if>
            <if test="mBillNo != null">#{mBillNo},</if>
            <if test="billKind != null">#{billKind},</if>
            <if test="profitBill != null">#{profitBill},</if>
            <if test="profitCar != null">#{profitCar},</if>
            <if test="corpId != null">#{corpId},</if>
            <if test="invAmtCr != null">#{invAmtCr},</if>
            <if test="invAmtDr != null">#{invAmtDr},</if>
            <if test="invDateCr != null">#{invDateCr},</if>
            <if test="invDateDr != null">#{invDateDr},</if>
            <if test="accchkAmtCr != null">#{accchkAmtCr},</if>
            <if test="accchkAmtDr != null">#{accchkAmtDr},</if>
            <if test="accchkDateDr != null">#{accchkDateDr},</if>
        </trim>
    </insert>

    <insert id="insertftmsorderbillscarsTemporaryStorage" parameterType="ftmsorderbillscars" useGeneratedKeys="true" keyProperty="id">
        insert into F_TMSORDERBILLSCARS_MODIFY
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="pId != null">p_id,</if>
            <if test="orgId != null">org_id,</if>
            <if test="srcMId!= null">src_m_id,</if>
            <if test="orderNo != null">order_no,</if>
            <if test="cntrId != null">cntr_id,</if>
            <if test="cntrNo != null">cntr_no,</if>
            <if test="carcorPid != null">carcor_pid,</if>
            <if test="carregNo != null">carreg_no,</if>
            <if test="mblno != null">mblno,</if>
            <if test="driverName != null">driver_name,</if>
            <if test="driverTel != null">driver_tel,</if>
            <if test="driverUserId != null">driver_user_id,</if>
            <if test="planDate != null">plan_date,</if>
            <if test="planRemarks != null">plan_remarks,</if>
            <if test="acceptDate != null">accept_date,</if>
            <if test="acceptRemarks != null">accept_remarks,</if>
            <if test="loadDate != null">load_date,</if>
            <if test="loadRemarks != null">load_remarks,</if>
            <if test="mdLoadDate != null">md_load_date,</if>
            <if test="offData != null">off_data,</if>
            <if test="offRemarks != null">off_remarks,</if>
            <if test="mdLoadRemarks != null">md_load_remarks,</if>
            <if test="unLoadDate != null">un_load_date,</if>
            <if test="unLoadRemarks != null">un_load_remarks,</if>
            <if test="waybillDate != null">waybill_date,</if>
            <if test="qtyLoad != null">qty_load,</if>
            <if test="cntrQty != null">cntr_qty,</if>
            <if test="qtyUnLoad != null">qty_un_load,</if>
            <if test="cntrWeight != null">cntr_weight,</if>
            <if test="gopodsLossQty != null">gopods_loss_qty,</if>
            <if test="gopodsLossrate != null">gopods_lossrate,</if>
            <if test="gopodsLossamtCr != null">gopods_lossamt_cr,</if>
            <if test="qtyDr != null">qty_dr,</if>
            <if test="waybillRemarks != null">waybill_remarks,</if>
            <if test="gopodsLossamtDr != null">gopods_lossamt_dr,</if>
            <if test="qtyCr != null">qty_cr,</if>
            <if test="freightPriceDr != null">freight_price_dr,</if>
            <if test="freightPriceCr != null">freight_price_cr,</if>
            <if test="freightAmtDr != null">freight_amt_dr,</if>
            <if test="freightAmtCr != null">freight_amt_cr,</if>
            <if test="feeitemDr != null">feeitem_dr,</if>
            <if test="feeitemDrRemarks != null">feeitem_dr_remarks,</if>
            <if test="feeitemCr != null">feeitem_cr,</if>
            <if test="feeitemCrRemarks != null">feeitem_cr_remarks,</if>
            <if test="amtDr != null">amt_dr,</if>
            <if test="amtCr != null">amt_cr,</if>
            <if test="dueDateDr != null">due_date_dr,</if>
            <if test="dueDateCr != null">due_date_cr,</if>
            <if test="odometerFrom != null">odometer_from,</if>
            <if test="odometerEnd != null">odometer_end,</if>
            <if test="milesEmpty != null">miles_empty,</if>
            <if test="milesLoad != null">miles_load,</if>
            <if test="miles != null">miles,</if>
            <if test="driverbonus != null">driverbonus,</if>
            <if test="costtoll != null">costtoll,</if>
            <if test="costmaintain != null">costmaintain,</if>
            <if test="costOth != null">cost_oth,</if>
            <if test="costRemarks != null">cost_remarks,</if>
            <if test="oilQtyper != null">oil_qtyper,</if>
            <if test="oilQty1 != null">oil_qty1,</if>
            <if test="oilPrice1 != null">oil_price1,</if>
            <if test="oilAmt1 != null">oil_amt1,</if>
            <if test="oilQty2 != null">oil_qty2,</if>
            <if test="oilPrice2 != null">oil_price2,</if>
            <if test="oilAmt2 != null">oil_amt2,</if>
            <if test="oilQty != null">oil_qty,</if>
            <if test="oilPrice != null">oil_price,</if>
            <if test="oilAmt != null">oil_amt,</if>
            <if test="oilQtyBlc != null">oil_qty_blc,</if>
            <if test="oilAmtBlc != null">oil_amt_blc,</if>
            <if test="profit != null">profit,</if>
            <if test="invDrNeed != null">inv_dr_need,</if>
            <if test="invDrStatus != null">inv_dr_status,</if>
            <if test="invDrTaxrate != null">inv_dr_taxrate,</if>
            <if test="invDrTaxamt != null">inv_dr_taxamt,</if>
            <if test="invDrDate != null">inv_dr_date,</if>
            <if test="invDrNo != null">inv_dr_no,</if>
            <if test="accchkStaus != null">accchk_staus,</if>
            <if test="billStatus != null">bill_status,</if>
            <if test="orderStatus != null">order_status,</if>
            <if test="costomAmt01 != null">costom_amt_01,</if>
            <if test="costomAmt02 != null">costom_amt_02,</if>
            <if test="stlAmtDr != null">stl_amt_dr,</if>
            <if test="costomAmt03 != null">costom_amt_03,</if>
            <if test="stlDateDr != null">stl_date_dr,</if>
            <if test="costomAmt04 != null">costom_amt_04,</if>
            <if test="stlAmtCr != null">stl_amt_cr,</if>
            <if test="costomAmt05 != null">costom_amt_05,</if>
            <if test="stlDateCr != null">stl_date_cr,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="costomAmt06 != null">costom_amt_06,</if>
            <if test="costomStr01 != null">costom_str_01,</if>
            <if test="createBy != null">create_by,</if>
            <if test="costomStr02 != null">costom_str_02,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remarks != null">remarks,</if>
            <if test="accchkDateCr != null">accchk_date_cr,</if>
            <if test="mBillNo != null">m_bill_no,</if>
            <if test="billKind != null">bill_kind,</if>
            <if test="profitBill != null">profit_bill,</if>
            <if test="profitCar != null">profit_car,</if>
            <if test="corpId != null">corp_id,</if>
            <if test="invAmtCr != null">inv_amt_cr,</if>
            <if test="invAmtDr != null">inv_amt_dr,</if>
            <if test="invDateCr != null">inv_date_cr,</if>
            <if test="invDateDr != null">inv_date_dr,</if>
            <if test="accchkAmtCr != null">accchk_amt_cr,</if>
            <if test="accchkAmtDr != null">accchk_amt_dr,</if>
            <if test="accchkDateDr != null">accchk_date_dr,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="pId != null">#{pId},</if>
            <if test="orgId != null">#{orgId},</if>
            <if test="srcMId!= null">#{srcMId},</if>
            <if test="orderNo != null">#{orderNo},</if>
            <if test="cntrId != null">#{cntrId},</if>
            <if test="cntrNo != null">#{cntrNo},</if>
            <if test="carcorPid != null">#{carcorPid},</if>
            <if test="carregNo != null">#{carregNo},</if>
            <if test="mblno != null">#{mblno},</if>
            <if test="driverName != null">#{driverName},</if>
            <if test="driverTel != null">#{driverTel},</if>
            <if test="driverUserId != null">#{driverUserId},</if>
            <if test="planDate != null">#{planDate},</if>
            <if test="planRemarks != null">#{planRemarks},</if>
            <if test="acceptDate != null">#{acceptDate},</if>
            <if test="acceptRemarks != null">#{acceptRemarks},</if>
            <if test="loadDate != null">#{loadDate},</if>
            <if test="loadRemarks != null">#{loadRemarks},</if>
            <if test="mdLoadDate != null">#{mdLoadDate},</if>
            <if test="offData != null">#{offData},</if>
            <if test="offRemarks != null">#{offRemarks},</if>
            <if test="mdLoadRemarks != null">#{mdLoadRemarks},</if>
            <if test="unLoadDate != null">#{unLoadDate},</if>
            <if test="unLoadRemarks != null">#{unLoadRemarks},</if>
            <if test="waybillDate != null">#{waybillDate},</if>
            <if test="qtyLoad != null">#{qtyLoad},</if>
            <if test="cntrQty != null">#{cntrQty},</if>
            <if test="qtyUnLoad != null">#{qtyUnLoad},</if>
            <if test="cntrWeight != null">#{cntrWeight},</if>
            <if test="gopodsLossQty != null">#{gopodsLossQty},</if>
            <if test="gopodsLossrate != null">#{gopodsLossrate},</if>
            <if test="gopodsLossamtCr != null">#{gopodsLossamtCr},</if>
            <if test="qtyDr != null">#{qtyDr},</if>
            <if test="waybillRemarks != null">#{waybillRemarks},</if>
            <if test="gopodsLossamtDr != null">#{gopodsLossamtDr},</if>
            <if test="qtyCr != null">#{qtyCr},</if>
            <if test="freightPriceDr != null">#{freightPriceDr},</if>
            <if test="freightPriceCr != null">#{freightPriceCr},</if>
            <if test="freightAmtDr != null">#{freightAmtDr},</if>
            <if test="freightAmtCr != null">#{freightAmtCr},</if>
            <if test="feeitemDr != null">#{feeitemDr},</if>
            <if test="feeitemDrRemarks != null">#{feeitemDrRemarks},</if>
            <if test="feeitemCr != null">#{feeitemCr},</if>
            <if test="feeitemCrRemarks != null">#{feeitemCrRemarks},</if>
            <if test="amtDr != null">#{amtDr},</if>
            <if test="amtCr != null">#{amtCr},</if>
            <if test="dueDateDr != null">#{dueDateDr},</if>
            <if test="dueDateCr != null">#{dueDateCr},</if>
            <if test="odometerFrom != null">#{odometerFrom},</if>
            <if test="odometerEnd != null">#{odometerEnd},</if>
            <if test="milesEmpty != null">#{milesEmpty},</if>
            <if test="milesLoad != null">#{milesLoad},</if>
            <if test="miles != null">#{miles},</if>
            <if test="driverbonus != null">#{driverbonus},</if>
            <if test="costtoll != null">#{costtoll},</if>
            <if test="costmaintain != null">#{costmaintain},</if>
            <if test="costOth != null">#{costOth},</if>
            <if test="costRemarks != null">#{costRemarks},</if>
            <if test="oilQtyper != null">#{oilQtyper},</if>
            <if test="oilQty1 != null">#{oilQty1},</if>
            <if test="oilPrice1 != null">#{oilPrice1},</if>
            <if test="oilAmt1 != null">#{oilAmt1},</if>
            <if test="oilQty2 != null">#{oilQty2},</if>
            <if test="oilPrice2 != null">#{oilPrice2},</if>
            <if test="oilAmt2 != null">#{oilAmt2},</if>
            <if test="oilQty != null">#{oilQty},</if>
            <if test="oilPrice != null">#{oilPrice},</if>
            <if test="oilAmt != null">#{oilAmt},</if>
            <if test="oilQtyBlc != null">#{oilQtyBlc},</if>
            <if test="oilAmtBlc != null">#{oilAmtBlc},</if>
            <if test="profit != null">#{profit},</if>
            <if test="invDrNeed != null">#{invDrNeed},</if>
            <if test="invDrStatus != null">#{invDrStatus},</if>
            <if test="invDrTaxrate != null">#{invDrTaxrate},</if>
            <if test="invDrTaxamt != null">#{invDrTaxamt},</if>
            <if test="invDrDate != null">#{invDrDate},</if>
            <if test="invDrNo != null">#{invDrNo},</if>
            <if test="accchkStaus != null">#{accchkStaus},</if>
            <if test="billStatus != null">#{billStatus},</if>
            <if test="orderStatus != null">#{orderStatus},</if>
            <if test="costomAmt01 != null">#{costomAmt01},</if>
            <if test="costomAmt02 != null">#{costomAmt02},</if>
            <if test="stlAmtDr != null">#{stlAmtDr},</if>
            <if test="costomAmt03 != null">#{costomAmt03},</if>
            <if test="stlDateDr != null">#{stlDateDr},</if>
            <if test="costomAmt04 != null">#{costomAmt04},</if>
            <if test="stlAmtCr != null">#{stlAmtCr},</if>
            <if test="costomAmt05 != null">#{costomAmt05},</if>
            <if test="stlDateCr != null">#{stlDateCr},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="costomAmt06 != null">#{costomAmt06},</if>
            <if test="costomStr01 != null">#{costomStr01},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="costomStr02 != null">#{costomStr02},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remarks != null">#{remarks},</if>
            <if test="accchkDateCr != null">#{accchkDateCr},</if>
            <if test="mBillNo != null">#{mBillNo},</if>
            <if test="billKind != null">#{billKind},</if>
            <if test="profitBill != null">#{profitBill},</if>
            <if test="profitCar != null">#{profitCar},</if>
            <if test="corpId != null">#{corpId},</if>
            <if test="invAmtCr != null">#{invAmtCr},</if>
            <if test="invAmtDr != null">#{invAmtDr},</if>
            <if test="invDateCr != null">#{invDateCr},</if>
            <if test="invDateDr != null">#{invDateDr},</if>
            <if test="accchkAmtCr != null">#{accchkAmtCr},</if>
            <if test="accchkAmtDr != null">#{accchkAmtDr},</if>
            <if test="accchkDateDr != null">#{accchkDateDr},</if>
        </trim>
    </insert>

    <update id="updateftmsorderbillscars" parameterType="ftmsorderbillscars">
        update F_TMSORDERBILLSCARS
        <trim prefix="SET" suffixOverrides=",">
            m_bill_no = #{mBillNo},
            <if test="pId != null">p_id = #{pId},</if>
            <if test="orgId != null">org_id = #{orgId},</if>
            <if test="orderNo != null">order_no = #{orderNo},</if>
            <if test="cntrId != null">cntr_id = #{cntrId},</if>
            <if test="cntrNo != null">cntr_no = #{cntrNo},</if>
            <if test="carcorPid != null">carcor_pid = #{carcorPid},</if>
            <if test="carregNo != null">carreg_no = #{carregNo},</if>
            <if test="mblno != null">mblno = #{mblno},</if>
            <if test="driverName != null">driver_name = #{driverName},</if>
            <if test="driverTel != null">driver_tel = #{driverTel},</if>
            <if test="driverUserId != null">driver_user_id = #{driverUserId},</if>
            <if test="planDate != null">plan_date = #{planDate},</if>
            <if test="planRemarks != null">plan_remarks = #{planRemarks},</if>
            <if test="acceptDate != null">accept_date = #{acceptDate},</if>
            <if test="acceptRemarks != null">accept_remarks = #{acceptRemarks},</if>
            <if test="loadDate != null">load_date = #{loadDate},</if>
            <if test="loadRemarks != null">load_remarks = #{loadRemarks},</if>
            <if test="mdLoadDate != null">md_load_date = #{mdLoadDate},</if>
            <if test="offData != null">off_data = #{offData},</if>
            <if test="offRemarks != null">off_remarks = #{offRemarks},</if>
            <if test="mdLoadRemarks != null">md_load_remarks = #{mdLoadRemarks},</if>
            <if test="unLoadDate != null">un_load_date = #{unLoadDate},</if>
            <if test="unLoadRemarks != null">un_load_remarks = #{unLoadRemarks},</if>
            <if test="waybillDate != null">waybill_date = #{waybillDate},</if>
            <if test="qtyLoad != null">qty_load = #{qtyLoad},</if>
            <if test="cntrQty != null">cntr_qty = #{cntrQty},</if>
            <if test="qtyUnLoad != null">qty_un_load = #{qtyUnLoad},</if>
            <if test="cntrWeight != null">cntr_weight = #{cntrWeight},</if>
            <if test="gopodsLossQty != null">gopods_loss_qty = #{gopodsLossQty},</if>
            <if test="gopodsLossrate != null">gopods_lossrate = #{gopodsLossrate},</if>
            <if test="gopodsLossamtCr != null">gopods_lossamt_cr = #{gopodsLossamtCr},</if>
            <if test="qtyDr != null">qty_dr = #{qtyDr},</if>
            <if test="waybillRemarks != null">waybill_remarks = #{waybillRemarks},</if>
            <if test="gopodsLossamtDr != null">gopods_lossamt_dr = #{gopodsLossamtDr},</if>
            <if test="qtyCr != null">qty_cr = #{qtyCr},</if>
            <if test="freightPriceDr != null">freight_price_dr = #{freightPriceDr},</if>
            <if test="freightPriceCr != null">freight_price_cr = #{freightPriceCr},</if>
            <if test="freightAmtDr != null">freight_amt_dr = #{freightAmtDr},</if>
            <if test="freightAmtCr != null">freight_amt_cr = #{freightAmtCr},</if>
            <if test="feeitemDr != null">feeitem_dr = #{feeitemDr},</if>
            <if test="feeitemDrRemarks != null">feeitem_dr_remarks = #{feeitemDrRemarks},</if>
            <if test="feeitemCr != null">feeitem_cr = #{feeitemCr},</if>
            <if test="feeitemCrRemarks != null">feeitem_cr_remarks = #{feeitemCrRemarks},</if>
            <if test="amtDr != null">amt_dr = #{amtDr},</if>
            <if test="amtCr != null">amt_cr = #{amtCr},</if>
            <if test="dueDateDr != null">due_date_dr = #{dueDateDr},</if>
            <if test="dueDateCr != null">due_date_cr = #{dueDateCr},</if>
            <if test="odometerFrom != null">odometer_from = #{odometerFrom},</if>
            <if test="odometerEnd != null">odometer_end = #{odometerEnd},</if>
            <if test="milesEmpty != null">miles_empty = #{milesEmpty},</if>
            <if test="milesLoad != null">miles_load = #{milesLoad},</if>
            <if test="miles != null">miles = #{miles},</if>
            <if test="driverbonus != null">driverbonus = #{driverbonus},</if>
            <if test="costtoll != null">costtoll = #{costtoll},</if>
            <if test="costmaintain != null">costmaintain = #{costmaintain},</if>
            <if test="costOth != null">cost_oth = #{costOth},</if>
            <if test="costRemarks != null">cost_remarks = #{costRemarks},</if>
            <if test="oilQtyper != null">oil_qtyper = #{oilQtyper},</if>
            <if test="oilQty1 != null">oil_qty1 = #{oilQty1},</if>
            <if test="oilPrice1 != null">oil_price1 = #{oilPrice1},</if>
            <if test="oilAmt1 != null">oil_amt1 = #{oilAmt1},</if>
            <if test="oilQty2 != null">oil_qty2 = #{oilQty2},</if>
            <if test="oilPrice2 != null">oil_price2 = #{oilPrice2},</if>
            <if test="oilAmt2 != null">oil_amt2 = #{oilAmt2},</if>
            <if test="oilQty != null">oil_qty = #{oilQty},</if>
            <if test="oilPrice != null">oil_price = #{oilPrice},</if>
            <if test="oilAmt != null">oil_amt = #{oilAmt},</if>
            <if test="oilQtyBlc != null">oil_qty_blc = #{oilQtyBlc},</if>
            <if test="oilAmtBlc != null">oil_amt_blc = #{oilAmtBlc},</if>
            <if test="profit != null">profit = #{profit},</if>
            <if test="invDrNeed != null">inv_dr_need = #{invDrNeed},</if>
            <if test="invDrStatus != null">inv_dr_status = #{invDrStatus},</if>
            <if test="invDrTaxrate != null">inv_dr_taxrate = #{invDrTaxrate},</if>
            <if test="invDrTaxamt != null">inv_dr_taxamt = #{invDrTaxamt},</if>
            <if test="invDrDate != null">inv_dr_date = #{invDrDate},</if>
            <if test="invDrNo != null">inv_dr_no = #{invDrNo},</if>
            <if test="accchkStaus != null">accchk_staus = #{accchkStaus},</if>
            <if test="billStatus != null">bill_status = #{billStatus},</if>
            <if test="orderStatus != null">order_status = #{orderStatus},</if>
            <if test="costomAmt01 != null">costom_amt_01 = #{costomAmt01},</if>
            <if test="costomAmt02 != null">costom_amt_02 = #{costomAmt02},</if>
            <if test="stlAmtDr != null">stl_amt_dr = #{stlAmtDr},</if>
            <if test="costomAmt03 != null">costom_amt_03 = #{costomAmt03},</if>
            <if test="stlDateDr != null">stl_date_dr = #{stlDateDr},</if>
            <if test="costomAmt04 != null">costom_amt_04 = #{costomAmt04},</if>
            <if test="stlAmtCr != null">stl_amt_cr = #{stlAmtCr},</if>
            <if test="costomAmt05 != null">costom_amt_05 = #{costomAmt05},</if>
            <if test="stlDateCr != null">stl_date_cr = #{stlDateCr},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="costomAmt06 != null">costom_amt_06 = #{costomAmt06},</if>
            <if test="costomStr01 != null">costom_str_01 = #{costomStr01},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="costomStr02 != null">costom_str_02 = #{costomStr02},</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="remarks != null">remarks = #{remarks},</if>
            <if test="accchkDateCr != null">accchk_date_cr = #{accchkDateCr},</if>
            <if test="billKind != null">bill_kind = #{billKind},</if>
            <if test="profitBill != null">profit_bill = #{profitBill},</if>
            <if test="profitCar != null">profit_car = #{profitCar},</if>
            <if test="corpId != null">corp_id = #{corpId},</if>
            <if test="invAmtCr != null">inv_amt_cr = #{invAmtCr},</if>
            <if test="invAmtDr != null">inv_amt_dr = #{invAmtDr},</if>
            <if test="invDateCr != null">inv_date_cr = #{invDateCr},</if>
            <if test="invDateDr != null">inv_date_dr = #{invDateDr},</if>
            <if test="accchkAmtCr != null">accchk_amt_cr = #{accchkAmtCr},</if>
            <if test="accchkAmtDr != null">accchk_amt_dr = #{accchkAmtDr},</if>
            <if test="accchkDateDr != null">accchk_date_dr = #{accchkDateDr},</if>
        </trim>
        where id = #{id}
    </update>

    <update id="updateTmsorderCarStatusByOrgId" parameterType="ftmsorderbillscars">
        update F_TMSORDERBILLSCARS
        set bill_status = #{billStatus}
        where org_id = #{orgId}
    </update>

    <update id="updateftmsorderbillscarsDriverNamePhone">
        UPDATE F_TMSORDERBILLSCARS car
        LEFT JOIN sys_user u ON u.user_id = car.driver_user_id
        SET car.driver_name = u.nick_name,
        car.driver_tel = u.phonenumber
        WHERE
            car.driver_user_id IS NOT NULL
    </update>

    <update id="updateftmsorderbillscarTel" parameterType="ftmsorderbillscars">
        update F_TMSORDERBILLSCARS
        set driver_name = #{driverName}, driver_tel = #{driverTel}
        where driver_user_id = #{driverUserId} AND order_status &lt; 60
    </update>

    <delete id="deleteftmsorderbillscarsById" parameterType="Long">
        delete from F_TMSORDERBILLSCARS where id = #{id}
    </delete>

    <delete id="deleteftmsorderbillscarsByPId" parameterType="Long">
        delete from F_TMSORDERBILLSCARS where p_id = #{id}
    </delete>

    <delete id="deleteFollowUpBusinessByCarPId" parameterType="Long">
        DELETE f.*, c.*, a.* FROM F_TMSORDERBILLSCARS c
        LEFT JOIN F_TMSORDERBILLSFEES f ON f.f_pid = c.id
        LEFT JOIN F_TMSORDERBILLSATTACHS a ON a.p_id = c.id
        WHERE c.p_id = #{id}
    </delete>

    <delete id="deleteFollowUpBusinessByCarId" parameterType="Long">
        DELETE f.*, c.*, a.* FROM F_TMSORDERBILLSCARS c
        LEFT JOIN F_TMSORDERBILLSFEES f ON f.f_pid = c.id
        LEFT JOIN F_TMSORDERBILLSATTACHS a ON a.p_id = c.id
        WHERE c.id = #{id}
    </delete>

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

</mapper>