|  | @@ -2,22 +2,6 @@
 | 
	
		
			
				|  |  |  <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
 | 
	
		
			
				|  |  |  <mapper namespace="com.ym.mec.biz.dal.dao.StudentManageDao">
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    <resultMap id="studentManageListDto" type="com.ym.mec.biz.dal.dto.StudentManageListDto">
 | 
	
		
			
				|  |  | -        <result property="userId" column="user_id_"/>
 | 
	
		
			
				|  |  | -        <result property="realName" column="real_name_"/>
 | 
	
		
			
				|  |  | -        <result property="nation" column="nation_"/>
 | 
	
		
			
				|  |  | -        <result property="organId" column="organ_id_"/>
 | 
	
		
			
				|  |  | -        <result property="parentsPhone" column="parents_phone_"/>
 | 
	
		
			
				|  |  | -        <result property="parentsName" column="real_name_"/>
 | 
	
		
			
				|  |  | -        <result property="gender" column="gender_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 | 
	
		
			
				|  |  | -        <result property="username" column="username_"/>
 | 
	
		
			
				|  |  | -        <result property="birthdate" column="birthdate_"/>
 | 
	
		
			
				|  |  | -        <result property="currentGrade" column="current_grade_"/>
 | 
	
		
			
				|  |  | -        <result property="currentClass" column="current_class_"/>
 | 
	
		
			
				|  |  | -        <result property="isActive" column="isActive_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 | 
	
		
			
				|  |  | -        <result property="isMake" column="isMake_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 | 
	
		
			
				|  |  | -        <!--<collection property="musicGroups" resultMap="musicGroup" javaType="list"/>-->
 | 
	
		
			
				|  |  | -    </resultMap>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <resultMap id="studentManageCourseListDto" type="com.ym.mec.biz.dal.dto.StudentManageCourseListDto">
 | 
	
		
			
				|  |  |          <result property="classGroupId" column="class_group_id_" />
 | 
	
	
		
			
				|  | @@ -702,9 +686,47 @@
 | 
	
		
			
				|  |  |              #{item}
 | 
	
		
			
				|  |  |          </foreach>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  | -    <select id="queryHasCourseStudent" resultMap="StudentHasCourseDtoMap">
 | 
	
		
			
				|  |  | -        SELECT su.id_,GROUP_CONCAT(DISTINCT su.username_) username_,GROUP_CONCAT(DISTINCT mg.name_) music_group_name_,
 | 
	
		
			
				|  |  | -        GROUP_CONCAT(DISTINCT vg.name_) vip_group_name_,GROUP_CONCAT(DISTINCT o.name_) organ_name_,GROUP_CONCAT(DISTINCT s.name_) music_group_subject_
 | 
	
		
			
				|  |  | +    <resultMap id="studentManageListDto" type="com.ym.mec.biz.dal.dto.StudentManageListDto">
 | 
	
		
			
				|  |  | +        <result property="userId" column="user_id_"/>
 | 
	
		
			
				|  |  | +        <result property="realName" column="real_name_"/>
 | 
	
		
			
				|  |  | +        <result property="nation" column="nation_"/>
 | 
	
		
			
				|  |  | +        <result property="parentsPhone" column="parents_phone_"/>
 | 
	
		
			
				|  |  | +        <result property="parentsName" column="real_name_"/>
 | 
	
		
			
				|  |  | +        <result property="gender" column="gender_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 | 
	
		
			
				|  |  | +        <result property="username" column="username_"/>
 | 
	
		
			
				|  |  | +        <result property="birthdate" column="birthdate_"/>
 | 
	
		
			
				|  |  | +        <result property="currentGrade" column="current_grade_"/>
 | 
	
		
			
				|  |  | +        <result property="currentClass" column="current_class_"/>
 | 
	
		
			
				|  |  | +        <result property="isActive" column="isActive_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 | 
	
		
			
				|  |  | +        <result property="isMake" column="isMake_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 | 
	
		
			
				|  |  | +        <result property="hasCourse" column="hasCourse_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 | 
	
		
			
				|  |  | +        <result property="hasPracticeCourse" column="hasPracticeCourse_" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
 | 
	
		
			
				|  |  | +        <result property="musicGroupName" column="music_group_name_"/>
 | 
	
		
			
				|  |  | +        <result property="musicGroupStatus" column="music_group_status_"/>
 | 
	
		
			
				|  |  | +        <result property="vipGroupName" column="vip_group_name_"/>
 | 
	
		
			
				|  |  | +        <result property="vipGroupStatus" column="vip_group_status_"/>
 | 
	
		
			
				|  |  | +        <result property="organName" column="organ_name_"/>
 | 
	
		
			
				|  |  | +        <result property="subjectName" column="music_group_subject_"/>
 | 
	
		
			
				|  |  | +    </resultMap>
 | 
	
		
			
				|  |  | +    <select id="queryHasCourseStudent" resultMap="studentManageListDto">
 | 
	
		
			
				|  |  | +        SELECT su.id_ user_id_,su.username_,su.gender_,GROUP_CONCAT(DISTINCT sr.parents_name_)parents_name_,
 | 
	
		
			
				|  |  | +        GROUP_CONCAT(DISTINCT sr.parents_phone_)parents_phone_,
 | 
	
		
			
				|  |  | +        GROUP_CONCAT(DISTINCT mg.name_) music_group_name_,
 | 
	
		
			
				|  |  | +        GROUP_CONCAT(DISTINCT CASE WHEN sr.music_group_status_ = 'NORMAL' THEN '在读'
 | 
	
		
			
				|  |  | +        WHEN sr.music_group_status_ = 'LEAVE' THEN '请假'
 | 
	
		
			
				|  |  | +        WHEN sr.music_group_status_ = 'QUIT' THEN '退班'
 | 
	
		
			
				|  |  | +        WHEN sr.music_group_status_ = 'QUIT_SCHOOL' THEN '休学' ELSE NULL END) music_group_status_,
 | 
	
		
			
				|  |  | +        GROUP_CONCAT(DISTINCT vg.name_) vip_group_name_,
 | 
	
		
			
				|  |  | +        GROUP_CONCAT(DISTINCT CASE WHEN cgsm.status_ = 'NORMAL' THEN '在读'
 | 
	
		
			
				|  |  | +        WHEN cgsm.status_ = 'LEAVE' THEN '请假'
 | 
	
		
			
				|  |  | +        WHEN cgsm.status_ = 'QUIT' THEN '退班'
 | 
	
		
			
				|  |  | +        WHEN cgsm.status_ = 'QUIT_SCHOOL' THEN '休学' ELSE NULL END) vip_group_status_,
 | 
	
		
			
				|  |  | +        GROUP_CONCAT(DISTINCT o.name_) organ_name_,
 | 
	
		
			
				|  |  | +        GROUP_CONCAT(s.name_) music_group_subject_,
 | 
	
		
			
				|  |  | +        CASE WHEN GROUP_CONCAT(DISTINCT cssp.id_) IS NULL THEN 0 ELSE 1 END hasCourse_,
 | 
	
		
			
				|  |  | +        CASE WHEN GROUP_CONCAT(DISTINCT pla.id_) IS NULL THEN 0 ELSE 1 END isMake_,
 | 
	
		
			
				|  |  | +        CASE WHEN su.password_ IS NULL THEN 0 ELSE 1 END isActive_,
 | 
	
		
			
				|  |  | +        CASE WHEN GROUP_CONCAT(DISTINCT cssp1.id_) IS NULL THEN 0 ELSE 1 END hasPracticeCourse_
 | 
	
		
			
				|  |  |          FROM sys_user su
 | 
	
		
			
				|  |  |          LEFT JOIN course_schedule_student_payment cssp ON su.id_ = cssp.user_id_
 | 
	
		
			
				|  |  |          LEFT JOIN music_group mg ON cssp.music_group_id_ = mg.id_ AND cssp.group_type_ = 'MUSIC'
 | 
	
	
		
			
				|  | @@ -712,12 +734,40 @@
 | 
	
		
			
				|  |  |          LEFT JOIN organization o ON su.organ_id_ = o.id_
 | 
	
		
			
				|  |  |          LEFT JOIN student_registration sr ON su.id_ = sr.user_id_ AND cssp.music_group_id_ = sr.music_group_id_
 | 
	
		
			
				|  |  |          LEFT JOIN `subject` s ON s.id_ = sr.actual_subject_id_
 | 
	
		
			
				|  |  | -        WHERE cssp.id_ IS NOT NULL AND su.user_type_ LIKE '%STUDENT%'
 | 
	
		
			
				|  |  | -        AND (sr.music_group_status_ != 'QUIT' OR sr.id_ IS NULL)
 | 
	
		
			
				|  |  | -        AND (mg.status_ = 'PROGRESS' OR vg.group_status_ IN (2,4))
 | 
	
		
			
				|  |  | +        LEFT JOIN practice_lesson_apply pla on pla.user_id_ = su.id_
 | 
	
		
			
				|  |  | +        LEFT JOIN course_schedule_student_payment cssp1 ON su.id_ = cssp1.user_id_ AND cssp1.group_type_ = 'PRACTICE'
 | 
	
		
			
				|  |  | +        LEFT JOIN class_group_student_mapper cgsm ON su.id_ = cgsm.user_id_ AND cgsm.group_type_ = 'VIP'
 | 
	
		
			
				|  |  | +        WHERE su.user_type_ LIKE '%STUDENT%'
 | 
	
		
			
				|  |  | +        <if test="hasPracticeCourse != null and hasPracticeCourse == true">
 | 
	
		
			
				|  |  | +            AND cssp1.id_ IS NOT NULL
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="hasPracticeCourse != null and hasPracticeCourse == false">
 | 
	
		
			
				|  |  | +            AND cssp1.id_ IS NULL
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="hasCourse != null and hasCourse == true">
 | 
	
		
			
				|  |  | +            AND cssp.id_ IS NOT NULL
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="hasCourse != null and hasCourse == false">
 | 
	
		
			
				|  |  | +            AND cssp.id_ IS NULL
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="isActive != null and isActive == true">
 | 
	
		
			
				|  |  | +            AND su.password_ IS NOT NULL
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="isActive != null and isActive == false">
 | 
	
		
			
				|  |  | +            AND su.password_ IS NULL
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  |          <if test="organId != null and organId != ''">
 | 
	
		
			
				|  |  |              AND FIND_IN_SET(su.organ_id_,#{organId})
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  | +        <if test="search != null and search != ''">
 | 
	
		
			
				|  |  | +            AND (su.phone_ LIKE CONCAT('%',#{search},'%') OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.id_ LIKE CONCAT('%',#{search},'%'))
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="isMake != null and isMake == true">
 | 
	
		
			
				|  |  | +            AND pla.id_ IS NOT NULL
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="isMake != null and isMake == false">
 | 
	
		
			
				|  |  | +            AND pla.id_ IS NULL
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  |          GROUP BY su.id_
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="getHasCourse" resultType="java.lang.Integer">
 |