<?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.zbf.system.mapper.TRkWareNoticeBakMapper">

    <resultMap type="TRkWareNoticeBak" id="TRkWareNoticeBakResult">
            <result property="id"    column="id"    />
            <result property="noticeId"    column="notice_id"    />
            <result property="deliveryId"    column="delivery_id"    />
            <result property="providerId"    column="provider_id"    />
            <result property="providerName"    column="provider_name"    />
            <result property="purchaseId"    column="purchase_id"    />
            <result property="shippingDept"    column="shipping_dept"    />
            <result property="contact"    column="contact"    />
            <result property="telephone"    column="telephone"    />
            <result property="receiveAddr"    column="receive_addr"    />
            <result property="sendeDate"    column="sende_date"    />
            <result property="purchaseDept"    column="purchase_dept"    />
            <result property="remark"    column="remark"    />
            <result property="receivingArea"    column="receiving_area"    />
            <result property="useReceiver"    column="use_receiver"    />
            <result property="useCustodian"    column="use_custodian"    />
            <result property="useLeader"    column="use_leader"    />
            <result property="receiver"    column="receiver"    />
            <result property="applicant"    column="applicant"    />
            <result property="produclotId"    column="produclot_id"    />
            <result property="receiverDept"    column="receiver_dept"    />
            <result property="tenderer"    column="tenderer"    />
            <result property="operatorId"    column="operator_id"    />
            <result property="factoryId"    column="factory_id"    />
            <result property="storageMode"    column="storage_mode"    />
            <result property="status"    column="status"    />
            <result property="receivingStatus"    column="receiving_status"    />
            <result property="orderType"    column="order_type"    />
            <result property="createBy"    column="create_by"    />
            <result property="updateBy"    column="update_by"    />
            <result property="createTime"    column="create_time"    />
            <result property="updateTime"    column="update_time"    />
            <result property="deptId"    column="dept_id"    />
            <result property="isAvgExec"    column="is_avg_exec"    />
            <result property="recPerson"    column="rec_person"    />
            <result property="purchaser"    column="purchaser"    />
            <result property="arraDate"    column="arra_date"    />
            <result property="documentStatus"    column="document_status"    />
    </resultMap>

        <resultMap id="TRkWareNoticeBakTRkWareNoticeTabBakResult" type="TRkWareNoticeBak" extends="TRkWareNoticeBakResult">
            <collection property="tRkWareNoticeTabBakList" notNullColumn="sub_id" javaType="java.util.List" resultMap="TRkWareNoticeTabBakResult" />
        </resultMap>

        <resultMap type="TRkWareNoticeTabBak" id="TRkWareNoticeTabBakResult">
                <result property="id"    column="sub_id"    />
                <result property="salesOrderNumber"    column="sub_sales_order_number"    />
                <result property="noticeId"    column="sub_notice_id"    />
                <result property="goodsId"    column="sub_goods_id"    />
                <result property="goodsName"    column="sub_goods_name"    />
                <result property="unit"    column="sub_unit"    />
                <result property="specification"    column="sub_specification"    />
                <result property="recoil"    column="sub_recoil"    />
                <result property="brand"    column="sub_brand"    />
                <result property="price"    column="sub_price"    />
                <result property="totalMoney"    column="sub_total_money"    />
                <result property="arraMount"    column="sub_arra_mount"    />
                <result property="recNum"    column="sub_rec_num"    />
                <result property="project"    column="sub_project"    />
                <result property="needDept"    column="sub_need_dept"    />
                <result property="useType"    column="sub_use_type"    />
                <result property="scaleUnit"    column="sub_scale_unit"    />
                <result property="totalVolume"    column="sub_total_volume"    />
                <result property="totalRoughWeight"    column="sub_total_rough_weight"    />
                <result property="totalNetWeigh"    column="sub_total_net_weigh"    />
                <result property="amount"    column="sub_amount"    />
                <result property="productionDate"    column="sub_production_date"    />
                <result property="storageId"    column="sub_storage_id"    />
                <result property="storageAreaId"    column="sub_storage_area_id"    />
                <result property="packageId"    column="sub_package_id"    />
                <result property="remark"    column="sub_remark"    />
                <result property="goodsTypeId"    column="sub_goods_type_id"    />
                <result property="barcode"    column="sub_barcode"    />
                <result property="goodsVolume"    column="sub_goods_volume"    />
                <result property="printSts"    column="sub_print_sts"    />
                <result property="printCs"    column="sub_print_cs"    />
                <result property="netWeigh"    column="sub_net_weigh"    />
                <result property="kindNum"    column="sub_kind_num"    />
                <result property="expiryDate"    column="sub_expiry_date"    />
                <result property="operateDate"    column="sub_operate_date"    />
                <result property="productStatus"    column="sub_product_status"    />
                <result property="receivingStatus"    column="sub_receiving_status"    />
                <result property="inStatus"    column="sub_in_status"    />
                <result property="ctl"    column="sub_ctl"    />
                <result property="qualityInspectionDate"    column="sub_quality_inspection_date"    />
                <result property="status"    column="sub_status"    />
                <result property="acceNum"    column="sub_acce_num"    />
                <result property="qualityInspecStatus"    column="sub_quality_inspec_status"    />
                <result property="orderType"    column="sub_order_type"    />
                <result property="applicant"    column="sub_applicant"    />
                <result property="supplier"    column="sub_supplier"    />
                <result property="qualified"    column="sub_qualified"    />
                <result property="updateTime"    column="sub_update_time"    />
                <result property="planDate"    column="sub_plan_date"    />
                <result property="planTime"    column="sub_plan_time"    />
                <result property="needCycle"    column="sub_need_cycle"    />
                <result property="needType"    column="sub_need_type"    />
                <result property="batchNo"    column="sub_batch_no"    />
                <result property="reportTime"    column="sub_report_time"    />
                <result property="createTime"    column="sub_create_time"    />
                <result property="createBy"    column="sub_create_by"    />
                <result property="updateBy"    column="sub_update_by"    />
                <result property="levelType" column="sub_level_type"/>
                <result property="storageShortName"    column="sub_storage_short_name"    />
                <result property="storageLocation"    column="sub_storage_location"    />
                <result property="dataSource"    column="sub_data_source"    />
                <result property="totalArraAmout" column="sub_total_arra_amout"/>
                <result property="noTaxPrice" column="sub_no_tax_price"/>
                <result property="noTaxMoney" column="sub_no_tax_money"/>
                <result property="purchaseTaxRate" column="sub_purchase_tax_rate"/>
                <result property="purchaseTax" column="sub_purchase_tax"/>
                <result property="smartSelectionMode" column="sub_smart_selection_mode"/>
                <result property="independentAccounting" column="sub_independent_accounting"/>
                <result property="emphasisGoods" column="sub_emphasis_goods"/>
                <result property="expedited" column="sub_expedited"/>
                <result property="individualInvoicing" column="sub_individual_invoicing"/>
                <result property="rejectNum" column="sub_reject_num"/>
                <result property="attachments" column="sub_attachments"/>
                <result property="supplierAttachments" column="sub_supplier_attachments"/>
                <result property="invoiceTitle" column="sub_invoice_title"/>
                <result property="sourceNum" column="sub_source_num"/>
                <result property="needPerson"    column="sub_need_person"    />
                <result property="needTel"    column="sub_need_tel"    />
                <result property="purchaseId"    column="sub_purchase_id"    />
                <result property="purchaser"    column="sub_purchaser"    />
                <result property="recPerson"    column="sub_rec_person"    />
                <result property="providerName"    column="sub_provider_name"    />
                <result property="sendeDate"    column="sub_sende_date"    />
                <result property="receivingNum"    column="sub_receiving_num"    />
        </resultMap>

    <sql id="selectTRkWareNoticeBakVo">
        select id, notice_id, delivery_id, provider_id, provider_name, purchase_id, shipping_dept, contact, telephone, receive_addr, sende_date, purchase_dept, remark, receiving_area, use_receiver, use_custodian, use_leader, receiver, applicant, produclot_id, receiver_dept, tenderer, operator_id, factory_id, storage_mode, status, receiving_status, order_type, create_by, update_by, create_time, update_time,dept_id,is_avg_exec,rec_person,purchaser,arra_date,document_status  from t_rk_ware_notice_bak
    </sql>

    <select id="selectTRkWareNoticeBakList" parameterType="TRkWareNoticeBak" resultMap="TRkWareNoticeBakResult">
        <include refid="selectTRkWareNoticeBakVo"/>
        <where>
                        <if test="noticeId != null  and noticeId != ''"> and notice_id = #{noticeId}</if>
                        <if test="deliveryId != null  and deliveryId != ''"> and delivery_id = #{deliveryId}</if>
                        <if test="providerId != null  and providerId != ''"> and provider_id = #{providerId}</if>
                        <if test="providerName != null  and providerName != ''"> and provider_name like concat('%', #{providerName}, '%')</if>
                        <if test="purchaseId != null  and purchaseId != ''"> and purchase_id = #{purchaseId}</if>
                        <if test="shippingDept != null  and shippingDept != ''"> and shipping_dept = #{shippingDept}</if>
                        <if test="purchaseDept != null  and purchaseDept != ''"> and purchase_dept = #{purchaseDept}</if>
                        <if test="produclotId != null  and produclotId != ''"> and produclot_id = #{produclotId}</if>
                        <if test="receiverDept != null  and receiverDept != ''"> and receiver_dept = #{receiverDept}</if>
                        <if test="tenderer != null  and tenderer != ''"> and tenderer = #{tenderer}</if>
                        <if test="operatorId != null  and operatorId != ''"> and operator_id = #{operatorId}</if>
                        <if test="status != null  and status != ''"> and status = #{status}</if>
                        <if test="receivingStatus != null  and receivingStatus != ''"> and receiving_status = #{receivingStatus}</if>
        </where>
        order by create_time desc
    </select>

    <select id="selectTRkWareNoticeBakById" parameterType="String" resultMap="TRkWareNoticeBakTRkWareNoticeTabBakResult">
            select a.id, a.notice_id, a.delivery_id, a.provider_id, a.provider_name, a.purchase_id, a.shipping_dept, a.contact, a.telephone, a.receive_addr, a.sende_date, a.purchase_dept, a.remark, a.receiving_area, a.use_receiver, a.use_custodian, a.use_leader, a.receiver, a.applicant, a.produclot_id, a.receiver_dept, a.tenderer, a.operator_id, a.factory_id, a.storage_mode, a.status, a.receiving_status, a.order_type, a.create_by, a.update_by, a.create_time, a.update_time,a.dept_id,a.rec_person,a.is_avg_exec,a.purchaser,a.arra_date,a.document_status,
 b.id as sub_id, b.sales_order_number as sub_sales_order_number, b.notice_id as sub_notice_id, b.goods_id as sub_goods_id, b.goods_name as sub_goods_name, b.unit as sub_unit, b.specification as sub_specification, b.recoil as sub_recoil, b.brand as sub_brand, b.price as sub_price, b.total_money as sub_total_money, b.arra_mount as sub_arra_mount, b.rec_num as sub_rec_num, b.project as sub_project, b.need_dept as sub_need_dept, b.use_type as sub_use_type, b.scale_unit as sub_scale_unit, b.total_volume as sub_total_volume, b.total_rough_weight as sub_total_rough_weight, b.total_net_weigh as sub_total_net_weigh, b.amount as sub_amount, b.production_date as sub_production_date, b.storage_id as sub_storage_id, b.storage_area_id as sub_storage_area_id, b.package_id as sub_package_id, b.remark as sub_remark, b.goods_type_id as sub_goods_type_id, b.barcode as sub_barcode, b.goods_volume as sub_goods_volume, b.print_sts as sub_print_sts, b.print_cs as sub_print_cs, b.net_weigh as sub_net_weigh, b.kind_num as sub_kind_num, b.expiry_date as sub_expiry_date, b.operate_date as sub_operate_date, b.product_status as sub_product_status, b.receiving_status as sub_receiving_status, b.in_status as sub_in_status, b.ctl as sub_ctl, b.quality_inspection_date as sub_quality_inspection_date, b.status as sub_status, b.acce_num as sub_acce_num, b.quality_inspec_status as sub_quality_inspec_status, b.order_type as sub_order_type, b.applicant as sub_applicant, b.supplier as sub_supplier, b.qualified as sub_qualified, b.update_time as sub_update_time, b.plan_date as sub_plan_date, b.plan_time as sub_plan_time, b.need_cycle as sub_need_cycle, b.need_type as sub_need_type, b.batch_no as sub_batch_no, b.report_time as sub_report_time, b.create_time as sub_create_time, b.create_by as sub_create_by, b.update_by as sub_update_by, b.level_type as sub_level_type
 , b.storage_short_name as sub_storage_short_name, b.storage_location as sub_storage_location,b.data_source as sub_data_source,
                   b.total_arra_amout as sub_total_arra_amout,
                   b.no_tax_price as sub_no_tax_price,
                   b.no_tax_money as sub_no_tax_money,
                   b.purchase_tax_rate as sub_purchase_tax_rate,
                   b.purchase_tax as sub_purchase_tax,
                   b.smart_selection_mode as sub_smart_selection_mode,
                   b.independent_accounting as sub_independent_accounting,
                   b.emphasis_goods as sub_emphasis_goods,
                   b.expedited as sub_expedited,
                   b.individual_invoicing as sub_individual_invoicing,
                   b.reject_num as sub_reject_num,
                   b.attachments as sub_attachments,
                   b.supplier_attachments as sub_supplier_attachments,
                   b.invoice_title as sub_invoice_title,
                   b.source_num as sub_source_num,
                   b.need_person as sub_need_person,
                   b.need_tel as sub_need_tel,
                   b.purchase_id as sub_purchase_id,
                   b.purchaser as sub_purchaser,
                   b.rec_person as sub_rec_person,
                   b.provider_name as sub_provider_name,
                   b.sende_date as sub_sende_date,
                   b.receiving_num as sub_receiving_num

            from t_rk_ware_notice_bak a
            left join t_rk_ware_notice_tab_bak b on b.notice_id = a.id
            where a.id = #{id}
    </select>

    <select id="selectTRkWareNoticeBakByNoticeId" parameterType="String" resultMap="TRkWareNoticeBakTRkWareNoticeTabBakResult">
        select a.id, a.notice_id, a.delivery_id, a.provider_id, a.provider_name, a.purchase_id, a.shipping_dept, a.contact, a.telephone, a.receive_addr, a.sende_date, a.purchase_dept, a.remark, a.receiving_area, a.use_receiver, a.use_custodian, a.use_leader, a.receiver, a.applicant, a.produclot_id, a.receiver_dept, a.tenderer, a.operator_id, a.factory_id, a.storage_mode, a.status, a.receiving_status, a.order_type, a.create_by, a.update_by, a.create_time, a.update_time,a.dept_id,a.rec_person,a.is_avg_exec,a.purchaser,a.arra_date,a.document_status,
                b.id as sub_id, b.sales_order_number as sub_sales_order_number, b.notice_id as sub_notice_id, b.goods_id as sub_goods_id, b.goods_name as sub_goods_name, b.unit as sub_unit, b.specification as sub_specification, b.recoil as sub_recoil, b.brand as sub_brand, b.price as sub_price, b.total_money as sub_total_money, b.arra_mount as sub_arra_mount, b.rec_num as sub_rec_num, b.project as sub_project, b.need_dept as sub_need_dept, b.use_type as sub_use_type, b.scale_unit as sub_scale_unit, b.total_volume as sub_total_volume, b.total_rough_weight as sub_total_rough_weight, b.total_net_weigh as sub_total_net_weigh, b.amount as sub_amount, b.production_date as sub_production_date, b.storage_id as sub_storage_id, b.storage_area_id as sub_storage_area_id, b.package_id as sub_package_id, b.remark as sub_remark, b.goods_type_id as sub_goods_type_id, b.barcode as sub_barcode, b.goods_volume as sub_goods_volume, b.print_sts as sub_print_sts, b.print_cs as sub_print_cs, b.net_weigh as sub_net_weigh, b.kind_num as sub_kind_num, b.expiry_date as sub_expiry_date, b.operate_date as sub_operate_date, b.product_status as sub_product_status, b.receiving_status as sub_receiving_status, b.in_status as sub_in_status, b.ctl as sub_ctl, b.quality_inspection_date as sub_quality_inspection_date, b.status as sub_status, b.acce_num as sub_acce_num, b.quality_inspec_status as sub_quality_inspec_status, b.order_type as sub_order_type, b.applicant as sub_applicant, b.supplier as sub_supplier, b.qualified as sub_qualified, b.update_time as sub_update_time, b.plan_date as sub_plan_date, b.plan_time as sub_plan_time, b.need_cycle as sub_need_cycle, b.need_type as sub_need_type, b.batch_no as sub_batch_no, b.report_time as sub_report_time, b.create_time as sub_create_time, b.create_by as sub_create_by, b.update_by as sub_update_by, b.level_type as sub_level_type
                , b.storage_short_name as sub_storage_short_name, b.storage_location as sub_storage_location,b.data_source as sub_data_source,
               b.total_arra_amout as sub_total_arra_amout,
               b.no_tax_price as sub_no_tax_price,
               b.no_tax_money as sub_no_tax_money,
               b.purchase_tax_rate as sub_purchase_tax_rate,
               b.purchase_tax as sub_purchase_tax,
               b.smart_selection_mode as sub_smart_selection_mode,
               b.independent_accounting as sub_independent_accounting,
               b.emphasis_goods as sub_emphasis_goods,
               b.expedited as sub_expedited,
               b.individual_invoicing as sub_individual_invoicing,
               b.reject_num as sub_reject_num,
               b.attachments as sub_attachments,
               b.supplier_attachments as sub_supplier_attachments,
               b.invoice_title as sub_invoice_title,
               b.source_num as sub_source_num,
               b.need_person as sub_need_person,
               b.need_tel as sub_need_tel,
               b.purchase_id as sub_purchase_id,
               b.purchaser as sub_purchaser,
               b.rec_person as sub_rec_person,
               b.provider_name as sub_provider_name,
               b.sende_date as sub_sende_date,
               b.receiving_num as sub_receiving_num
        from t_rk_ware_notice_bak a
        left join t_rk_ware_notice_tab_bak b on b.notice_id = a.id
        where a.notice_id = #{id}
    </select>

    <insert id="insertTRkWareNoticeBak" parameterType="TRkWareNoticeBak">
        insert into t_rk_ware_notice_bak
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="id != null">id,</if>
                    <if test="noticeId != null">notice_id,</if>
                    <if test="deliveryId != null">delivery_id,</if>
                    <if test="providerId != null">provider_id,</if>
                    <if test="providerName != null">provider_name,</if>
                    <if test="purchaseId != null">purchase_id,</if>
                    <if test="shippingDept != null">shipping_dept,</if>
                    <if test="contact != null">contact,</if>
                    <if test="telephone != null">telephone,</if>
                    <if test="receiveAddr != null">receive_addr,</if>
                    <if test="sendeDate != null">sende_date,</if>
                    <if test="purchaseDept != null">purchase_dept,</if>
                    <if test="remark != null">remark,</if>
                    <if test="receivingArea != null">receiving_area,</if>
                    <if test="useReceiver != null">use_receiver,</if>
                    <if test="useCustodian != null">use_custodian,</if>
                    <if test="useLeader != null">use_leader,</if>
                    <if test="receiver != null">receiver,</if>
                    <if test="applicant != null">applicant,</if>
                    <if test="produclotId != null">produclot_id,</if>
                    <if test="receiverDept != null">receiver_dept,</if>
                    <if test="tenderer != null">tenderer,</if>
                    <if test="operatorId != null">operator_id,</if>
                    <if test="factoryId != null">factory_id,</if>
                    <if test="storageMode != null">storage_mode,</if>
                    <if test="status != null">status,</if>
                    <if test="receivingStatus != null">receiving_status,</if>
                    <if test="orderType != null">order_type,</if>
                    <if test="createBy != null">create_by,</if>
                    <if test="updateBy != null">update_by,</if>
                    <if test="createTime != null">create_time,</if>
                    <if test="updateTime != null">update_time,</if>
                    <if test="deptId != null">dept_id,</if>
                    <if test="isAvgExec != null">is_avg_exec,</if>
                    <if test="recPerson != null">rec_person,</if>
                    <if test="purchaser != null">purchaser,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test="id != null">#{id},</if>
                    <if test="noticeId != null">#{noticeId},</if>
                    <if test="deliveryId != null">#{deliveryId},</if>
                    <if test="providerId != null">#{providerId},</if>
                    <if test="providerName != null">#{providerName},</if>
                    <if test="purchaseId != null">#{purchaseId},</if>
                    <if test="shippingDept != null">#{shippingDept},</if>
                    <if test="contact != null">#{contact},</if>
                    <if test="telephone != null">#{telephone},</if>
                    <if test="receiveAddr != null">#{receiveAddr},</if>
                    <if test="sendeDate != null">#{sendeDate},</if>
                    <if test="purchaseDept != null">#{purchaseDept},</if>
                    <if test="remark != null">#{remark},</if>
                    <if test="receivingArea != null">#{receivingArea},</if>
                    <if test="useReceiver != null">#{useReceiver},</if>
                    <if test="useCustodian != null">#{useCustodian},</if>
                    <if test="useLeader != null">#{useLeader},</if>
                    <if test="receiver != null">#{receiver},</if>
                    <if test="applicant != null">#{applicant},</if>
                    <if test="produclotId != null">#{produclotId},</if>
                    <if test="receiverDept != null">#{receiverDept},</if>
                    <if test="tenderer != null">#{tenderer},</if>
                    <if test="operatorId != null">#{operatorId},</if>
                    <if test="factoryId != null">#{factoryId},</if>
                    <if test="storageMode != null">#{storageMode},</if>
                    <if test="status != null">#{status},</if>
                    <if test="receivingStatus != null">#{receivingStatus},</if>
                    <if test="orderType != null">#{orderType},</if>
                    <if test="createBy != null">#{createBy},</if>
                    <if test="updateBy != null">#{updateBy},</if>
                    <if test="createTime != null">#{createTime},</if>
                    <if test="updateTime != null">#{updateTime},</if>
                    <if test="deptId != null">#{deptId},</if>
                    <if test="isAvgExec != null">#{isAvgExec},</if>
                    <if test="recPerson != null">#{recPerson},</if>
                    <if test="purchaser != null">#{purchaser},</if>
        </trim>
    </insert>

    <update id="updateTRkWareNoticeBak" parameterType="TRkWareNoticeBak">
        update t_rk_ware_notice_bak
        <trim prefix="SET" suffixOverrides=",">
                    <if test="noticeId != null">notice_id = #{noticeId},</if>
                    <if test="deliveryId != null">delivery_id = #{deliveryId},</if>
                    <if test="providerId != null">provider_id = #{providerId},</if>
                    <if test="providerName != null">provider_name = #{providerName},</if>
                    <if test="purchaseId != null">purchase_id = #{purchaseId},</if>
                    <if test="shippingDept != null">shipping_dept = #{shippingDept},</if>
                    <if test="contact != null">contact = #{contact},</if>
                    <if test="telephone != null">telephone = #{telephone},</if>
                    <if test="receiveAddr != null">receive_addr = #{receiveAddr},</if>
                    <if test="sendeDate != null">sende_date = #{sendeDate},</if>
                    <if test="purchaseDept != null">purchase_dept = #{purchaseDept},</if>
                    <if test="remark != null">remark = #{remark},</if>
                    <if test="receivingArea != null">receiving_area = #{receivingArea},</if>
                    <if test="useReceiver != null">use_receiver = #{useReceiver},</if>
                    <if test="useCustodian != null">use_custodian = #{useCustodian},</if>
                    <if test="useLeader != null">use_leader = #{useLeader},</if>
                    <if test="receiver != null">receiver = #{receiver},</if>
                    <if test="applicant != null">applicant = #{applicant},</if>
                    <if test="produclotId != null">produclot_id = #{produclotId},</if>
                    <if test="receiverDept != null">receiver_dept = #{receiverDept},</if>
                    <if test="tenderer != null">tenderer = #{tenderer},</if>
                    <if test="operatorId != null">operator_id = #{operatorId},</if>
                    <if test="factoryId != null">factory_id = #{factoryId},</if>
                    <if test="storageMode != null">storage_mode = #{storageMode},</if>
                    <if test="status != null">status = #{status},</if>
                    <if test="receivingStatus != null">receiving_status = #{receivingStatus},</if>
                    <if test="orderType != null">order_type = #{orderType},</if>
                    <if test="createBy != null">create_by = #{createBy},</if>
                    <if test="updateBy != null">update_by = #{updateBy},</if>
                    <if test="createTime != null">create_time = #{createTime},</if>
                    <if test="updateTime != null">update_time = #{updateTime},</if>
                    <if test="deptId != null">dept_id = #{deptId},</if>
                    <if test="isAvgExec != null">is_avg_exec = #{isAvgExec},</if>
                    <if test="recPerson != null">rec_person = #{recPerson},</if>
                    <if test="purchaser != null">purchaser = #{purchaser},</if>

            </trim>
        where id = #{id}
    </update>

    <update id="enableTRkWareNoticeBakByIds" parameterType="String">
        update t_rk_ware_notice_bak set status=0 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
    <update id="disabledTRkWareNoticeBakByIds" parameterType="String">
        update t_rk_ware_notice_bak set status=1 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>

    <delete id="deleteTRkWareNoticeBakById" parameterType="String">
        delete from t_rk_ware_notice_bak  where id = #{id}
    </delete>

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

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

        <delete id="deleteTRkWareNoticeTabBakByNoticeId" parameterType="String">
            delete from t_rk_ware_notice_tab_bak where notice_id = #{noticeId}
        </delete>

        <insert id="batchTRkWareNoticeTabBak">
            insert into t_rk_ware_notice_tab_bak( id, sales_order_number, notice_id, goods_id, goods_name, unit, specification, recoil, brand, price, total_money, arra_mount, rec_num, project, need_dept, use_type, scale_unit, total_volume, total_rough_weight, total_net_weigh, amount, production_date, storage_id, storage_area_id, package_id, remark, goods_type_id, barcode, goods_volume, print_sts, print_cs, net_weigh, kind_num, expiry_date, operate_date, product_status, receiving_status, in_status, ctl, quality_inspection_date, status, acce_num, quality_inspec_status, order_type, applicant, supplier, qualified, update_time, plan_date, plan_time, need_cycle, need_type, batch_no, report_time, create_time, create_by, update_by, level_type, storage_short_name, storage_location,data_source,  no_tax_price,
            no_tax_money,
            purchase_tax_rate,
            purchase_tax,
            smart_selection_mode,
            invoice_title,
            independent_accounting,
            emphasis_goods,
            expedited,
            individual_invoicing,
            reject_num,
            attachments,
            supplier_attachments,
            source_num,
            need_person,
            need_tel,
            total_arra_amout,
            purchase_id,
            purchaser,
            rec_person,
            provider_name,
            sende_date,
            receiving_num
              ) values
            <foreach item="item" index="index" collection="list" separator=",">
                ( #{item.id}, #{item.salesOrderNumber}, #{item.noticeId}, #{item.goodsId}, #{item.goodsName}, #{item.unit}, #{item.specification}, #{item.recoil}, #{item.brand}, #{item.price}, #{item.totalMoney}, #{item.arraMount}, #{item.recNum}, #{item.project}, #{item.needDept}, #{item.useType}, #{item.scaleUnit}, #{item.totalVolume}, #{item.totalRoughWeight}, #{item.totalNetWeigh}, #{item.amount}, #{item.productionDate}, #{item.storageId}, #{item.storageAreaId}, #{item.packageId}, #{item.remark}, #{item.goodsTypeId}, #{item.barcode}, #{item.goodsVolume}, #{item.printSts}, #{item.printCs}, #{item.netWeigh}, #{item.kindNum}, #{item.expiryDate}, #{item.operateDate}, #{item.productStatus}, #{item.receivingStatus}, #{item.inStatus}, #{item.ctl}, #{item.qualityInspectionDate}, #{item.status}, #{item.acceNum}, #{item.qualityInspecStatus}, #{item.orderType}, #{item.applicant}, #{item.supplier}, #{item.qualified}, #{item.updateTime}, #{item.planDate}, #{item.planTime}, #{item.needCycle}, #{item.needType}, #{item.batchNo}, #{item.reportTime}, #{item.createTime}, #{item.createBy}, #{item.updateBy}, #{item.levelType}, #{item.storageShortName}, #{item.storageLocation}, #{item.dataSource},#{item.noTaxPrice},
                 #{item.noTaxMoney},
                 #{item.purchaseTaxRate},
                 #{item.purchaseTax},
                 #{item.smartSelectionMode},
                 #{item.invoiceTitle},
                 #{item.independentAccounting},
                 #{item.emphasisGoods},
                 #{item.expedited},
                 #{item.individualInvoicing},
                 #{item.rejectNum},
                 #{item.attachments},
                 #{item.supplierAttachments},
                 #{item.sourceNum},
                 #{item.needPerson},
                 #{item.needTel},
                 #{item.totalArraAmout},
                #{item.purchaseId},
                #{item.purchaser},
                #{item.recPerson},
                #{item.providerName},
                #{item.sendeDate},
                #{item.receivingNum}
                )
            </foreach>
        </insert>
</mapper>
