<?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.xxfc.platform.order.mapper.DailyMembersOrderStatisticsMapper">
    <!--    获取会员订单成交金-->
    <select id="getTravelGmv" resultType="HashMap">
        select
        date(DATE_SUB(now(),interval #{day} day)) as oneDay,
        IFNULL(SUM(real_amount),0) as gmv
        from
        base_order
        where
        type=3
        AND
        date(FROM_UNIXTIME(pay_time/1000))=date(DATE_SUB(now(),interval #{day} day))
    </select>

    <select id="monthOrderTotal" resultType="com.xxfc.platform.order.entity.OrderStatistics">
        SELECT
        IFNULL( sum( gmv ), 0 ) AS totalGmv
        FROM
        daily_vehicle_order_statistics
        WHERE
        1=1
        <if test="companyId != null">
            and branch_company_id = #{companyId}
        </if>

    </select>
    <!--    <select id="updateByExampleSelective">-->
    <!--                SELECT-->
    <!--        IFNULL(sum(gmv),0) as totalGmv-->
    <!--        FROM-->
    <!--        daily_members_order_statistics-->
    <!--        WHERE-->
    <!--        branch_company_id =#{companyId}-->
    <!--        and-->
    <!--        DATE_FORMAT(one_day,'%Y-%c')=DATE_FORMAT(DATE_SUB(NOW(),interval 1 day),'%Y-%c')-->

    <!--    </select>-->
</mapper>