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

    <resultMap type="TCkPickingwavegoodsBak" id="TCkPickingwavegoodsBakResult">
            <result property="id"    column="id"    />
            <result property="pickingId"    column="picking_id"    />
            <result property="putinId"    column="putin_id"    />
            <result property="doctNumber"    column="doct_number"    />
            <result property="goodsId"    column="goods_id"    />
            <result property="locId"    column="loc_id"    />
            <result property="goodsNum"    column="goods_num"    />
            <result property="specification"    column="specification"    />
            <result property="productionDate"    column="production_date"    />
            <result property="wareDate"    column="ware_date"    />
            <result property="providerId"    column="provider_id"    />
            <result property="unit"    column="unit"    />
            <result property="remark"    column="remark"    />
            <result property="outId"    column="out_id"    />
            <result property="scaleUnit"    column="scale_unit"    />
            <result property="mistockNum"    column="mistock_num"    />
            <result property="pickingNum"    column="picking_num"    />
            <result property="price"    column="price"    />
            <result property="storageAreaId"    column="storage_area_id"    />
            <result property="storageId"    column="storage_id"    />
            <result property="ctl"    column="ctl"    />
            <result property="ckType"    column="ck_type"    />
            <result property="status"    column="status"    />
            <result property="outstand"    column="outstand"    />
            <result property="goodsName"    column="goods_name"    />
            <result property="plcId"    column="plc_id"    />
            <result property="barcode"    column="barcode"    />
            <result property="produclotId"    column="produclot_id"    />
            <result property="toLoc"    column="to_loc"    />
            <result property="operatorId"    column="operator_id"    />
            <result property="shelvesNum"    column="shelves_num"    />
            <result property="locationId"    column="location_id"    />
            <result property="recNum"    column="rec_num"    />
            <result property="productId"    column="product_id"    />
            <result property="callShelvesNum"    column="call_shelves_num"    />
            <result property="salesOrderNo"    column="sales_order_no"    />
            <result property="salesOrderNumber"    column="sales_order_number"    />
            <result property="supplier"    column="supplier"    />
            <result property="decId"    column="dec_id"    />
            <result property="updateTime"    column="update_time"    />
            <result property="recoil"    column="recoil"    />
            <result property="operateDate"    column="operate_date"    />
            <result property="batchNo"    column="batch_no"    />
            <result property="customerId"    column="customer_id"    />
            <result property="createTime"    column="create_time"    />
            <result property="createBy"    column="create_by"    />
            <result property="updateBy"    column="update_by"    />
            <result property="reportTime"    column="report_time"    />
            <result property="purchaseId"    column="purchase_id"    />
            <result property="applicant"    column="applicant"    />
            <result property="respDept"    column="resp_dept"    />
            <result property="planDate"    column="plan_date"    />
            <result property="planTime"    column="plan_time"    />
            <result property="needCycle"    column="need_cycle"    />
            <result property="needType"    column="need_type"    />
            <result property="goodsTypeId"    column="goods_type_id"    />
            <result property="brand"    column="brand"    />
            <result property="totalMoney"    column="total_money"    />
            <result property="expiryDate"    column="expiry_date"    />
            <result property="providerName"    column="provider_name"    />
            <result property="receiver"    column="receiver"    />
            <result property="needDept"    column="need_dept"    />
            <result property="purchaseDept"    column="purchase_dept"    />
            <result property="receiverDept"    column="receiver_dept"    />
            <result property="receivingArea"    column="receiving_area"    />
            <result property="packageId"    column="package_id"    />
            <result property="useType"    column="use_type"    />
            <result property="telephone"    column="telephone"    />
            <result property="totalVolume"    column="total_volume"    />
            <result property="totalRoughWeight"    column="total_rough_weight"    />
            <result property="totalNetWeigh"    column="total_net_weigh"    />
            <result property="defaultStorageAreaId"    column="default_storage_area_id"    />
            <result property="qualityInspecStatus"    column="quality_inspec_status"    />
            <result property="periodUnit"    column="period_unit"    />
            <result property="period"    column="period"    />
            <result property="wgh"    column="wgh"    />
            <result property="high"    column="high"    />
           <result property="confirmStatus"    column="confirm_status"    />
           <result property="deptId"    column="dept_id"    />
            <result property="abc"    column="abc"    />
            <result property="levelType"    column="level_type"    />
            <result property="callNoticeId" column="call_notice_id"/>
            <result property="storageShortName" column="storage_short_name"/>
    </resultMap>

    <sql id="selectTCkPickingwavegoodsBakVo">
        select id, picking_id, putin_id, doct_number, goods_id, loc_id, goods_num, specification, production_date, ware_date, provider_id, unit, remark, out_id, scale_unit, mistock_num, picking_num, price, storage_area_id, storage_id, ctl, ck_type, status, outstand, goods_name, plc_id, barcode, produclot_id, to_loc, operator_id, shelves_num, location_id, rec_num, product_id, call_shelves_num, sales_order_no, sales_order_number, supplier, dec_id, update_time, recoil, operate_date, batch_no, customer_id, create_time, create_by, update_by, report_time, purchase_id, applicant, resp_dept, plan_date, plan_time, need_cycle, need_type, goods_type_id, brand, total_money, expiry_date, provider_name, receiver, need_dept, purchase_dept, receiver_dept, receiving_area, package_id, use_type, telephone, total_volume, total_rough_weight, total_net_weigh, default_storage_area_id, quality_inspec_status, period_unit, period, wgh, high, confirm_status,dept_id,abc,level_type,call_notice_id,storage_short_name from t_ck_pickingwavegoods_bak
    </sql>

    <select id="selectTCkPickingwavegoodsBakList" parameterType="TCkPickingwavegoodsBak" resultMap="TCkPickingwavegoodsBakResult">
        select * from t_ck_pickingwavegoods_bak
        <where>
            <if test="pickingId != null  and pickingId != ''"> and picking_id = #{pickingId}</if>
            <if test="putinId != null  and putinId != ''"> and putin_id = #{putinId}</if>
            <if test="doctNumber != null  and doctNumber != ''"> and doct_number = #{doctNumber}</if>
            <if test="goodsId != null  and goodsId != ''"> and goods_id = #{goodsId}</if>
            <if test="locId != null  and locId != ''"> and loc_id = #{locId}</if>
            <if test="specification != null  and specification != ''"> and specification = #{specification}</if>
            <if test="outId != null  and outId != ''"> and out_id = #{outId}</if>
            <if test="storageAreaId != null  and storageAreaId != ''"> and storage_area_id = #{storageAreaId}</if>
            <if test="storageId != null  and storageId != ''"> and storage_id = #{storageId}</if>
            <if test="storageShortName != null  and storageShortName != ''"> and storage_short_name like concat('%', #{storageShortName}, '%')</if>
            <if test="ctl != null  and ctl != ''"> and ctl = #{ctl}</if>
            <if test="ckType != null  and ckType != ''"> and ck_type = #{ckType}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="goodsName != null  and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
            <if test="salesOrderNumber != null  and salesOrderNumber != ''"> and sales_order_number = #{salesOrderNumber}</if>
            <if test="batchNo != null  and batchNo != ''"> and batch_no = #{batchNo}</if>
            <if test="confirmStatus != null  and confirmStatus != ''"> and confirm_status = #{confirmStatus}</if>
            <if test="abc != null  and abc != ''">and abc = #{abc}</if>
            <if test="levelType != null  and levelType != ''">and level_type = #{levelType}</if>
            <if test="wareDate != null  and wareDate != ''">and ware_date =#{wareDate}</if>
            <if test="startTime != null and endTime != ''">
                and create_time BETWEEN #{startTime} AND #{endTime}
            </if>
            <if test="callNoticeId != null and callNoticeId != ''">and call_notice_id = #{callNoticeId}</if>
            ${params.dataScope}
        </where>
        order by create_time desc
    </select>

    <select id="selectTCkPickingwavegoodsBakById" parameterType="String" resultMap="TCkPickingwavegoodsBakResult">
            <include refid="selectTCkPickingwavegoodsBakVo"/>
            where id = #{id}
    </select>

    <insert id="insertTCkPickingwavegoodsBak" parameterType="TCkPickingwavegoodsBak">
        insert into t_ck_pickingwavegoods_bak
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="id != null">id,</if>
                    <if test="pickingId != null">picking_id,</if>
                    <if test="putinId != null">putin_id,</if>
                    <if test="doctNumber != null">doct_number,</if>
                    <if test="goodsId != null">goods_id,</if>
                    <if test="locId != null">loc_id,</if>
                    <if test="goodsNum != null">goods_num,</if>
                    <if test="specification != null">specification,</if>
                    <if test="productionDate != null">production_date,</if>
                    <if test="wareDate != null">ware_date,</if>
                    <if test="providerId != null">provider_id,</if>
                    <if test="unit != null">unit,</if>
                    <if test="remark != null">remark,</if>
                    <if test="outId != null">out_id,</if>
                    <if test="scaleUnit != null">scale_unit,</if>
                    <if test="mistockNum != null">mistock_num,</if>
                    <if test="pickingNum != null">picking_num,</if>
                    <if test="price != null">price,</if>
                    <if test="storageAreaId != null">storage_area_id,</if>
                    <if test="storageId != null">storage_id,</if>
                    <if test="ctl != null">ctl,</if>
                    <if test="ckType != null">ck_type,</if>
                    <if test="status != null">status,</if>
                    <if test="outstand != null">outstand,</if>
                    <if test="goodsName != null">goods_name,</if>
                    <if test="plcId != null">plc_id,</if>
                    <if test="barcode != null">barcode,</if>
                    <if test="produclotId != null">produclot_id,</if>
                    <if test="toLoc != null">to_loc,</if>
                    <if test="operatorId != null">operator_id,</if>
                    <if test="shelvesNum != null">shelves_num,</if>
                    <if test="locationId != null">location_id,</if>
                    <if test="recNum != null">rec_num,</if>
                    <if test="productId != null">product_id,</if>
                    <if test="callShelvesNum != null">call_shelves_num,</if>
                    <if test="salesOrderNo != null">sales_order_no,</if>
                    <if test="salesOrderNumber != null">sales_order_number,</if>
                    <if test="supplier != null">supplier,</if>
                    <if test="decId != null">dec_id,</if>
                    <if test="updateTime != null">update_time,</if>
                    <if test="recoil != null">recoil,</if>
                    <if test="operateDate != null">operate_date,</if>
                    <if test="batchNo != null">batch_no,</if>
                    <if test="customerId != null">customer_id,</if>
                    <if test="createTime != null">create_time,</if>
                    <if test="createBy != null">create_by,</if>
                    <if test="updateBy != null">update_by,</if>
                    <if test="reportTime != null">report_time,</if>
                    <if test="purchaseId != null">purchase_id,</if>
                    <if test="applicant != null">applicant,</if>
                    <if test="respDept != null">resp_dept,</if>
                    <if test="planDate != null">plan_date,</if>
                    <if test="planTime != null">plan_time,</if>
                    <if test="needCycle != null">need_cycle,</if>
                    <if test="needType != null">need_type,</if>
                    <if test="goodsTypeId != null">goods_type_id,</if>
                    <if test="brand != null">brand,</if>
                    <if test="totalMoney != null">total_money,</if>
                    <if test="expiryDate != null">expiry_date,</if>
                    <if test="providerName != null">provider_name,</if>
                    <if test="receiver != null">receiver,</if>
                    <if test="needDept != null">need_dept,</if>
                    <if test="purchaseDept != null">purchase_dept,</if>
                    <if test="receiverDept != null">receiver_dept,</if>
                    <if test="receivingArea != null">receiving_area,</if>
                    <if test="packageId != null">package_id,</if>
                    <if test="useType != null">use_type,</if>
                    <if test="telephone != null">telephone,</if>
                    <if test="totalVolume != null">total_volume,</if>
                    <if test="totalRoughWeight != null">total_rough_weight,</if>
                    <if test="totalNetWeigh != null">total_net_weigh,</if>
                    <if test="defaultStorageAreaId != null">default_storage_area_id,</if>
                    <if test="qualityInspecStatus != null">quality_inspec_status,</if>
                    <if test="periodUnit != null">period_unit,</if>
                    <if test="period != null">period,</if>
                    <if test="wgh != null">wgh,</if>
                    <if test="high != null">high,</if>
                    <if test="confirmStatus != null">confirm_status,</if>
                    <if test="deptId != null">dept_id,</if>
                    <if test="abc != null">abc,</if>
                    <if test="levelType != null">level_type,</if>
                    <if test="callNoticeId != null">call_notice_id,</if>
                    <if test="storageShortName != null">storage_short_name,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test="id != null">#{id},</if>
                    <if test="pickingId != null">#{pickingId},</if>
                    <if test="putinId != null">#{putinId},</if>
                    <if test="doctNumber != null">#{doctNumber},</if>
                    <if test="goodsId != null">#{goodsId},</if>
                    <if test="locId != null">#{locId},</if>
                    <if test="goodsNum != null">#{goodsNum},</if>
                    <if test="specification != null">#{specification},</if>
                    <if test="productionDate != null">#{productionDate},</if>
                    <if test="wareDate != null">#{wareDate},</if>
                    <if test="providerId != null">#{providerId},</if>
                    <if test="unit != null">#{unit},</if>
                    <if test="remark != null">#{remark},</if>
                    <if test="outId != null">#{outId},</if>
                    <if test="scaleUnit != null">#{scaleUnit},</if>
                    <if test="mistockNum != null">#{mistockNum},</if>
                    <if test="pickingNum != null">#{pickingNum},</if>
                    <if test="price != null">#{price},</if>
                    <if test="storageAreaId != null">#{storageAreaId},</if>
                    <if test="storageId != null">#{storageId},</if>
                    <if test="ctl != null">#{ctl},</if>
                    <if test="ckType != null">#{ckType},</if>
                    <if test="status != null">#{status},</if>
                    <if test="outstand != null">#{outstand},</if>
                    <if test="goodsName != null">#{goodsName},</if>
                    <if test="plcId != null">#{plcId},</if>
                    <if test="barcode != null">#{barcode},</if>
                    <if test="produclotId != null">#{produclotId},</if>
                    <if test="toLoc != null">#{toLoc},</if>
                    <if test="operatorId != null">#{operatorId},</if>
                    <if test="shelvesNum != null">#{shelvesNum},</if>
                    <if test="locationId != null">#{locationId},</if>
                    <if test="recNum != null">#{recNum},</if>
                    <if test="productId != null">#{productId},</if>
                    <if test="callShelvesNum != null">#{callShelvesNum},</if>
                    <if test="salesOrderNo != null">#{salesOrderNo},</if>
                    <if test="salesOrderNumber != null">#{salesOrderNumber},</if>
                    <if test="supplier != null">#{supplier},</if>
                    <if test="decId != null">#{decId},</if>
                    <if test="updateTime != null">#{updateTime},</if>
                    <if test="recoil != null">#{recoil},</if>
                    <if test="operateDate != null">#{operateDate},</if>
                    <if test="batchNo != null">#{batchNo},</if>
                    <if test="customerId != null">#{customerId},</if>
                    <if test="createTime != null">#{createTime},</if>
                    <if test="createBy != null">#{createBy},</if>
                    <if test="updateBy != null">#{updateBy},</if>
                    <if test="reportTime != null">#{reportTime},</if>
                    <if test="purchaseId != null">#{purchaseId},</if>
                    <if test="applicant != null">#{applicant},</if>
                    <if test="respDept != null">#{respDept},</if>
                    <if test="planDate != null">#{planDate},</if>
                    <if test="planTime != null">#{planTime},</if>
                    <if test="needCycle != null">#{needCycle},</if>
                    <if test="needType != null">#{needType},</if>
                    <if test="goodsTypeId != null">#{goodsTypeId},</if>
                    <if test="brand != null">#{brand},</if>
                    <if test="totalMoney != null">#{totalMoney},</if>
                    <if test="expiryDate != null">#{expiryDate},</if>
                    <if test="providerName != null">#{providerName},</if>
                    <if test="receiver != null">#{receiver},</if>
                    <if test="needDept != null">#{needDept},</if>
                    <if test="purchaseDept != null">#{purchaseDept},</if>
                    <if test="receiverDept != null">#{receiverDept},</if>
                    <if test="receivingArea != null">#{receivingArea},</if>
                    <if test="packageId != null">#{packageId},</if>
                    <if test="useType != null">#{useType},</if>
                    <if test="telephone != null">#{telephone},</if>
                    <if test="totalVolume != null">#{totalVolume},</if>
                    <if test="totalRoughWeight != null">#{totalRoughWeight},</if>
                    <if test="totalNetWeigh != null">#{totalNetWeigh},</if>
                    <if test="defaultStorageAreaId != null">#{defaultStorageAreaId},</if>
                    <if test="qualityInspecStatus != null">#{qualityInspecStatus},</if>
                    <if test="periodUnit != null">#{periodUnit},</if>
                    <if test="period != null">#{period},</if>
                    <if test="wgh != null">#{wgh},</if>
                    <if test="high != null">#{high},</if>
                    <if test="confirmStatus != null">#{confirmStatus},</if>
                    <if test="deptId != null">#{deptId},</if>
                    <if test="abc != null">#{abc},</if>
                    <if test="levelType != null">#{levelType},</if>
                    <if test="callNoticeId != null">#{callNoticeId},</if>
                    <if test="storageShortName != null">#{storageShortName},</if>
        </trim>
    </insert>

    <update id="updateTCkPickingwavegoodsBak" parameterType="TCkPickingwavegoodsBak">
        update t_ck_pickingwavegoods_bak
        <trim prefix="SET" suffixOverrides=",">
            <if test="pickingId != null">picking_id = #{pickingId},</if>
            <if test="putinId != null">putin_id = #{putinId},</if>
            <if test="doctNumber != null">doct_number = #{doctNumber},</if>
            <if test="goodsId != null">goods_id = #{goodsId},</if>
            <if test="locId != null">loc_id = #{locId},</if>
            <if test="goodsNum != null">goods_num = #{goodsNum},</if>
            <if test="specification != null">specification = #{specification},</if>
            <if test="productionDate != null">production_date = #{productionDate},</if>
            <if test="wareDate != null">ware_date = #{wareDate},</if>
            <if test="providerId != null">provider_id = #{providerId},</if>
            <if test="unit != null">unit = #{unit},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="outId != null">out_id = #{outId},</if>
            <if test="scaleUnit != null">scale_unit = #{scaleUnit},</if>
            <if test="mistockNum != null">mistock_num = #{mistockNum},</if>
            <if test="pickingNum != null">picking_num = #{pickingNum},</if>
            <if test="price != null">price = #{price},</if>
            <if test="storageAreaId != null">storage_area_id = #{storageAreaId},</if>
            <if test="ctl != null">ctl = #{ctl},</if>
            <if test="ckType != null">ck_type = #{ckType},</if>
            <if test="status != null">status = #{status},</if>
            <if test="outstand != null">outstand = #{outstand},</if>
            <if test="goodsName != null">goods_name = #{goodsName},</if>
            <if test="plcId != null">plc_id = #{plcId},</if>
            <if test="barcode != null">barcode = #{barcode},</if>
            <if test="produclotId != null">produclot_id = #{produclotId},</if>
            <if test="toLoc != null">to_loc = #{toLoc},</if>
            <if test="operatorId != null">operator_id = #{operatorId},</if>
            <if test="shelvesNum != null">shelves_num = #{shelvesNum},</if>
            <if test="locationId != null">location_id = #{locationId},</if>
            <if test="recNum != null">rec_num = #{recNum},</if>
            <if test="productId != null">product_id = #{productId},</if>
            <if test="callShelvesNum != null">call_shelves_num = #{callShelvesNum},</if>
            <if test="salesOrderNo != null">sales_order_no = #{salesOrderNo},</if>
            <if test="salesOrderNumber != null">sales_order_number = #{salesOrderNumber},</if>
            <if test="supplier != null">supplier = #{supplier},</if>
            <if test="decId != null">dec_id = #{decId},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="recoil != null">recoil = #{recoil},</if>
            <if test="operateDate != null">operate_date = #{operateDate},</if>
            <if test="batchNo != null">batch_no = #{batchNo},</if>
            <if test="customerId != null">customer_id = #{customerId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="reportTime != null">report_time = #{reportTime},</if>
            <if test="purchaseId != null">purchase_id = #{purchaseId},</if>
            <if test="applicant != null">applicant = #{applicant},</if>
            <if test="respDept != null">resp_dept = #{respDept},</if>
            <if test="planDate != null">plan_date = #{planDate},</if>
            <if test="planTime != null">plan_time = #{planTime},</if>
            <if test="needCycle != null">need_cycle = #{needCycle},</if>
            <if test="needType != null">need_type = #{needType},</if>
            <if test="goodsTypeId != null">goods_type_id = #{goodsTypeId},</if>
            <if test="brand != null">brand = #{brand},</if>
            <if test="totalMoney != null">total_money = #{totalMoney},</if>
            <if test="expiryDate != null">expiry_date = #{expiryDate},</if>
            <if test="providerName != null">provider_name = #{providerName},</if>
            <if test="receiver != null">receiver = #{receiver},</if>
            <if test="needDept != null">need_dept = #{needDept},</if>
            <if test="purchaseDept != null">purchase_dept = #{purchaseDept},</if>
            <if test="receiverDept != null">receiver_dept = #{receiverDept},</if>
            <if test="receivingArea != null">receiving_area = #{receivingArea},</if>
            <if test="packageId != null">package_id = #{packageId},</if>
            <if test="useType != null">use_type = #{useType},</if>
            <if test="telephone != null">telephone = #{telephone},</if>
            <if test="totalVolume != null">total_volume = #{totalVolume},</if>
            <if test="totalRoughWeight != null">total_rough_weight = #{totalRoughWeight},</if>
            <if test="totalNetWeigh != null">total_net_weigh = #{totalNetWeigh},</if>
            <if test="defaultStorageAreaId != null">default_storage_area_id = #{defaultStorageAreaId},</if>
            <if test="qualityInspecStatus != null">quality_inspec_status = #{qualityInspecStatus},</if>
            <if test="periodUnit != null">period_unit = #{periodUnit},</if>
            <if test="period != null">period = #{period},</if>
            <if test="wgh != null">wgh = #{wgh},</if>
            <if test="high != null">high = #{high},</if>
            <if test="abc != null">abc = #{abc},</if>
            <if test="levelType != null">level_type = #{levelType},</if>
            <if test="confirmStatus != null">confirm_status = #{confirmStatus},</if>
            <if test="storageShortName != null">storage_short_name = #{storageShortName},</if>
        </trim>
        where id = #{id}
    </update>

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

    <delete id="deleteTCkPickingwavegoodsBakById" parameterType="String">
        delete from t_ck_pickingwavegoods_bak  where id = #{id}
    </delete>

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