<?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.prolog.upcloud.base.wh.operate.dao.WmsStereoDMapper">

    <sql id="Base_Column_List">
        detail_id, header_id,stock_status, cargo_owner_id, to_container_code, item_id, item_code, item_name, status, batch_id, batch_num, quantity, act_quantity, uom, manufacturer_lot_num,is_deleted, gmt_create, creator, creator_name, gmt_modified, modifier, modifier_name, outbound_instruct, lock_stock_lot_id
    </sql>

    <select id="getStereoListByContainerCode" resultType="com.prolog.upcloud.base.wh.operate.vo.StereoDtlVO">
        SELECT d.detail_id, d.header_id, d.to_container_code, d.item_id, d.item_code
             , d.item_name, d.STATUS, d.batch_id, d.batch_num, d.quantity
             , d.act_quantity, d.uom, d.manufacturer_lot_num, d.gmt_create, d.creator
             , d.creator_name, d.gmt_modified, d.modifier, d.modifier_name, d.outbound_instruct
             , h.cargo_owner_id, h.cargo_owner_name, h.container_code, h.locator_code, h.locator_id
             , h.warehouse_id,h.bill_no,d.stock_status,d.lock_stock_lot_id
        FROM wms_stereo_d d
                 LEFT JOIN wms_stereo_h h ON d.header_id = h.header_id
        WHERE h.warehouse_id  = #{warehouseId} AND h.container_code = #{containerCode} AND h.`status` = 0 AND d.is_deleted = 0
    </select>

    <select id="getListByHeadIds" resultType="com.prolog.upcloud.base.wh.operate.model.WmsStereoD">
        SELECT <include refid="Base_Column_List" /> FROM wms_stereo_d
        WHERE header_id in
        <foreach collection="headerIds" separator="," open="(" close=")" item="headerId" index="index">
            #{headerId}
        </foreach>
        ORDER BY gmt_create desc
    </select>

</mapper>