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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.sale.postage.BdPostageDetail">
        <id column="PK_ID" property="pkId"/>
        <result column="FIRST_WEIGHT" property="firstWeight"/>
        <result column="FIRST_POSTAGE" property="firstPostage"/>
        <result column="CONTINUED_WEIGHT" property="continuedWeight"/>
        <result column="CONTINUED_POSTAGE" property="continuedPostage"/>
        <result column="PROVINCE" property="province"/>
        <result column="CITY" property="city"/>
        <result column="WARN_NOTICE" property="warnNotice"/>
        <result column="PK_CREATOR" property="pkCreator"/>
        <result column="CREATION_TIME" property="creationTime"/>
        <result column="PK_MODIFIED" property="pkModified"/>
        <result column="MODIFIED_TIME" property="modifiedTime"/>
        <result column="DEL_FLAG" property="delFlag"/>
        <result column="PK_COUNTRY" property="pkCountry"/>
        <result column="PK_POSTAGE" property="pkPostage"/>
        <result column="VOLUME_RATIO" property="volumeRatio"/>
        <result column="TYPE" property="type"/>
    </resultMap>

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

</mapper>
