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

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        header_id, bill_no, enterprise_id, warehouse_id, container_code, status, cargo_owner_id, cargo_owner_name, locator_code, locator_id, gmt_create, creator, creator_name, gmt_modified, modifier, modifier_name
    </sql>

    <select id="getStereoByConditions" resultType="com.prolog.upcloud.base.wh.operate.model.WmsStereoH">
        SELECT <include refid="Base_Column_List"/> FROM `wms_stereo_h`
        WHERE warehouse_id = #{warehouseId}
        <if test="billNo!=null and billNo!=''">
            AND bill_no = #{billNo}
        </if>
        <if test="containerCodes!=null and containerCodes.length>0">
            AND container_code in
            <foreach collection="containerCodes" separator="," open="(" close=")" item="containerCode" index="index">
                #{containerCode}
            </foreach>
        </if>
        <if test="status!=null">
            AND status = #{status}
        </if>
    </select>

</mapper>