<?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.qs.mp.common.mapper.ShippingTemplateRuleMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.qs.mp.common.domain.ShippingTemplateRule">
        <id column="id" property="id" />
        <result column="shipping_template_id" property="shippingTemplateId" />
        <result column="type" property="type" />
        <result column="default_number" property="defaultNumber" />
        <result column="default_price" property="defaultPrice" />
        <result column="create_number" property="createNumber" />
        <result column="create_price" property="createPrice" />
        <result column="created_time" property="createdTime" />
        <result column="updated_time" property="updatedTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, shipping_template_id, type, default_number, default_price, create_number, create_price, created_time, updated_time
    </sql>


        <select id="selectShippingTemplateRuleByTemplateIdAndAreaInfo" resultType="com.qs.mp.admin.domain.vo.ShippingTemplateCalculateVO">
        select t2.type,
               t2.default_number,
               t2.default_price,
               t2.create_number,
               t2.create_price,
               t2.remark
        FROM mp_shipping_template t1
         LEFT JOIN mp_shipping_template_rule t2 on t1.id = t2.shipping_template_id
         LEFT JOIN mp_shipping_template_rule_area t3 on t2.id = t3.shipping_template_rule_id
         ${ew.customSqlSegment}
    </select>
</mapper>