<?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.sale.postage.mapper.BdPostageAreaMapper">

    <select id="getPostageArea" resultType="com.hzs.common.domain.sale.postage.BdPostageArea">
        select bd.* from bd_postage bp
        inner join bd_postage_area bd
        on bp.pk_id = bd.pk_postage
        where bp.del_flag=0 and bd.del_flag=0
        <if test="pkCountry != null">
            and bp.pk_country = #{pkCountry}
        </if>
        <if test="pkPostage != null and pkPostage != ''">
            and bd.pk_postage = #{pkPostage}
        </if>
        <if test="tranType != null and tranType != ''">
            and bp.tran_type=#{tranType}
        </if>
        <if test="specialArea != null and specialArea != ''">
            and bd.special_area = #{specialArea}
        </if>
        order by bd.city,bd.province
    </select>

    <select id="selectBySpecialAreaPostage" resultType="com.hzs.common.domain.sale.postage.BdPostageArea">
        select *
        from bd_postage_area
        where PK_POSTAGE = #{pkPostage}
          and PROVINCE is null
          and CITY is null
          and DEL_FLAG = 0
    </select>

</mapper>
