<?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.gree.mall.manager.commonmapper.CommonPageV2Mapper">

    <select id="pageV2CarouseMap" resultType="com.gree.mall.manager.bean.carouselMap.CarouselMapVO">
        select
        ${ex.selected}
        from
        carousel_map a
        ${ex.query}

        <if test="companyWechatIds != null and companyWechatIds.size > 0">
            AND a.company_wechat_id IN
            <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
                #{item}
            </foreach>


        </if>
        <if test="ex.orderBy == null or ex.orderBy ==''">
            order by a.sort_num asc
        </if>
        ${ex.orderBy}
    </select>
    <select id="pageV2Storage" resultType="com.gree.mall.manager.bean.StorageVO">
        select
        ${ex.selected}
        from
        storage a
        ${ex.query}
        AND a.del = 0
        <if test="companyWechatIds != null and companyWechatIds.size > 0">
            AND a.company_wechat_id IN
            <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
                #{item}
            </foreach>


        </if>
        <if test="ex.adminWebsitIds != null and ex.adminWebsitIds.size > 0">
            AND a.websit_id IN
            <foreach item="item" index="index" collection="ex.adminWebsitIds" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="ex.orderBy == null or ex.orderBy ==''">
            order by a.create_time desc
        </if>
        ${ex.orderBy}
    </select>
    <select id="pageV2Template" resultType="com.gree.mall.manager.bean.CommonTemplateVO">
        select
        ${ex.selected}
        from
        common_template a
        ${ex.query}

        <if test="companyWechatIds != null and companyWechatIds.size > 0">
            AND a.company_wechat_id IN
            <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
                #{item}
            </foreach>


        </if>
<!--        <if test="websitIds != null and websitIds.size > 0">-->
<!--            AND a.websit_id IN-->
<!--            <foreach item="item" index="index" collection="websitIds" open="(" separator="," close=")">-->
<!--                #{item}-->
<!--            </foreach>-->
<!--        </if>-->
        <if test="ex.orderBy == null or ex.orderBy ==''">
            order by a.create_time desc
        </if>
        ${ex.orderBy}
    </select>
    <select id="pageV2GoodsNewsCategory" resultType="com.gree.mall.manager.bean.goods.GoodsNewsCategoryVO">
        select
        ${ex.selected}
        from
        goods_news_category a
        ${ex.query}

        <if test="companyWechatIds != null and companyWechatIds.size > 0">
            AND a.company_wechat_id IN
            <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
                #{item}
            </foreach>


        </if>
        <if test="ex.orderBy == null or ex.orderBy ==''">
            order by a.create_time desc
        </if>
        ${ex.orderBy}
    </select>
    <select id="pageV2FreightTemplate" resultType="com.gree.mall.manager.bean.FreightTemplateVO">
        select
        ${ex.selected}
        from
        freight_template a
        ${ex.query}

        <if test="companyWechatIds != null and companyWechatIds.size > 0">
            AND a.company_wechat_id IN
            <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
                #{item}
            </foreach>


        </if>
        <if test="ex.orderBy == null or ex.orderBy ==''">
            order by a.create_time desc
        </if>
        ${ex.orderBy}
    </select>
    <select id="pageV2OrderShare" resultType="com.gree.mall.manager.bean.order.OrderShareVO">
        select
        ${ex.selected}
        from
        order_share a
        ${ex.query}

        <if test="companyWechatIds != null and companyWechatIds.size > 0">
            AND a.company_wechat_id IN
            <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
                #{item}
            </foreach>


        </if>
        <if test="ex.orderBy == null or ex.orderBy ==''">
            order by a.create_time desc
        </if>
        ${ex.orderBy}
    </select>
    <select id="pageV2Sec" resultType="com.gree.mall.manager.bean.goods.CustomSecSpecBeanVO">
        select
        ${ex.selected}
        from
        sec_kill_activity_spec a
        ${ex.query}

        <if test="companyWechatIds != null and companyWechatIds.size > 0">
            AND a.company_wechat_id IN
            <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
                #{item}
            </foreach>


        </if>
        <if test="ex.orderBy == null or ex.orderBy ==''">
            order by a.create_time desc
        </if>
        ${ex.orderBy}
    </select>
    <select id="pageV2Activity" resultType="com.gree.mall.manager.bean.goods.SecKillActivityStageBeanVO">
        select
        ${ex.selected}
        from
        sec_kill_activity a
        ${ex.query}

        <if test="companyWechatIds != null and companyWechatIds.size > 0">
            AND a.company_wechat_id IN
            <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
                #{item}
            </foreach>


        </if>
        <if test="ex.orderBy == null or ex.orderBy ==''">
            order by a.create_time desc
        </if>
        ${ex.orderBy}
    </select>
    <select id="pageV2Group" resultType="com.gree.mall.manager.bean.goods.PromotionGroupListVO">
        select
        ${ex.selected}
        from
        promotion_group a
        ${ex.query}

        <if test="companyWechatIds != null and companyWechatIds.size > 0">
            AND a.company_wechat_id IN
            <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
                #{item}
            </foreach>


        </if>
        <if test="ex.orderBy == null or ex.orderBy ==''">
            order by a.create_time desc
        </if>
        ${ex.orderBy}
    </select>
    <select id="pageV2Coupon" resultType="com.gree.mall.manager.bean.coupon.CouponPageBeanVO">
        select
        ${ex.selected}
        from
        coupon cp
        ${ex.query}

        <if test="companyWechatIds != null and companyWechatIds.size > 0">
            AND cp.company_wechat_id IN
            <foreach item="item" index="index" collection="companyWechatIds" open="(" separator="," close=")">
                #{item}
            </foreach>


        </if>
        <if test="ex.orderBy == null or ex.orderBy ==''">
            order by cp.create_time desc
        </if>
        ${ex.orderBy}

    </select>
</mapper>