<?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.yida.data.user.mapper.EduStudentApplyForMapper">

  <select id="listStudentApplyFor" resultType="com.yida.data.common.core.entity.user.EduStudentApplyFor">
    SELECT * from edu_student_apply_for
    WHERE del_flag = 0
    <if test="dto.studentName!=null and dto.studentName!=''">
      and student_name LIKE CONCAT('%',#{dto.studentName},'%')
    </if>
    <if test="dto.studentNumber!=null and dto.studentNumber!=''">
      and student_number LIKE CONCAT('%',#{dto.studentNumber},'%')
    </if>
    <if test="dto.schoolIdList != null and dto.schoolIdList.size() > 0">
      and school_id in
      <foreach collection="dto.schoolIdList" close=")" open="(" separator="," item="item">
        #{item}
      </foreach>
    </if>
    <if test="dto.sectionId!=null">
      and section_id =#{dto.sectionId}
    </if>
    <if test="dto.campusId!=null">
      and campus_id =#{dto.campusId}
    </if>
    <if test="dto.gradeId!=null">
      and grade_id =#{dto.gradeId}
    </if>
    <if test="dto.classId!=null">
      and class_id =#{dto.classId}
    </if>
    order by status, create_date desc
  </select>

</mapper>