<?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.xueyi.system.meeting.mapper.DmMeetingOrdersMapper">
    <select id="queryByOrder" parameterType="Object" resultType="DmMeetingOrdersPo">
        SELECT * FROM dm_meeting_orders WHERE space_id = #{spaceId} AND order_date = #{date} AND del_flag = 0  AND ((start_time  <![CDATA[<=]]> #{startTime} AND end_time<![CDATA[>]]> #{startTime}) or (start_time  <![CDATA[<]]> #{endTime} AND end_time <![CDATA[>=]]> #{endTime}))
    </select>

    <select id="findListByPerson" parameterType="Object" resultType="DmMeetingOrdersPo">
        SELECT * FROM dm_meeting_orders where  del_flag = 0 AND (order_date <![CDATA[>]]> CURRENT_DATE or (order_date = CURRENT_DATE AND start_time <![CDATA[>]]> current_time)) AND order_by = #{orderBy}
    </select>


    <select id="findLastByEmpId" parameterType="Object" resultType="DmMeetingOrdersPo">
        SELECT * FROM dm_meeting_orders where  create_by = #{empId} AND del_flag = 0 order By id desc LIMIT 1
    </select>

    <select id="findListByDate" parameterType="Object" resultType="DmMeetingOrdersPo">
        SELECT * FROM dm_meeting_orders WHERE order_date = #{orderDate} AND del_flag = 0 AND space_id = #{spaceId}
    </select>

    <select id="findAllListByDate" parameterType="Object" resultType="DmMeetingOrdersPo">
        SELECT * FROM dm_meeting_orders where  del_flag = 0 AND (order_date <![CDATA[>]]> #{date} or (order_date = #{date} AND end_time <![CDATA[>]]> #{time})) AND space_id = #{spaceId}
    </select>

    <select id="findListByDateStr" parameterType="Object" resultType="DmMeetingOrdersPo">
        SELECT * FROM dm_meeting_orders WHERE order_date = #{orderDate} AND del_flag = 0
    </select>
    <select id="findAllList" resultType="DmMeetingOrdersPo">
        SELECT * FROM dm_meeting_orders where  del_flag = 0 AND (order_date <![CDATA[>]]> CURRENT_DATE or (order_date = CURRENT_DATE AND end_time <![CDATA[<]]> current_time))
    </select>
</mapper>