<?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.SinglePageDao">
    <select id="getFreePageById" resultType="com.caimei.www.pojo.page.PageContent">
        select  a.id, a.type, a.title, a.keywords, a.description, f.content
        from cm_page a
        left join cm_page_freedom f on a.id=f.pageId
        where a.type=4 and a.enabledStatus=1 and f.type=1
        and a.id=#{id}
    </select>
    <select id="getTopicPageById" resultType="com.caimei.www.pojo.page.PageContent">
        select  a.id, a.type, a.title, a.keywords, a.description, a.headImage as image, a.headText as content
        from cm_page a
        where a.type=1 and a.enabledStatus=1
        and a.id=#{id}
    </select>
    <select id="getLivePageData" resultType="com.caimei.www.pojo.page.PageContent">
        select  a.id, a.type, a.title, a.keywords, a.description, a.headImage as image, a.headText as content
        from cm_page a
        where a.id=1 and a.type=3 and a.enabledStatus=1
    </select>
    <select id="getFloorByPageId" resultType="com.caimei.www.pojo.page.PageFloor">
        select id, pageId as type, title, link
        from cm_page_centre
        where pageId=#{id}
        and enabledStatus=1
        order by sort desc,createDate desc
    </select>
    <select id="getDataByFloorId" resultType="com.caimei.www.pojo.page.ImageLink">
        select  a.id as id,
                a.title as title,
                a.link as link,
                d.image as image
        from cm_page_image a
        right join cm_page_centre_image b on b.imageId=a.id
        left join cm_page_image_activity c on c.imageId=a.id
        left join actType d on d.actTypeId=c.actTypeId
        where b.centreId=#{floorId} and  a.enabledStatus=1
        order  by a.sort desc,a.createDate desc
    </select>
    <select id="getPromotionsList" resultType="com.caimei.www.pojo.page.ImageLink">
        select  a.id as id,
                a.title as title,
                a.link as link,
                a.image as image,
                a.beginTime as beginTime,
                a.endTime as endTime
        from cm_page_image a
        where a.type=4 and a.enabledStatus=1
        order by a.sort desc,a.createDate desc
    </select>
    <select id="getLiveTeachers" resultType="com.caimei.www.pojo.page.ImageLink">
        select  a.id as id,
                a.title as title,
                a.link as link,
                a.image as image
        from cm_page_image a
        where a.type=3 and a.enabledStatus=1
        order by a.sort desc,a.createDate desc
    </select>


</mapper>
