<?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.wares.mapper.BdWaresSpecsRelationMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.sale.wares.BdWaresSpecsRelation">
        <id column="PK_ID" property="pkId"/>
        <result column="PK_WARES_SPECS" property="pkWaresSpecs"/>
        <result column="PK_WARES_SPECS_SKU" property="pkWaresSpecsSku"/>
        <result column="PK_WARES_DETAIL" property="pkWaresDetail"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        PK_ID
        , PK_WARES_SPECS, PK_WARES_SPECS_SKU
    </sql>

    <select id="selectByWaresSpecsSku" resultType="com.hzs.common.domain.sale.ext.BdWaresSpecsRelationExt">
        select wsr.*, bs.SPECS_NAME specsName, ws.PK_SPECS pkSpecs
        from BD_WARES_SPECS_RELATION wsr
                 left join BD_WARES_SPECS ws on ws.PK_ID = wsr.PK_WARES_SPECS
                 left join BD_SPECS bs on bs.PK_ID = ws.PK_SPECS
        where wsr.PK_WARES_SPECS_SKU = #{pkWaresSpecsSku} and wsr.del_flag = 0 and ws.del_flag = 0  and bs.del_flag = 0
        order by  ws.PK_SPECS
    </select>

</mapper>
