<?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.hzs.system.base.mapper.BdProductStorehouseMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.system.base.BdProductStorehouse">
        <id column="PK_ID" property="pkId"/>
        <result column="CREATION_TIME" property="creationTime"/>
        <result column="MODIFIED_TIME" property="modifiedTime"/>
        <result column="DEL_FLAG" property="delFlag"/>
        <result column="PK_COUNTRY" property="pkCountry"/>
        <result column="PK_CREATOR" property="pkCreator"/>
        <result column="PK_MODIFIED" property="pkModified"/>
        <result column="PK_STOREHOUSE" property="pkStorehouse"/>
        <result column="PK_PRODUCT" property="pkProduct"/>
    </resultMap>

    <select id="queryBdProductStorehouseByCondition" resultType="com.hzs.common.domain.system.base.ext.BdProductStorehouseExt">
        select bs.*,bh.pk_corp from bd_product_storehouse bs
        inner join bd_product_storehouse_area ba
        on bs.pk_id=ba.pk_product_storehouse
        inner join bd_storehouse bh
        on bh.pk_id=bs.pk_storehouse
        where bs.del_flag=0 and ba.del_flag=0 and bh.del_flag=0
        and ba.province=#{province}
        and bs.pk_product in
        <foreach collection="productId" item="item" open="(" close=")" separator=",">
            #{item}
        </foreach>
    </select>

</mapper>
