<?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.xjrsoft.module.personnel.mapper.ReservationSchoolMapper">
    <select id="getVisionList" resultType="com.xjrsoft.module.attendance.vo.VisitorInfoVo">
        SELECT t1.name,t1.identity_card,t1.phone,t3.name AS respondent_user_name,t2.reason,t4.name AS dept_name,t2.start_time,t2.end_time,t2.create_date FROM reservation_school_people t1
        INNER JOIN reservation_school t2 ON t1.reservation_schoo_id = t2.id
        LEFT JOIN xjr_user t3 ON t2.respondent_user_id = t3.id
        LEFT JOIN xjr_department t4 ON t2.dept_id = t4.id
        WHERE t1.delete_mark = 0 AND t2.delete_mark = 0 AND t2.status = 1
        AND (
            (#{date} between start_time and end_time) or
             (#{date} between  DATE_FORMAT(start_time, '%Y-%m-%d') and DATE_FORMAT(start_time, '%Y-%m-%d'))
            )
    </select>

</mapper>