<?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.sqx.modules.member.dao.SpecialFavorStudentDao">

    <select id="pages" resultType="com.sqx.modules.member.vo.SpecialFavorStudentVO">
        select
            sfs.id,
            sfs.name,
            sfs.student_number,
            sfs.verify_status,
            sfs.create_time,
            sfs.verify_user_id,
            tu.user_name as verify_user_name,
            tu.phone as verify_user_phone,
            sfs.last_verify_time
        from
            special_favor_student sfs
            left join
                tb_user tu on sfs.verify_user_id = tu.user_id
        <where>
            and sfs.del_flag = 0
            <if test="query.name != null and query.name != ''">
                and sfs.name like concat('%', #{query.name}, '%')
            </if>
            <if test="query.studentNumber != null and query.studentNumber != ''">
                and sfs.student_number like concat('%', #{query.studentNumber}, '%')
            </if>
            <if test="query.verifyStatus != null and query.verifyStatus != ''">
                and sfs.verify_status = #{query.verifyStatus}
            </if>
            <if test="query.startTime != null">
                and sfs.create_time >= #{query.startTime}
            </if>
            <if test="query.endTime != null">
                and sfs.create_time <![CDATA[<=]]> #{query.endTime}
            </if>
        </where>
        order by sfs.create_time desc
    </select>
</mapper>
