<?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.caimei.www.mapper.HomeDao">
	<select id="getHomePageFloor" resultType="com.caimei.www.pojo.page.PageFloor">
		select id, type, floorTitle as title, floorDetail as detail
		from new_page_floor
		where delFlag = 0 and wwwEnabledStatus = '1'
		order by sort
	</select>
	<select id="getHomeBigTopicFloor" resultType="com.caimei.www.pojo.page.PageFloor">
		select id, title, description as detail
		from cm_page_big_topic
		where delFlag = 0 and enabledStatus = '1'
		order by sort
	</select>
    <select id="getHomeBanners" resultType="com.caimei.www.pojo.page.ImageLink">
		select id, title, link, image
		from new_page_homeImage
		where wwwEnabledStatus = 1
		order by sort desc, createDate desc
    </select>
	<select id="getAdvertising" resultType="com.caimei.www.pojo.page.ImageLink">
		select id, adTitle as title, link, adImage as image
		from new_page_advertising
		where delFlag = 0
		order by sort, createDate desc
	</select>
	<select id="getRecommendeds" resultType="com.caimei.www.pojo.page.ProductList">
		select
			p.productID as id,
			p.`name` as `name`,
			br.name as brand,
			p.mainImage as image,
			p.price1 as price,
			p.unit as unit,
			p.price1TextFlag as priceFlag,
			p.actType as actType
		from product p
		left join brand as br on p.brandID = br.brandID
		where p.validFlag != 0
		and p.actFlag = 1
		and (p.actType = 1 or p.actType = 2)
		and p.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
		order by p.actSort
	</select>
	<select id="getBigTopicData" resultType="com.caimei.www.pojo.page.ImageLink">
		select
            id,
            title,
            link,
            image
		from cm_page_big_topic_floor
		<where>
			delFlag = 0 and enabledStatus = '1'
			<if test = "topId != null and topId != ''">
				and bigTopicId = #{topId}
			</if>
		</where>
		order by sort ,enabledStatus ,createDate
		limit 0,5
	</select>
    <select id="getCommodityTopicData" resultType="com.caimei.www.pojo.page.ImageLink">
		select
            id,
            title,
            link,
            image,
            beginTime,
            endTime
		from new_page_commodity_topic
		where wwwEnabledStatus = 1
		and <![CDATA[ endTime > sysdate() ]]>
		and <![CDATA[ beginTime < sysdate() ]]>
		order by sort
		limit 0,3
    </select>
	<select id="getSmallTopicData" resultType="com.caimei.www.pojo.page.ImageLink">
		select
            id,
            title,
            link,
            image
		from new_page_small_topic
		where wwwEnabledStatus = 1
		order by sort
		limit 0,4
	</select>
	<select id="getSuppliersTopData" resultType="com.caimei.www.pojo.page.ImageLink">
		select
            id,
            supplierName as title,
            link,
            image
		from new_page_quality_supplier
		where delFlag = 0 and wwwEnabledStatus = 1
		order by sort
	</select>


</mapper>
