<?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.gxwebsoft.common.system.mapper.OrderInfoMapper">

    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM sys_order_info a
        <where>
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.oid != null">
                AND a.oid = #{param.oid}
            </if>
            <if test="param.sid != null">
                AND a.sid = #{param.sid}
            </if>
            <if test="param.fid != null">
                AND a.fid = #{param.fid}
            </if>
            <if test="param.siteName != null">
                AND a.site_name LIKE CONCAT('%', #{param.siteName}, '%')
            </if>
            <if test="param.fieldName != null">
                AND a.field_name LIKE CONCAT('%', #{param.fieldName}, '%')
            </if>
            <if test="param.dateTime != null">
                AND a.date_time LIKE CONCAT('%', #{param.dateTime}, '%')
            </if>
            <if test="param.price != null">
                AND a.price = #{param.price}
            </if>
            <if test="param.childrenPrice != null">
                AND a.children_price = #{param.childrenPrice}
            </if>
            <if test="param.adultNum != null">
                AND a.adult_num = #{param.adultNum}
            </if>
            <if test="param.childrenNum != null">
                AND a.children_num = #{param.childrenNum}
            </if>
            <if test="param.payStatus != null">
                AND a.pay_status = #{param.payStatus}
            </if>
            <if test="param.isFree != null">
                AND a.is_free = #{param.isFree}
            </if>
            <if test="param.isChildren != null">
                AND a.is_children = #{param.isChildren}
            </if>
            <if test="param.type != null">
                AND a.type = #{param.type}
            </if>
            <if test="param.mergeData != null">
                AND a.merge_data LIKE CONCAT('%', #{param.mergeData}, '%')
            </if>
            <if test="param.startTime != null">
                AND a.start_time = #{param.startTime}
            </if>
            <if test="param.orderTime != null">
                AND a.order_time = #{param.orderTime}
            </if>
            <if test="param.timeFlag != null">
                AND a.time_flag LIKE CONCAT('%', #{param.timeFlag}, '%')
            </if>
            <if test="param.deleted != null">
                AND a.deleted = #{param.deleted}
            </if>
            <if test="param.deleted == null">
                AND a.deleted = 0
            </if>
        </where>
    </sql>

    <!-- 分页查询 -->
    <select id="selectPageRel" resultType="com.gxwebsoft.common.system.entity.OrderInfo">
        <include refid="selectSql"></include>
    </select>

    <!-- 查询全部 -->
    <select id="selectListRel" resultType="com.gxwebsoft.common.system.entity.OrderInfo">
        <include refid="selectSql"></include>
    </select>

</mapper>
