|  | @@ -122,7 +122,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="findStudentsByOrganId" resultMap="studentManageListDto">
 | 
	
		
			
				|  |  |          SELECT su.id_ user_id_,su.username_,su.gender_,su.phone_ parents_phone_,su.real_name_,su.birthdate_,su.nation_,
 | 
	
		
			
				|  |  | -        case when su.password_ is null then 0 else 1 end isActive_
 | 
	
		
			
				|  |  | +        CASE WHEN su.password_ IS NULL THEN 0 ELSE 1 END isActive_
 | 
	
		
			
				|  |  |          FROM sys_user su
 | 
	
		
			
				|  |  |          <include refid="findStudentsByOrganIdSql"/>
 | 
	
		
			
				|  |  |          ORDER BY su.create_time_ DESC
 | 
	
	
		
			
				|  | @@ -138,10 +138,10 @@
 | 
	
		
			
				|  |  |                  AND (su.phone_ LIKE CONCAT('%',#{search},'%') OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.id_ LIKE CONCAT('%',#{search},'%'))
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="isActive != null and isActive == true">
 | 
	
		
			
				|  |  | -            	and su.password_ is not null
 | 
	
		
			
				|  |  | +                AND su.password_ is not null
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="isActive != null and isActive == false">
 | 
	
		
			
				|  |  | -            	and su.password_ is null
 | 
	
		
			
				|  |  | +                AND su.password_ is null
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |              <if test="userIds != null">
 | 
	
		
			
				|  |  |                  AND su.id_ IN
 | 
	
	
		
			
				|  | @@ -156,7 +156,7 @@
 | 
	
		
			
				|  |  |          SELECT COUNT(DISTINCT su.id_)
 | 
	
		
			
				|  |  |          FROM sys_user su
 | 
	
		
			
				|  |  |          LEFT JOIN student_registration sr ON su.id_ = sr.user_id_
 | 
	
		
			
				|  |  | -        <include refid="findStudentsByOrganIdSql"/>
 | 
	
		
			
				|  |  | +        <include refid="queryHasCourseSql"/>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="findStudentBaseInfoByUserID" resultMap="studentManageListDto">
 | 
	
		
			
				|  |  |          SELECT su.username_,su.gender_,su.birthdate_,su.real_name_,su.id_ user_id_,
 | 
	
	
		
			
				|  | @@ -535,18 +535,71 @@
 | 
	
		
			
				|  |  |              AND vg.status_ = #{vipGroupStatus}
 | 
	
		
			
				|  |  |          </if>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  | +    <sql id="queryHasCourseSql">
 | 
	
		
			
				|  |  | +        WHERE su.user_type_ = 'STUDENT' AND cs.status_ != 'OVER'
 | 
	
		
			
				|  |  | +        <if test="organId != null">
 | 
	
		
			
				|  |  | +            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="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>
 | 
	
		
			
				|  |  | +    </sql>
 | 
	
		
			
				|  |  |      <select id="queryHasCourse" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | -        SELECT DISTINCT cssp.user_id_ FROM course_schedule_student_payment cssp
 | 
	
		
			
				|  |  | +        SELECT su.id_ FROM sys_user su
 | 
	
		
			
				|  |  | +        LEFT JOIN course_schedule_student_payment cssp ON cssp.user_id_ = su.id_
 | 
	
		
			
				|  |  |          LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
 | 
	
		
			
				|  |  | -        WHERE cs.status_ != 'OVER'
 | 
	
		
			
				|  |  | +        <include refid="queryHasCourseSql"/>
 | 
	
		
			
				|  |  | +        GROUP BY su.id_
 | 
	
		
			
				|  |  | +        ORDER BY su.create_time_ DESC
 | 
	
		
			
				|  |  | +        <include refid="global.limit"/>
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +    <select id="countHasCourse" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | +        SELECT COUNT(DISTINCT su.id_) FROM sys_user su
 | 
	
		
			
				|  |  | +        LEFT JOIN course_schedule_student_payment cssp ON cssp.user_id_ = su.id_
 | 
	
		
			
				|  |  | +        LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
 | 
	
		
			
				|  |  | +        <include refid="queryHasCourseSql"/>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |      <select id="queryNotCourse" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | -        SELECT su.id_ FROM sys_user su WHERE su.id_ NOT IN
 | 
	
		
			
				|  |  | -        (SELECT DISTINCT cssp.user_id_ FROM course_schedule_student_payment cssp
 | 
	
		
			
				|  |  | -                LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
 | 
	
		
			
				|  |  | -        WHERE cs.status_ != 'OVER')
 | 
	
		
			
				|  |  | -        AND su.user_type_ = 'STUDENT'
 | 
	
		
			
				|  |  | +        SELECT su.id_ FROM sys_user su
 | 
	
		
			
				|  |  | +        LEFT JOIN course_schedule_student_payment cssp ON cssp.user_id_ = su.id_
 | 
	
		
			
				|  |  | +        LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_ AND cs.status_ != 'OVER'
 | 
	
		
			
				|  |  | +        <include refid="queryNotCourseSql"/>
 | 
	
		
			
				|  |  | +        GROUP BY su.id_
 | 
	
		
			
				|  |  | +        HAVING COUNT(cs.id_) = 0
 | 
	
		
			
				|  |  | +        ORDER BY su.create_time_ DESC
 | 
	
		
			
				|  |  | +        <include refid="global.limit"/>
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  | +    <select id="countNotCourse" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | +        SELECT COUNT(e.id_) FROM (SELECT su.id_ FROM sys_user su
 | 
	
		
			
				|  |  | +        LEFT JOIN course_schedule_student_payment cssp ON cssp.user_id_ = su.id_
 | 
	
		
			
				|  |  | +        LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_ AND cs.status_ != 'OVER'
 | 
	
		
			
				|  |  | +        <include refid="queryNotCourseSql"/>
 | 
	
		
			
				|  |  | +        GROUP BY su.id_
 | 
	
		
			
				|  |  | +        HAVING COUNT(cs.id_) = 0)e
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +    <sql id="queryNotCourseSql">
 | 
	
		
			
				|  |  | +        <where>
 | 
	
		
			
				|  |  | +            su.user_type_ = 'STUDENT'
 | 
	
		
			
				|  |  | +            <if test="organId != null">
 | 
	
		
			
				|  |  | +                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="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>
 | 
	
		
			
				|  |  | +        </where>
 | 
	
		
			
				|  |  | +    </sql>
 | 
	
		
			
				|  |  |      <select id="queryStudentHasCourse" resultType="java.util.Map">
 | 
	
		
			
				|  |  |          SELECT cssp.user_id_ 'key',CASE WHEN COUNT(cssp.id_ AND cs.status_ != 'OVER') = 0 THEN 0 ELSE 1 END 'value'
 | 
	
		
			
				|  |  |          FROM course_schedule_student_payment cssp
 |