<?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.OrderTourReceivedStatisticsMapper">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.xxfc.platform.order.entity.OrderTourReceivedStatistics" id="orderTourReceivedStatisticsMap">
        <result property="id" column="id"/>
        <result property="year" column="year"/>
        <result property="month" column="month"/>
        <result property="date" column="date"/>
        <result property="weekOfYear" column="week_of_year"/>
        <result property="companyName" column="company_name"/>
        <result property="extraAmount" column="extra_amount"/>
        <result property="lateFeeAmount" column="late_fee_amount"/>
        <result property="orderRefundAmount" column="order_refund_amount"/>
        <result property="totalAmount" column="total_amount"/>
        <result property="totalQuantity" column="total_quantity"/>
        <result property="hasPay" column="has_pay"/>
        <result property="orderOrigin" column="order_origin"/>
        <result property="payWay" column="pay_way"/>
        <result property="companyId" column="company_id"/>
        <result property="crtTime" column="crt_time"/>
    </resultMap>

    <select id="selectOrderTourReceivedStatistics" resultMap="orderTourReceivedStatisticsMap">
       select * from  `order_tour_received_statistics` where 1=1
        <if test="orderState!=null">
            and `is_finish`=#{orderState}
        </if>
        <if test="orderOrigin!=null">
            and `order_origin`=#{orderOrigin}
        </if>
        <if test="payWay!=null">
            and `pay_way`=#{payWay}
        </if>
        <if test="startDate!=null and endDate!=null">
            and `date` between #{startDate} and #{endDate}
        </if>
        <if test="startDate!=null and endDate==null">
            and <![CDATA[
                `date` >= #{startDate}
            ]]>
        </if>
        <if test="startDate==null and endDate!=null">
            and <![CDATA[
                `date` <= #{endDate}
            ]]>
        </if>
    </select>

</mapper>