<?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.DrpInventoryMapper">
    <select id="selectInventoryByMaterialIdList" resultType="com.bonus.canteen.core.supply.purchase.domain.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>


</mapper>



