<?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.drp.mapper.DrpInventoryMapper">

    <update id="minusInventoryNumById">
        UPDATE drp_inventory
        SET material_num = material_num - #{fetchNum}
        WHERE
            inventory_id = #{inventoryId}
    </update>
    <update id="plusInventoryNumById">
        UPDATE drp_inventory
        SET material_num = material_num + #{materialNum}
        WHERE
            inventory_id = #{inventoryId}
    </update>

<!--    &lt;!&ndash; 获取所有原料信息 &ndash;&gt;-->
<!--    <select id="selectAllMaterialList" resultType="net.xnzn.core.drp.vo.DrpListAllMaterialVO">-->
<!--        select-->
<!--        mm.material_id,-->
<!--        mm.material_name,-->
<!--        mm.material_code,-->
<!--        mmc.category_id,-->
<!--        mmc.category_name,-->
<!--        ds.supplier_id,-->
<!--        ds.supplier_name,-->
<!--        du.unit_id,-->
<!--        du.unit_name,-->
<!--        did.unit_price,-->
<!--        did.pur_num-->
<!--        from-->
<!--        menu_material mm-->
<!--        left join (-->
<!--        select-->
<!--        a.*-->
<!--        from-->
<!--        drp_into_detail as a,-->
<!--        ( select b.material_id, max( b.id ) as id from drp_into_detail as b LEFT JOIN drp_into_inventory AS c ON-->
<!--        c.into_id = b.into_id-->
<!--        WHERE c.warehouse_id = #{warehouseId} group by b.material_id ) as c-->
<!--        where-->
<!--        a.material_id = c.material_id-->
<!--        and a.id = c.id-->
<!--        ) did on mm.material_id = did.material_id-->
<!--        left join menu_material_category mmc on mm.category_id = mmc.category_id-->
<!--        left join drp_supplier ds on did.supplier_id = ds.supplier_id-->
<!--        left join drp_unit du on did.unit_id = du.unit_id-->
<!--        where-->
<!--        mm.del_flag = #{delFlag}-->
<!--        <if test="content.materialCode != null and content.materialCode != ''">-->
<!--            and mm.material_code = #{content.materialCode}-->
<!--        </if>-->
<!--        <if test="content.materialName != null and content.materialName != ''">-->
<!--            and (-->
<!--            mm.material_name like concat(concat('%', #{content.materialName}), '%')-->
<!--            or mm.pinyin_initials like concat(concat('%', #{pinyinInitials}), '%')-->
<!--            or mm.pinyin_full like concat(concat('%', #{pinyinFull}), '%')-->
<!--            )-->
<!--        </if>-->
<!--        <if test="categoryIdList != null and categoryIdList.size() > 0">-->
<!--            and mm.category_id in-->
<!--            <foreach close=")" collection="categoryIdList" item="categoryId" open="(" separator=",">-->
<!--                #{categoryId}-->
<!--            </foreach>-->
<!--        </if>-->
<!--    </select>-->

<!--    &lt;!&ndash; AI电子秤原料搜索 &ndash;&gt;-->
<!--    <select id="selectAndroidMaterialList"-->
<!--            resultType="net.xnzn.core.drp.vo.AndroidSearchMaterialVO">-->
<!--        select-->
<!--        mm.material_id,-->
<!--        mm.material_name,-->
<!--        mm.material_code,-->
<!--        mmc.category_name,-->
<!--        ds.supplier_id,-->
<!--        ds.supplier_name,-->
<!--        mm.unit_id,-->
<!--        du.unit_name,-->
<!--        du.weigh_type,-->
<!--        du.rate,-->
<!--        did.unit_price-->
<!--        from-->
<!--        menu_material mm-->
<!--        left join (-->
<!--        select-->
<!--        a.*-->
<!--        from-->
<!--        drp_into_detail as a,-->
<!--        ( select b.material_id, max( b.id ) as id from drp_into_detail as b group by b.material_id ) as c-->
<!--        where-->
<!--        a.material_id = c.material_id-->
<!--        and a.id = c.id-->
<!--        ) did on mm.material_id = did.material_id-->
<!--        left join menu_material_category mmc on mm.category_id = mmc.category_id-->
<!--        left join drp_supplier ds on did.supplier_id = ds.supplier_id-->
<!--        left join drp_unit du on mm.unit_id = du.unit_id-->
<!--        where-->
<!--        mm.del_flag = #{delFlag}-->
<!--        <if test="content.materialCode != null and content.materialCode != ''">-->
<!--            and mm.material_code = #{content.materialCode}-->
<!--        </if>-->
<!--        <if test="content.materialName != null and content.materialName != ''">-->
<!--            and (-->
<!--            mm.material_name like concat(concat('%', #{content.materialName}), '%')-->
<!--            or mm.pinyin_initials like concat(concat('%', #{pinyinInitials}), '%')-->
<!--            or mm.pinyin_full like concat(concat('%', #{pinyinFull}), '%')-->
<!--            )-->
<!--        </if>-->
<!--        <if test="content.categoryIdList != null and content.categoryIdList.size() > 0">-->
<!--            and mm.category_id in-->
<!--            <foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")">-->
<!--                #{categoryId}-->
<!--            </foreach>-->
<!--        </if>-->
<!--        <if test="content.barCode != null and content.barCode != ''">-->
<!--            and mm.bar_code = #{content.barCode}-->
<!--        </if>-->
<!--    </select>-->

<!--    <select id="searchInventoryMaterial"-->
<!--            resultType="net.xnzn.core.drp.vo.AndroidSearchInventoryMaterialVO">-->
<!--        SELECT-->
<!--        a.inventory_id,-->
<!--        a.material_id,-->
<!--        b.material_name,-->
<!--        b.material_code,-->
<!--        b.category_id,-->
<!--        e.category_name,-->
<!--        a.unit_id,-->
<!--        d.unit_name,-->
<!--        d.rate,-->
<!--        a.material_num-->
<!--        FROM-->
<!--        drp_inventory a-->
<!--        LEFT JOIN menu_material b ON a.material_id = b.material_id-->
<!--        LEFT JOIN drp_unit d ON d.unit_id = a.unit_id-->
<!--        LEFT JOIN menu_material_category e ON e.category_id = b.category_id-->
<!--        <where>-->
<!--            b.del_flag = #{delFlag}-->
<!--            and a.material_num > 0-->
<!--            <if test="content.materialCode != null and content.materialCode != ''">-->
<!--                and b.material_code = #{content.materialCode}-->
<!--            </if>-->
<!--            <if test="content.materialName != null and content.materialName != ''">-->
<!--                and (-->
<!--                b.material_name like concat(concat('%', #{content.materialName}), '%')-->
<!--                or b.pinyin_initials like concat(concat('%', #{pinyinInitials}), '%')-->
<!--                or b.pinyin_full like concat(concat('%', #{pinyinFull}), '%')-->
<!--                )-->
<!--            </if>-->
<!--            <if test="content.categoryIdList != null and content.categoryIdList.size() > 0">-->
<!--                and b.category_id in-->
<!--                <foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")">-->
<!--                    #{categoryId}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.warehouseId != null">-->
<!--                and a.warehouse_id = #{content.warehouseId}-->
<!--            </if>-->
<!--            <if test="content.barCode != null and content.barCode != ''">-->
<!--                and b.bar_code = #{content.barCode}-->
<!--            </if>-->
<!--        </where>-->
<!--        ORDER BY-->
<!--        a.material_id,-->
<!--        a.unit_id-->
<!--    </select>-->
<!--    <select id="getInventoryNumByMaterialId" resultType="net.xnzn.core.drp.po.InventoryModel">-->
<!--        SELECT-->
<!--        <if test="warehouseId != null">-->
<!--            inventory_id,-->
<!--            material_num inventoryNum-->
<!--        </if>-->
<!--        <if test="warehouseId == null">-->
<!--            max( inventory_id) inventory_id,-->
<!--            sum(material_num) inventoryNum-->
<!--        </if>-->
<!--        FROM-->
<!--        drp_inventory-->
<!--        WHERE-->
<!--        material_id = #{materialId}-->
<!--        <if test="warehouseId != null">-->
<!--            AND warehouse_id = #{warehouseId}-->
<!--        </if>-->
<!--        AND unit_id = #{unitId}-->
<!--    </select>-->
<!--    <select id="selectInventoryByMaterialIdList" resultType="net.xnzn.core.drp.vo.MaterialInventoryVO">-->
<!--        SELECT-->
<!--            material_id,-->
<!--            unit_id,-->
<!--            sum(material_num) inventoryNum-->
<!--        FROM-->
<!--            drp_inventory-->
<!--        where-->
<!--            material_id in-->
<!--            <foreach collection="materialIdList" item="materialId" separator="," open="(" close=")">-->
<!--                #{materialId}-->
<!--            </foreach>-->
<!--            <if test="warehouseId != null">-->
<!--                and warehouse_id = #{warehouseId}-->
<!--            </if>-->
<!--        group by-->
<!--            material_id,-->
<!--            unit_id-->
<!--    </select>-->
<!--    <select id="pageMaterialInventory" resultType="net.xnzn.core.drp.vo.DrpMaterialInventoryPageVO">-->
<!--        SELECT-->
<!--            a.material_id,-->
<!--            b.material_name,-->
<!--            b.material_code,-->
<!--            a.unit_id,-->
<!--            c.unit_name,-->
<!--            b.category_id,-->
<!--            d.category_name,-->
<!--            b.image_url,-->
<!--            b.bar_code,-->
<!--            sum( a.material_num ) AS inventoryNum-->
<!--        FROM-->
<!--            drp_inventory a-->
<!--            LEFT JOIN menu_material b ON a.material_id = b.material_id-->
<!--            LEFT JOIN drp_unit c ON c.unit_id = a.unit_id-->
<!--            LEFT JOIN menu_material_category d ON d.category_id = b.category_id-->
<!--            left join drp_warehouse e on e.warehouse_id = a.warehouse_id-->
<!--        <where>-->
<!--            <if test="content.materialName != null and content.materialName != ''">-->
<!--                and b.material_name like #{content.materialName}-->
<!--            </if>-->
<!--            <if test="content.categoryIdList != null and content.categoryIdList.size() > 0">-->
<!--                and b.category_id in-->
<!--                <foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")">-->
<!--                    #{categoryId}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.barCode != null and content.barCode != ''">-->
<!--                and b.bar_code = #{content.barCode}-->
<!--            </if>-->
<!--            <if test="warehouseAuthority != null and warehouseAuthority.size() > 0">-->
<!--                and a.warehouse_id in-->
<!--                <foreach collection="warehouseAuthority" item="warehouseId" separator="," open="(" close=")">-->
<!--                    #{warehouseId}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.inventoryStatus != null">-->
<!--                and a.inventory_status = #{content.inventoryStatus}-->
<!--            </if>-->
<!--            <if test="content.warehouseIdList != null and content.warehouseIdList.size() > 0">-->
<!--                AND a.warehouse_id in-->
<!--                <foreach collection="content.warehouseIdList" item="item" separator="," open="(" close=")">-->
<!--                    #{item}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="areaAuth != null and areaAuth.size() > 0">-->
<!--                and e.area_id in-->
<!--                <foreach collection="areaAuth" item="areaId" separator="," open="(" close=")">-->
<!--                    #{areaId}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.areaId != null">-->
<!--                and e.area_id = #{content.areaId}-->
<!--            </if>-->
<!--        </where>-->
<!--        GROUP BY-->
<!--            a.material_id,-->
<!--            b.material_name,-->
<!--            b.material_code,-->
<!--            a.unit_id,-->
<!--            c.unit_name,-->
<!--            b.category_id,-->
<!--            d.category_name,-->
<!--            b.image_url,-->
<!--            b.bar_code-->
<!--        ORDER BY-->
<!--            a.material_id,-->
<!--            a.unit_id-->
<!--    </select>-->
<!--    <select id="listAllWarehouseInventory" resultType="net.xnzn.core.drp.vo.DrpMaterialInventoryDetailPageVO">-->
<!--        SELECT a.inventory_id,-->
<!--               a.warehouse_id,-->
<!--               b.warehouse_name,-->
<!--               a.material_num,-->
<!--               a.inventory_status,-->
<!--               a.min_num,-->
<!--               a.max_num,-->
<!--               a.material_id,-->
<!--               a.unit_id,-->
<!--               b.area_id,-->
<!--               aa.area_name-->
<!--        FROM drp_inventory a-->
<!--        LEFT JOIN drp_warehouse b on b.warehouse_id = a.warehouse_id-->
<!--        left join alloc_area aa on aa.area_id = b.area_id-->
<!--        <where>-->
<!--            <if test="materialId != null">-->
<!--                AND a.material_id = #{materialId}-->
<!--            </if>-->
<!--            <if test="unitId != null">-->
<!--                AND a.unit_id = #{unitId}-->
<!--            </if>-->
<!--            <if test="content.warehouseIdList != null and content.warehouseIdList.size() > 0">-->
<!--                AND a.warehouse_id in-->
<!--                <foreach collection="content.warehouseIdList" item="item" separator="," open="(" close=")">-->
<!--                    #{item}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="warehouseAuthority != null and warehouseAuthority.size() > 0">-->
<!--                and a.warehouse_id in-->
<!--                <foreach collection="warehouseAuthority" item="warehouseId" separator="," open="(" close=")">-->
<!--                    #{warehouseId}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="areaAuth != null and areaAuth.size() > 0">-->
<!--                and b.area_id in-->
<!--                <foreach collection="areaAuth" item="areaId" separator="," open="(" close=")">-->
<!--                    #{areaId}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.materialIdList != null and content.materialIdList.size() > 0">-->
<!--                AND a.material_id in-->
<!--                <foreach collection="content.materialIdList" item="item" separator="," open="(" close=")">-->
<!--                    #{item}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.unitIdList != null and content.unitIdList.size() > 0">-->
<!--                AND a.unit_id in-->
<!--                <foreach collection="content.unitIdList" item="item" separator="," open="(" close=")">-->
<!--                    #{item}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.areaId != null">-->
<!--                and b.area_id = #{content.areaId}-->
<!--            </if>-->
<!--        </where>-->
<!--    </select>-->
<!--    <select id="getMaterialWarehouseInventory"-->
<!--            resultType="net.xnzn.core.drp.vo.DrpMaterialWarehouseInventoryVO">-->
<!--        SELECT-->
<!--            a.warehouse_id,-->
<!--            b.warehouse_name,-->
<!--            a.material_num-->
<!--        FROM-->
<!--            drp_inventory a-->
<!--            LEFT JOIN drp_warehouse b ON b.warehouse_id = a.warehouse_id-->
<!--        WHERE-->
<!--            b.del_flag = #{delFlag}-->
<!--            AND a.material_id = #{content.materialId}-->
<!--            AND a.unit_id = #{content.unitId}-->
<!--    </select>-->
<!--    <select id="checkInventoryNum" resultType="java.math.BigDecimal">-->
<!--        SELECT-->
<!--            SUM( material_num )-->
<!--        FROM-->
<!--            drp_inventory-->
<!--        WHERE-->
<!--            warehouse_id = #{warehouseId}-->
<!--    </select>-->
<!--    <select id="getWarehouseCategory" resultType="net.xnzn.core.drp.dto.WarehouseCategoryPageDTO">-->
<!--        SELECT-->
<!--            mm.category_id,-->
<!--            mmc.category_name,-->
<!--            mmc.category_type-->
<!--        FROM-->
<!--            drp_inventory di-->
<!--                LEFT JOIN menu_material mm ON di.material_id = mm.material_id-->
<!--                LEFT JOIN menu_material_category mmc ON mm.category_id = mmc.category_id-->
<!--        WHERE-->
<!--            di.del_flag = 2-->
<!--          AND di.warehouse_id = #{content.warehouseId}-->
<!--        <if test="content.categoryIdList != null and content.categoryIdList.size() > 0">-->
<!--            and mmc.category_id in-->
<!--            <foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")">-->
<!--                #{categoryId}-->
<!--            </foreach>-->
<!--        </if>-->
<!--        GROUP BY-->
<!--            mm.category_id,-->
<!--            mmc.category_name,-->
<!--            mmc.category_type-->
<!--    </select>-->
<!--    <select id="materialInventoryExport" resultType="net.xnzn.core.drp.vo.DrpMaterialInventoryExportVO">-->
<!--        SELECT-->
<!--        a.inventory_id,-->
<!--        a.material_id,-->
<!--        a.unit_id,-->
<!--        b.material_name,-->
<!--        b.material_code,-->
<!--        c.unit_name,-->
<!--        d.category_name,-->
<!--        b.bar_code,-->
<!--        dw.warehouse_name,-->
<!--        a.inventory_status,-->
<!--        sum( a.material_num ) AS materialNum,-->
<!--        a.warehouse_id-->
<!--        FROM-->
<!--        drp_inventory a-->
<!--        LEFT JOIN menu_material b ON a.material_id = b.material_id-->
<!--        LEFT JOIN drp_unit c ON c.unit_id = b.unit_id-->
<!--        LEFT JOIN menu_material_category d ON d.category_id = b.category_id-->
<!--        LEFT JOIN drp_warehouse dw ON a.warehouse_id = dw.warehouse_id-->
<!--        left join alloc_area aa on aa.area_id = dw.area_id-->
<!--        <where>-->
<!--            <if test="content.materialName != null and content.materialName != ''">-->
<!--                and b.material_name like #{content.materialName}-->
<!--            </if>-->
<!--            <if test="content.categoryIdList != null and content.categoryIdList.size() > 0">-->
<!--                and b.category_id in-->
<!--                <foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")">-->
<!--                    #{categoryId}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.barCode != null and content.barCode != ''">-->
<!--                and b.bar_code = #{content.barCode}-->
<!--            </if>-->
<!--            <if test="warehouseAuthority != null and warehouseAuthority.size() > 0">-->
<!--                and a.warehouse_id in-->
<!--                <foreach collection="warehouseAuthority" item="warehouseId" separator="," open="(" close=")">-->
<!--                    #{warehouseId}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.inventoryStatus != null">-->
<!--                and a.inventory_status = #{content.inventoryStatus}-->
<!--            </if>-->
<!--            <if test="areaAuth != null and areaAuth.size() > 0">-->
<!--                and dw.area_id in-->
<!--                <foreach collection="areaAuth" item="areaId" separator="," open="(" close=")">-->
<!--                    #{areaId}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.warehouseIdList != null and content.warehouseIdList.size() > 0">-->
<!--                AND a.warehouse_id in-->
<!--                <foreach collection="content.warehouseIdList" item="item" separator="," open="(" close=")">-->
<!--                    #{item}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.areaId != null">-->
<!--                and dw.area_id = #{content.areaId}-->
<!--            </if>-->
<!--        </where>-->
<!--        GROUP BY-->
<!--        a.inventory_id,-->
<!--        b.material_name,-->
<!--        b.material_code,-->
<!--        c.unit_name,-->
<!--        d.category_name,-->
<!--        b.bar_code,-->
<!--        a.material_id,-->
<!--        a.unit_id,-->
<!--        dw.warehouse_name,-->
<!--        a.inventory_status,-->
<!--        dw.area_id,-->
<!--        aa.area_name,-->
<!--        a.warehouse_id-->
<!--       &lt;!&ndash;  HAVING 1 = 1-->

<!--        <if test="content.materialNumStart != null">-->
<!--            and sum( a.material_num ) >= #{content.materialNumStart}-->
<!--        </if>-->
<!--        <if test="content.materialNumEnd != null">-->
<!--            and sum( a.material_num ) <![CDATA[ <= ]]> #{content.materialNumEnd}-->
<!--        </if>&ndash;&gt;-->
<!--        ORDER BY-->
<!--        a.material_id,-->
<!--        a.unit_id-->

<!--    </select>-->
<!--    <select id="pageDrpInventory" resultType="net.xnzn.core.drp.vo.DrpInventoryPageVO">-->
<!--        SELECT-->
<!--        a.inventory_id,-->
<!--        a.warehouse_id,-->
<!--        f.warehouse_name,-->
<!--        a.material_id,-->
<!--        b.material_code,-->
<!--        b.material_name,-->
<!--        b.category_id,-->
<!--        e.category_name,-->
<!--        a.unit_id,-->
<!--        d.unit_name,-->
<!--        a.min_num,-->
<!--        a.max_num,-->
<!--        a.material_num,-->
<!--        a.inventory_status,-->
<!--        b.image_url,-->
<!--        b.bar_code,-->
<!--        b.sales_mode-->
<!--        FROM-->
<!--        drp_inventory a-->
<!--        LEFT JOIN menu_material b ON a.material_id = b.material_id-->
<!--        LEFT JOIN drp_unit d ON d.unit_id = a.unit_id-->
<!--        LEFT JOIN menu_material_category e ON e.category_id = b.category_id-->
<!--        LEFT JOIN drp_warehouse f ON f.warehouse_id = a.warehouse_id-->
<!--        <where>-->
<!--            <if test="content.warehouseId != null">-->
<!--                and a.warehouse_id = #{content.warehouseId}-->
<!--            </if>-->
<!--            <if test="content.materialNum != null and content.materialNum != ''">-->
<!--                and a.material_num > #{content.materialNum}-->
<!--            </if>-->
<!--            <if test="content.materialId != null">-->
<!--                and a.material_id = #{content.materialId}-->
<!--            </if>-->
<!--            <if test="content.materialName != null and content.materialName != ''">-->
<!--                and b.material_name like #{content.materialName}-->
<!--            </if>-->
<!--            <if test="content.categoryIdList != null and content.categoryIdList.size() > 0">-->
<!--                and b.category_id in-->
<!--                <foreach collection="content.categoryIdList" item="categoryId" separator="," open="(" close=")">-->
<!--                    #{categoryId}-->
<!--                </foreach>-->
<!--            </if>-->
<!--            <if test="content.inventoryStatus != null">-->
<!--                and a.inventory_status = #{content.inventoryStatus}-->
<!--            </if>-->
<!--            <if test="content.barCode != null and content.barCode != ''">-->
<!--                and b.bar_code = #{content.barCode}-->
<!--            </if>-->
<!--            <if test="content.materialCode != null and content.materialCode != ''">-->
<!--                and b.material_code like #{content.materialCode}-->
<!--            </if>-->
<!--            <if test="content.initial != null and content.initial != ''">-->
<!--                and b.pinyin_initials like CONCAT(#{content.initial},'%')-->
<!--            </if>-->
<!--            <if test="content.filterNegative != null">-->
<!--                and a.material_num > 0-->
<!--            </if>-->
<!--            <if test="content.materialInfo != null and content.materialInfo != ''">-->
<!--                and (-->
<!--                b.material_name like concat('%', #{content.materialInfo}, '%')-->
<!--                or b.pinyin_initials like concat(#{content.materialInfo}, '%')-->
<!--                or b.bar_code like concat('%', #{content.materialInfo}, '%')-->
<!--                or b.material_code like concat('%', #{content.materialInfo}, '%')-->
<!--                )-->
<!--            </if>-->
<!--            <if test="content.materialIdList != null and content.materialIdList.size() > 0">-->
<!--                and b.material_id in-->
<!--                <foreach collection="content.materialIdList" item="item" separator="," open="(" close=")">-->
<!--                    #{item}-->
<!--                </foreach>-->
<!--            </if>-->
<!--        </where>-->
<!--        ORDER BY-->
<!--        a.material_id,-->
<!--        a.unit_id-->
<!--    </select>-->
<!--    <select id="sumInventoryNumById" resultType="net.xnzn.core.drp.vo.DrpSumInventoryNumVO">-->
<!--        SELECT a.material_id,-->
<!--               a.unit_id,-->
<!--               sum(a.unit_price * a.inventory_num) as inventoryAmount,-->
<!--               b.warehouse_id-->
<!--        FROM drp_into_detail a-->
<!--                 LEFT JOIN drp_into_inventory b ON b.into_id = a.into_id-->
<!--        WHERE b.`status` = #{status}-->
<!--          AND a.inventory_num > 0-->
<!--        <if test="inventoryIdList != null and inventoryIdList.size() > 0">-->
<!--            and a.inventory_id in-->
<!--            <foreach collection="inventoryIdList" item="inventoryId" separator="," open="(" close=")">-->
<!--                #{inventoryId}-->
<!--            </foreach>-->
<!--        </if>-->
<!--        group by a.material_id, a.unit_id, b.warehouse_id-->
<!--    </select>-->
<!--    <select id="getInventoryMaterialAllTypes" resultType="net.xnzn.core.drp.vo.DrpAppAllMaterialTypesVO">-->
<!--        SELECT distinct-->
<!--            b.category_id,-->
<!--            c.category_name-->
<!--        FROM-->
<!--            drp_inventory a-->
<!--                LEFT JOIN menu_material b ON b.material_id = a.material_id-->
<!--                LEFT JOIN menu_material_category c ON c.category_id = b.category_id-->
<!--        WHERE-->
<!--            a.del_flag = #{delFlag}-->
<!--          AND b.del_flag = #{delFlag}-->
<!--          AND c.del_flag = #{delFlag}-->
<!--          <if test="content.warehouseId != null">-->
<!--              AND a.warehouse_id = #{content.warehouseId}-->
<!--          </if>-->
<!--          <if test="content.filterNegative != null">-->
<!--              AND a.material_num > 0-->
<!--          </if>-->
<!--    </select>-->
<!--    <select id="listInventoryCategory" resultType="java.lang.Long">-->
<!--        SELECT DISTINCT-->
<!--            mm.category_id-->
<!--        FROM-->
<!--            drp_inventory di-->
<!--                LEFT JOIN menu_material mm ON mm.material_id = di.material_id-->
<!--        WHERE-->
<!--            di.warehouse_id = #{content.warehouseId}-->
<!--    </select>-->


</mapper>



