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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.system.base.BdProductStorehouseArea">
        <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_PRODUCT_STOREHOUSE" property="pkProductStorehouse" />
        <result column="PROVINCE" property="province" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        CREATION_TIME,
        MODIFIED_TIME,
        DEL_FLAG,
        PK_COUNTRY,
        PK_CREATOR,
        PK_MODIFIED,
        PK_ID, PK_PRODUCT_STOREHOUSE, PROVINCE
    </sql>



    <select id="getStorehouseAreaList" parameterType="com.hzs.system.base.vo.BdProductStorehouseAreaVO"
            resultType="com.hzs.system.base.vo.BdProductStorehouseAreaVO">
        select a.*,
        pr.NAME provinceVal
        from BD_PRODUCT_STOREHOUSE_AREA a
        INNER JOIN BD_AREA pr on pr.PK_ID=a.PROVINCE
        where  a.DEL_FLAG = 0
        and a.pk_Country =#{pkCountry}
        <if test="pkProductStorehouse != null">
            AND a.PK_PRODUCT_STOREHOUSE = #{pkProductStorehouse}
        </if>
    </select>
</mapper>
