<?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.bonus.canteen.core.supply.purchase.mapper.DrpDeliveryGoodsMapper">
    <update id="plusInspectTotalNum">
        update drp_delivery_goods set inspect_total_num = IFNULL(inspect_total_num,0) + #{plusNum} where delivery_goods_id = #{deliveryGoodsId}
    </update>

<!--    <select id="importDeliveryGoods" resultType="net.xnzn.core.drp.vo.DrpImportDeliveryGoodsVO">-->
<!--        SELECT-->
<!--            a.delivery_goods_id,-->
<!--            a.supplier_id,-->
<!--            b.supplier_name,-->
<!--            a.supplier_goods_amount,-->
<!--            a.arrival_time,-->
<!--            a.if_into,-->
<!--            a.delivery_man,-->
<!--            a.delivery_phone,-->
<!--            a.delivery_address,-->
<!--            a.delivery_warehouse_id,-->
<!--            c.warehouse_name deliveryWarehouseName,-->
<!--            a.delivery_total_num-->
<!--        FROM-->
<!--            drp_delivery_goods a-->
<!--            LEFT JOIN drp_supplier b ON b.supplier_id = a.supplier_id-->
<!--            LEFT JOIN drp_warehouse c ON c.warehouse_id = a.delivery_warehouse_id-->
<!--        <where>-->
<!--            b.`status` = #{supplierStatus}-->
<!--            <if test="content.startDate != null">-->
<!--                and a.arrival_time <![CDATA[ >= ]]> #{content.startDate}-->
<!--            </if>-->
<!--            <if test="content.endDate != null">-->
<!--                and a.arrival_time <![CDATA[ <= ]]> #{content.endDate}-->
<!--            </if>-->
<!--            <if test="content.deliveryGoodsId != null and content.deliveryGoodsId != ''">-->
<!--                and a.delivery_goods_id = #{content.deliveryGoodsId}-->
<!--            </if>-->
<!--            <if test="content.supplierId != null">-->
<!--                and a.supplier_id = #{content.supplierId}-->
<!--            </if>-->
<!--            <if test="content.ifInto != null">-->
<!--                and a.if_into = #{content.ifInto}-->
<!--            </if>-->
<!--        </where>-->
<!--    </select>-->
<!--    <select id="listSupplierDeliveryGoods" resultType="net.xnzn.core.drp.vo.DrpDeliveryGoodsPageVO">-->
<!--        SELECT a.order_goods_id,-->
<!--               a.delivery_goods_id,-->
<!--               a.supplier_id,-->
<!--               b.supplier_name,-->
<!--               a.arrival_time,-->
<!--               a.supplier_goods_amount,-->
<!--               a.delivery_man,-->
<!--               a.delivery_phone,-->
<!--               a.delivery_address,-->
<!--               a.delivery_warehouse_id,-->
<!--               c.warehouse_name deliveryWarehouseName,-->
<!--               a.delivery_total_num,-->
<!--               a.delivery_id,-->
<!--               a.canteen_id,-->
<!--               ac.canteen_name,-->
<!--               a.stall_id,-->
<!--               ast.stall_name,-->
<!--               aa.area_name,-->
<!--               ac.area_id,-->
<!--               a.crtime-->
<!--        FROM drp_delivery_goods a-->
<!--                 LEFT JOIN drp_supplier b ON b.supplier_id = a.supplier_id-->
<!--                 LEFT JOIN drp_warehouse c ON c.warehouse_id = a.delivery_warehouse_id-->
<!--                 left join alloc_canteen ac on ac.canteen_id = a.canteen_id-->
<!--                 left join alloc_stall ast on ast.stall_id = a.stall_id-->
<!--                 left join alloc_area aa on aa.area_id = ast.area_id-->
<!--        <where>-->
<!--            <if test="supplierAuthority != null">-->
<!--                and a.supplier_id = #{supplierAuthority}-->
<!--            </if>-->
<!--            <if test="content.startDate != null">-->
<!--                and a.arrival_time <![CDATA[ >= ]]> #{content.startDate}-->
<!--            </if>-->
<!--            <if test="content.endDate != null">-->
<!--                and a.arrival_time <![CDATA[ <= ]]> #{content.endDate}-->
<!--            </if>-->
<!--            <if test="content.deliveryGoodsId != null and content.deliveryGoodsId != ''">-->
<!--                and a.delivery_goods_id = #{content.deliveryGoodsId}-->
<!--            </if>-->
<!--            <if test="content.orderGoodsId != null and content.orderGoodsId != ''">-->
<!--                and a.order_goods_id = #{content.orderGoodsId}-->
<!--            </if>-->
<!--            <if test="content.supplierId != null">-->
<!--                and a.supplier_id = #{content.supplierId}-->
<!--            </if>-->
<!--            <if test="content.ifAllInto == 2">-->
<!--                and (a.inspect_total_num <![CDATA[ < ]]> a.delivery_total_num-->
<!--                    or a.inspect_total_num is null)-->
<!--            </if>-->
<!--            <if test="content.deliveryWarehouseId != null">-->
<!--                and a.delivery_warehouse_id = #{content.deliveryWarehouseId}-->
<!--            </if>-->
<!--            <if test="content.canteenId != null">-->
<!--                and a.canteen_id = #{content.canteenId}-->
<!--            </if>-->
<!--            <if test="content.stallId != null">-->
<!--                and a.stall_id = #{content.stallId}-->
<!--            </if>-->
<!--            <if test="content.deliveryGoodsIdList != null and content.deliveryGoodsIdList.size() > 0">-->
<!--                and a.delivery_goods_id in-->
<!--                <foreach collection="content.deliveryGoodsIdList" item="item" separator="," open="(" close=")">-->
<!--                    #{item}-->
<!--                </foreach>-->
<!--            </if>-->
<!--        </where>-->
<!--        order by a.crtime desc, a.delivery_goods_id desc-->
<!--    </select>-->
</mapper>
