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

    <resultMap type="TOngoodsshelf" id="TOngoodsshelfResult">
            <result property="id"    column="id"    />
            <result property="lotId"    column="lot_id"    />
            <result property="goodsId"    column="goods_id"    />
            <result property="providerId"    column="provider_id"    />
            <result property="locationId"    column="location_id"    />
            <result property="stoNum"    column="sto_num"    />
            <result property="ctl"    column="ctl"    />
            <result property="recoil"    column="recoil"    />
            <result property="accNum"    column="acc_num"    />
            <result property="stockNum"    column="stock_num"    />
            <result property="ondate"    column="ondate"    />
            <result property="receiver"    column="receiver"    />
            <result property="storageId"    column="storage_id"    />
            <result property="storageAreaId"    column="storage_area_id"    />
            <result property="operatorId"    column="operator_id"    />
            <result property="storageMode"    column="storage_mode"    />
            <result property="goodsVolume"    column="goods_volume"    />
            <result property="barcode"    column="barcode"    />
            <result property="customerId"    column="customer_id"    />
            <result property="remark"    column="remark"    />
            <result property="needDept"    column="need_dept"    />
            <result property="produclotId"    column="produclot_id"    />
            <result property="unit"    column="unit"    />
            <result property="respDept"    column="resp_dept"    />
            <result property="plcId"    column="plc_id"    />
            <result property="supplier"    column="supplier"    />
            <result property="goodsName"    column="goods_name"    />
            <result property="instand"    column="instand"    />
            <result property="brand"    column="brand"    />
            <result property="taskType"    column="task_type"    />
            <result property="applicant"    column="applicant"    />
            <result property="packingNum"    column="packing_num"    />
            <result property="damageNum"    column="damage_num"    />
            <result property="purchaseDept"    column="purchase_dept"    />
            <result property="price"    column="price"    />
            <result property="scaleUnit"    column="scale_unit"    />
            <result property="totalVolume"    column="total_volume"    />
            <result property="totalRoughWeight"    column="total_rough_weight"    />
            <result property="totalNetWeigh"    column="total_net_weigh"    />
            <result property="totalMoney"    column="total_money"    />
            <result property="acceId"    column="acce_id"    />
            <result property="inStatus"    column="in_status"    />
            <result property="flag"    column="flag"    />
            <result property="standard"    column="standard"    />
            <result property="innerBatchNo"    column="inner_batch_no"    />
            <result property="printCs"    column="print_cs"    />
            <result property="printSts"    column="print_sts"    />
            <result property="purchaseType"    column="purchase_type"    />
            <result property="manualTrayState"    column="manual_tray_state"    />
            <result property="spec"    column="spec"    />
            <result property="wmsOrderId"    column="wms_order_id"    />
            <result property="batchNo"    column="batch_no"    />
            <result property="damageLocation"    column="damage_location"    />
            <result property="status"    column="status"    />
            <result property="updateTime"    column="update_time"    />
            <result property="specification"    column="specification"    />
            <result property="goodsTypeId"    column="goods_type_id"    />
            <result property="operateDate"    column="operate_date"    />
            <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="expiryDate"    column="expiry_date"    />
            <result property="providerName"    column="provider_name"    />
            <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="productionDate"    column="production_date"    />
            <result property="wgh"    column="wgh"    />
            <result property="high"    column="high"    />
            <result property="createTime"    column="create_time"    />
            <result property="createBy"    column="create_by"    />
            <result property="updateBy"    column="update_by"    />
            <result property="qualityInspecStatus"    column="quality_inspec_status"    />
            <result property="periodUnit"    column="period_unit"    />
            <result property="period"    column="period"    />
            <result property="reportTime"    column="report_time"    />
            <result property="salesOrderNumber"    column="sales_order_number"    />
             <result property="deptId"    column="dept_id"    />
            <result property="noticeTabId"    column="notice_tab_id"    />
            <result property="abc"    column="abc"    />
            <result property="levelType"    column="level_type"    />
            <result property="virtuallyLocation"    column="virtually_location"    />
            <result property="callNoticeId"    column="call_notice_id"    />
            <result property="storageShortName"    column="storage_short_name"    />
            <result property="needPerson"    column="need_person"    />
            <result property="needTel"    column="need_tel"    />
            <result property="rfidTid"    column="rfid_tid"    />
            <result property="rfidEpc"    column="rfid_epc"    />
    </resultMap>

    <sql id="selectTOngoodsshelfVo">
        select id, lot_id, goods_id, provider_id, location_id, sto_num, ctl, recoil, acc_num, stock_num, ondate, receiver, storage_id, storage_area_id, operator_id, storage_mode, goods_volume, barcode, customer_id, remark, need_dept, produclot_id, unit, resp_dept, plc_id, supplier, goods_name, instand, brand, task_type, applicant, packing_num, damage_num, purchase_dept, price, scale_unit, total_volume, total_rough_weight, total_net_weigh, total_money, acce_id, in_status, flag, standard, inner_batch_no, print_cs, print_sts, purchase_type, manual_tray_state, spec, wms_order_id, batch_no, damage_location, status, update_time, specification, goods_type_id, operate_date, plan_date, plan_time, need_cycle, need_type, expiry_date, provider_name, receiver_dept, receiving_area, package_id, use_type, telephone, production_date, wgh, high, create_time, create_by, update_by, quality_inspec_status, period_unit, period, report_time, sales_order_number,dept_id, notice_tab_id,abc,level_type, virtually_location, call_notice_id,storage_short_name,need_person,need_tel,rfid_tid,rfid_tid,rfid_epc from t_ongoodsshelf d
    </sql>

    <select id="selectTOngoodsshelfList" parameterType="TOngoodsshelf" resultMap="TOngoodsshelfResult">
        <include refid="selectTOngoodsshelfVo"/>
        <where>
            <if test="lotId != null  and lotId != ''"> and lot_id = #{lotId}</if>
            <if test="goodsId != null  and goodsId != ''"> and goods_id = #{goodsId}</if>
            <if test="providerId != null  and providerId != ''"> and provider_id = #{providerId}</if>
            <if test="recoil != null  and recoil != ''"> and recoil = #{recoil}</if>
            <if test="storageAreaId != null  and storageAreaId != ''"> and storage_area_id = #{storageAreaId}</if>
            <if test="needDept != null  and needDept != ''"> and need_dept = #{needDept}</if>
            <if test="produclotId != null  and produclotId != ''"> and produclot_id = #{produclotId}</if>
            <if test="respDept != null  and respDept != ''"> and resp_dept = #{respDept}</if>
            <if test="supplier != null  and supplier != ''"> and supplier = #{supplier}</if>
            <if test="goodsName != null  and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
            <if test="brand != null  and brand != ''"> and brand = #{brand}</if>
            <if test="taskType != null  and taskType != ''"> and task_type = #{taskType}</if>
            <if test="applicant != null  and applicant != ''"> and applicant = #{applicant}</if>
            <if test="purchaseDept != null  and purchaseDept != ''"> and purchase_dept = #{purchaseDept}</if>
            <if test="purchaseType != null "> and purchase_type = #{purchaseType}</if>
            <if test="batchNo != null  and batchNo != ''"> and batch_no = #{batchNo}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            <if test="providerName != null  and providerName != ''"> and provider_name like concat('%', #{providerName}, '%')</if>
            <if test="receiverDept != null  and receiverDept != ''"> and receiver_dept = #{receiverDept}</if>
            <if test="telephone != null  and telephone != ''"> and telephone = #{telephone}</if>
            <if test="salesOrderNumber != null  and salesOrderNumber != ''"> and sales_order_number = #{salesOrderNumber}</if>
            <if test="noticeTabId != null  and noticeTabId != ''"> and notice_tab_id = #{noticeTabId}</if>
            <if test="inStatus != null  and inStatus != ''"> and in_status = #{inStatus}</if>
            <if test="ctl != null  and ctl != ''"> and ctl = #{ctl}</if>
            <if test="plcId != null  and plcId != ''"> and plc_id = #{plcId}</if>
            <if test="abc != null  and abc != ''">and abc = #{abc}</if>
            <if test="levelType != null  and levelType != ''">and level_type = #{levelType}</if>
            <if test="virtuallyLocation != null and virtuallyLocation != ''"> and virtually_location = #{virtuallyLocation}</if>
            <choose>
                <when test="storageList != null  and storageList.size > 0">
                    and storage_id in
                    <foreach item="storageId" collection="storageList" open="(" separator="," close=")">
                        #{storageId}
                    </foreach>
                </when>
                <when test="storageId != null  and storageId != ''">and storage_id = #{storageId}</when>
            </choose>
            <if test="callNoticeId != null  and callNoticeId != ''">and call_notice_id = #{callNoticeId}</if>
            ${params.dataScope}
        </where>
        order by create_time desc
    </select>

    <select id="selectTOngoodsshelfById" parameterType="String" resultMap="TOngoodsshelfResult">
            <include refid="selectTOngoodsshelfVo"/>
            where id = #{id}
    </select>
    <select id="selecttOngoodsshelvesPlcList"  resultMap="TOngoodsshelfResult">
        <include refid="selectTOngoodsshelfVo"/>
        where status = '0' AND plc_id is null
    </select>
    <update id="updatePlcId" parameterType="TOngoodsshelf">
        update t_ongoodsshelf
        set  plc_id = #{plcId},
             in_status = '2'
        <where>
            <if test="inStatus != null">and in_status = #{inStatus}</if>
            <if test="ctl != null">and ctl = #{ctl}</if>
            <if test="locationId != null">and location_id = #{locationId}</if>
        </where>
    </update>
    <insert id="insertTOngoodsshelf" parameterType="TOngoodsshelf">
        insert into t_ongoodsshelf
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="id != null">id,</if>
                    <if test="lotId != null">lot_id,</if>
                    <if test="goodsId != null">goods_id,</if>
                    <if test="providerId != null">provider_id,</if>
                    <if test="locationId != null">location_id,</if>
                    <if test="stoNum != null">sto_num,</if>
                    <if test="ctl != null">ctl,</if>
                    <if test="recoil != null">recoil,</if>
                    <if test="accNum != null">acc_num,</if>
                    <if test="stockNum != null">stock_num,</if>
                    <if test="ondate != null">ondate,</if>
                    <if test="receiver != null">receiver,</if>
                    <if test="storageId != null">storage_id,</if>
                    <if test="storageAreaId != null">storage_area_id,</if>
                    <if test="operatorId != null">operator_id,</if>
                    <if test="storageMode != null">storage_mode,</if>
                    <if test="goodsVolume != null">goods_volume,</if>
                    <if test="barcode != null">barcode,</if>
                    <if test="customerId != null">customer_id,</if>
                    <if test="remark != null">remark,</if>
                    <if test="needDept != null">need_dept,</if>
                    <if test="produclotId != null">produclot_id,</if>
                    <if test="unit != null">unit,</if>
                    <if test="respDept != null">resp_dept,</if>
                    <if test="plcId != null">plc_id,</if>
                    <if test="supplier != null">supplier,</if>
                    <if test="goodsName != null">goods_name,</if>
                    <if test="instand != null">instand,</if>
                    <if test="brand != null">brand,</if>
                    <if test="taskType != null">task_type,</if>
                    <if test="applicant != null">applicant,</if>
                    <if test="packingNum != null">packing_num,</if>
                    <if test="damageNum != null">damage_num,</if>
                    <if test="purchaseDept != null">purchase_dept,</if>
                    <if test="price != null">price,</if>
                    <if test="scaleUnit != null">scale_unit,</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="totalMoney != null">total_money,</if>
                    <if test="acceId != null">acce_id,</if>
                    <if test="inStatus != null">in_status,</if>
                    <if test="flag != null">flag,</if>
                    <if test="standard != null">standard,</if>
                    <if test="innerBatchNo != null">inner_batch_no,</if>
                    <if test="printCs != null">print_cs,</if>
                    <if test="printSts != null">print_sts,</if>
                    <if test="purchaseType != null">purchase_type,</if>
                    <if test="manualTrayState != null">manual_tray_state,</if>
                    <if test="spec != null">spec,</if>
                    <if test="wmsOrderId != null">wms_order_id,</if>
                    <if test="batchNo != null">batch_no,</if>
                    <if test="damageLocation != null">damage_location,</if>
                    <if test="status != null">status,</if>
                    <if test="updateTime != null">update_time,</if>
                    <if test="specification != null">specification,</if>
                    <if test="goodsTypeId != null">goods_type_id,</if>
                    <if test="operateDate != null">operate_date,</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="expiryDate != null">expiry_date,</if>
                    <if test="providerName != null">provider_name,</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="productionDate != null">production_date,</if>
                    <if test="wgh != null">wgh,</if>
                    <if test="high != null">high,</if>
                    <if test="createTime != null">create_time,</if>
                    <if test="createBy != null">create_by,</if>
                    <if test="updateBy != null">update_by,</if>
                    <if test="qualityInspecStatus != null">quality_inspec_status,</if>
                    <if test="periodUnit != null">period_unit,</if>
                    <if test="period != null">period,</if>
                    <if test="reportTime != null">report_time,</if>
                    <if test="salesOrderNumber != null">sales_order_number,</if>
                    <if test="deptId != null">dept_id,</if>
                    <if test="noticeTabId != null">notice_tab_id,</if>
                    <if test="abc != null">abc,</if>
                    <if test="levelType != null">level_type,</if>
                    <if test="virtuallyLocation != null">virtually_location,</if>
                    <if test="callNoticeId != null">call_notice_id,</if>
                    <if test="storageShortName != null">storage_short_name,</if>
                    <if test="needPerson != null">need_person,</if>
                    <if test="needTel != null">need_tel,</if>
                    <if test="rfidTid != null">rfid_tid,</if>
                    <if test="rfidEpc != null">rfid_epc,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test="id != null">#{id},</if>
                    <if test="lotId != null">#{lotId},</if>
                    <if test="goodsId != null">#{goodsId},</if>
                    <if test="providerId != null">#{providerId},</if>
                    <if test="locationId != null">#{locationId},</if>
                    <if test="stoNum != null">#{stoNum},</if>
                    <if test="ctl != null">#{ctl},</if>
                    <if test="recoil != null">#{recoil},</if>
                    <if test="accNum != null">#{accNum},</if>
                    <if test="stockNum != null">#{stockNum},</if>
                    <if test="ondate != null">#{ondate},</if>
                    <if test="receiver != null">#{receiver},</if>
                    <if test="storageId != null">#{storageId},</if>
                    <if test="storageAreaId != null">#{storageAreaId},</if>
                    <if test="operatorId != null">#{operatorId},</if>
                    <if test="storageMode != null">#{storageMode},</if>
                    <if test="goodsVolume != null">#{goodsVolume},</if>
                    <if test="barcode != null">#{barcode},</if>
                    <if test="customerId != null">#{customerId},</if>
                    <if test="remark != null">#{remark},</if>
                    <if test="needDept != null">#{needDept},</if>
                    <if test="produclotId != null">#{produclotId},</if>
                    <if test="unit != null">#{unit},</if>
                    <if test="respDept != null">#{respDept},</if>
                    <if test="plcId != null">#{plcId},</if>
                    <if test="supplier != null">#{supplier},</if>
                    <if test="goodsName != null">#{goodsName},</if>
                    <if test="instand != null">#{instand},</if>
                    <if test="brand != null">#{brand},</if>
                    <if test="taskType != null">#{taskType},</if>
                    <if test="applicant != null">#{applicant},</if>
                    <if test="packingNum != null">#{packingNum},</if>
                    <if test="damageNum != null">#{damageNum},</if>
                    <if test="purchaseDept != null">#{purchaseDept},</if>
                    <if test="price != null">#{price},</if>
                    <if test="scaleUnit != null">#{scaleUnit},</if>
                    <if test="totalVolume != null">#{totalVolume},</if>
                    <if test="totalRoughWeight != null">#{totalRoughWeight},</if>
                    <if test="totalNetWeigh != null">#{totalNetWeigh},</if>
                    <if test="totalMoney != null">#{totalMoney},</if>
                    <if test="acceId != null">#{acceId},</if>
                    <if test="inStatus != null">#{inStatus},</if>
                    <if test="flag != null">#{flag},</if>
                    <if test="standard != null">#{standard},</if>
                    <if test="innerBatchNo != null">#{innerBatchNo},</if>
                    <if test="printCs != null">#{printCs},</if>
                    <if test="printSts != null">#{printSts},</if>
                    <if test="purchaseType != null">#{purchaseType},</if>
                    <if test="manualTrayState != null">#{manualTrayState},</if>
                    <if test="spec != null">#{spec},</if>
                    <if test="wmsOrderId != null">#{wmsOrderId},</if>
                    <if test="batchNo != null">#{batchNo},</if>
                    <if test="damageLocation != null">#{damageLocation},</if>
                    <if test="status != null">#{status},</if>
                    <if test="updateTime != null">#{updateTime},</if>
                    <if test="specification != null">#{specification},</if>
                    <if test="goodsTypeId != null">#{goodsTypeId},</if>
                    <if test="operateDate != null">#{operateDate},</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="expiryDate != null">#{expiryDate},</if>
                    <if test="providerName != null">#{providerName},</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="productionDate != null">#{productionDate},</if>
                    <if test="wgh != null">#{wgh},</if>
                    <if test="high != null">#{high},</if>
                    <if test="createTime != null">#{createTime},</if>
                    <if test="createBy != null">#{createBy},</if>
                    <if test="updateBy != null">#{updateBy},</if>
                    <if test="qualityInspecStatus != null">#{qualityInspecStatus},</if>
                    <if test="periodUnit != null">#{periodUnit},</if>
                    <if test="period != null">#{period},</if>
                    <if test="reportTime != null">#{reportTime},</if>
                    <if test="salesOrderNumber != null">#{salesOrderNumber},</if>
                    <if test="deptId != null">#{deptId},</if>
                    <if test="noticeTabId != null">#{noticeTabId},</if>
                    <if test="abc != null">#{abc},</if>
                    <if test="levelType != null">#{levelType},</if>
                    <if test="virtuallyLocation != null">#{virtuallyLocation},</if>
                    <if test="callNoticeId != null">#{callNoticeId},</if>
                    <if test="storageShortName != null">#{storageShortName},</if>
                    <if test="needPerson != null">#{needPerson},</if>
                    <if test="needTel != null">#{needTel},</if>
                    <if test="rfidTid != null">#{rfidTid},</if>
                    <if test="rfidEpc != null">#{rfidEpc},</if>
        </trim>
    </insert>

    <update id="updateTOngoodsshelf" parameterType="TOngoodsshelf">
        update t_ongoodsshelf
        <trim prefix="SET" suffixOverrides=",">
                    <if test="lotId != null">lot_id = #{lotId},</if>
                    <if test="goodsId != null">goods_id = #{goodsId},</if>
                    <if test="providerId != null">provider_id = #{providerId},</if>
                    <if test="locationId != null">location_id = #{locationId},</if>
                    <if test="stoNum != null">sto_num = #{stoNum},</if>
                    <if test="ctl != null">ctl = #{ctl},</if>
                    <if test="recoil != null">recoil = #{recoil},</if>
                    <if test="accNum != null">acc_num = #{accNum},</if>
                    <if test="stockNum != null">stock_num = #{stockNum},</if>
                    <if test="ondate != null">ondate = #{ondate},</if>
                    <if test="receiver != null">receiver = #{receiver},</if>
                    <if test="storageId != null">storage_id = #{storageId},</if>
                    <if test="storageAreaId != null">storage_area_id = #{storageAreaId},</if>
                    <if test="operatorId != null">operator_id = #{operatorId},</if>
                    <if test="storageMode != null">storage_mode = #{storageMode},</if>
                    <if test="goodsVolume != null">goods_volume = #{goodsVolume},</if>
                    <if test="barcode != null">barcode = #{barcode},</if>
                    <if test="customerId != null">customer_id = #{customerId},</if>
                    <if test="remark != null">remark = #{remark},</if>
                    <if test="needDept != null">need_dept = #{needDept},</if>
                    <if test="produclotId != null">produclot_id = #{produclotId},</if>
                    <if test="unit != null">unit = #{unit},</if>
                    <if test="respDept != null">resp_dept = #{respDept},</if>
                    <if test="plcId != null">plc_id = #{plcId},</if>
                    <if test="supplier != null">supplier = #{supplier},</if>
                    <if test="goodsName != null">goods_name = #{goodsName},</if>
                    <if test="instand != null">instand = #{instand},</if>
                    <if test="brand != null">brand = #{brand},</if>
                    <if test="taskType != null">task_type = #{taskType},</if>
                    <if test="applicant != null">applicant = #{applicant},</if>
                    <if test="packingNum != null">packing_num = #{packingNum},</if>
                    <if test="damageNum != null">damage_num = #{damageNum},</if>
                    <if test="purchaseDept != null">purchase_dept = #{purchaseDept},</if>
                    <if test="price != null">price = #{price},</if>
                    <if test="scaleUnit != null">scale_unit = #{scaleUnit},</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="totalMoney != null">total_money = #{totalMoney},</if>
                    <if test="acceId != null">acce_id = #{acceId},</if>
                    <if test="inStatus != null">in_status = #{inStatus},</if>
                    <if test="flag != null">flag = #{flag},</if>
                    <if test="standard != null">standard = #{standard},</if>
                    <if test="innerBatchNo != null">inner_batch_no = #{innerBatchNo},</if>
                    <if test="printCs != null">print_cs = #{printCs},</if>
                    <if test="printSts != null">print_sts = #{printSts},</if>
                    <if test="purchaseType != null">purchase_type = #{purchaseType},</if>
                    <if test="manualTrayState != null">manual_tray_state = #{manualTrayState},</if>
                    <if test="spec != null">spec = #{spec},</if>
                    <if test="wmsOrderId != null">wms_order_id = #{wmsOrderId},</if>
                    <if test="batchNo != null">batch_no = #{batchNo},</if>
                    <if test="damageLocation != null">damage_location = #{damageLocation},</if>
                    <if test="status != null">status = #{status},</if>
                    <if test="updateTime != null">update_time = #{updateTime},</if>
                    <if test="specification != null">specification = #{specification},</if>
                    <if test="goodsTypeId != null">goods_type_id = #{goodsTypeId},</if>
                    <if test="operateDate != null">operate_date = #{operateDate},</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="expiryDate != null">expiry_date = #{expiryDate},</if>
                    <if test="providerName != null">provider_name = #{providerName},</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="productionDate != null">production_date = #{productionDate},</if>
                    <if test="wgh != null">wgh = #{wgh},</if>
                    <if test="high != null">high = #{high},</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="qualityInspecStatus != null">quality_inspec_status = #{qualityInspecStatus},</if>
                    <if test="periodUnit != null">period_unit = #{periodUnit},</if>
                    <if test="period != null">period = #{period},</if>
                    <if test="reportTime != null">report_time = #{reportTime},</if>
                    <if test="salesOrderNumber != null">sales_order_number = #{salesOrderNumber},</if>
                    <if test="deptId != null">dept_id = #{deptId},</if>
                    <if test="noticeTabId != null">notice_tab_id = #{noticeTabId},</if>
                    <if test="abc != null">abc = #{abc},</if>
                    <if test="levelType != null">level_type = #{levelType},</if>
                    <if test="storageShortName != null">storage_short_name = #{storageShortName},</if>
                    <if test="needPerson != null">need_person = #{needPerson},</if>
                    <if test="needTel != null">need_tel = #{needTel},</if>
        </trim>
        where id = #{id}
    </update>

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

    <delete id="deleteTOngoodsshelfById" parameterType="String">
        delete from t_ongoodsshelf  where id = #{id}
    </delete>

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

    <select id="counts" parameterType="string" resultType="map">
        SELECT d.plc_id AS 'key', COUNT(*) AS 'value'
        FROM t_ongoodsshelf d
        WHERE d.status in (0,1)
            ${params.dataScope}
        GROUP BY d.plc_id
    </select>
</mapper>
