<?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="cn.com.xingxi.store.data.mapper.WxaStoreShopBannerMapper">

    <resultMap id="ShopBannerResult" type="ShopBannerDTO" >
        <result property="bannerId"    column="bannerId"    />
        <result property="bannerType"    column="bannerType"    />
        <result property="prodId"    column="prodId"    />
        <result property="sort"    column="sort"    />
        <collection property="imageDTOS"  ofType="ImageDTO">
            <result property="imageId"    column="bannerImgId"/>
            <result property="imageUrl"    column="fileUrl"/>
        </collection>
    </resultMap>

    <select id="selectShopBannersByMercId" parameterType="String" resultMap="ShopBannerResult">
        SELECT t_shop_banner.bannerId,
               t_shop_banner.bannerImgId,
               t_shop_banner.prodId,
               t_shop_banner.bannerType,
               t_shop_banner.sort,
               t_attch_file.fileUrl
        FROM t_shop_banner
        INNER JOIN t_attch_file ON t_shop_banner.bannerImgId = t_attch_file.fileId
        WHERE t_shop_banner.delFlag = '0'
          AND t_shop_banner.shelfFlag = '1'
          AND t_shop_banner.mercId = #{mercId}
        ORDER BY t_shop_banner.sort
    </select>


</mapper>
