|
@@ -833,4 +833,47 @@
|
|
LEFT JOIN `subject` s ON s.id_ = st.subject_id_list_
|
|
LEFT JOIN `subject` s ON s.id_ = st.subject_id_list_
|
|
WHERE cssp.course_schedule_id_ = #{courseScheduleId}
|
|
WHERE cssp.course_schedule_id_ = #{courseScheduleId}
|
|
</select>
|
|
</select>
|
|
|
|
+ <select id="hasCourse" resultType="java.lang.Boolean">
|
|
|
|
+ SELECT CASE WHEN s.user_id_ = NULL THEN 0 ELSE 1 END hasCourse FROM student s
|
|
|
|
+ LEFT JOIN sys_user su ON s.user_id_ = su.id_
|
|
|
|
+ LEFT JOIN course_schedule_student_payment cssp FORCE INDEX(group_type_) ON cssp.user_id_ = s.user_id_
|
|
|
|
+ WHERE cssp.group_type_ IN ('VIP','PRACTICE')
|
|
|
|
+ <if test="organId != null">
|
|
|
|
+ su.organ_id_ = #{organId}
|
|
|
|
+ </if>
|
|
|
|
+ LIMIT 1
|
|
|
|
+ </select>
|
|
|
|
+ <resultMap id="StudentVipPracticeExportDto" type="com.ym.mec.biz.dal.dto.StudentVipPracticeExportDto">
|
|
|
|
+ <result property="userId" column="user_id_"/>
|
|
|
|
+ <result property="username" column="username_"/>
|
|
|
|
+ <result property="vipOverNum" column="vip_over_num_"/>
|
|
|
|
+ <result property="vipNotStartNum" column="vip_not_start_num_"/>
|
|
|
|
+ <result property="vipTeacherIds" column="vip_teacher_ids_"/>
|
|
|
|
+ <result property="vipTeacherNames" column="vip_teacher_names_"/>
|
|
|
|
+ <result property="practiceOverNum" column="practice_over_num_"/>
|
|
|
|
+ <result property="practiceNotStartNum" column="practice_not_start_num_"/>
|
|
|
|
+ <result property="practiceTeacherIds" column="practice_teacher_ids_"/>
|
|
|
|
+ <result property="practiceTeacherNames" column="practice_teacher_names_"/>
|
|
|
|
+ </resultMap>
|
|
|
|
+ <select id="exportStudentVipPractice" resultMap="StudentVipPracticeExportDto">
|
|
|
|
+ SELECT s.user_id_,su.username_,
|
|
|
|
+ COUNT(CASE WHEN cssp.group_type_ = 'VIP' AND cs.status_ != 'NOT_START' THEN 1 ELSE NULL END) vip_over_num_,
|
|
|
|
+ COUNT(CASE WHEN cssp.group_type_ = 'VIP' AND cs.status_ = 'NOT_START' THEN 1 ELSE NULL END) vip_not_start_num_,
|
|
|
|
+ GROUP_CONCAT(DISTINCT (CASE WHEN cssp.group_type_ = 'VIP' THEN sut.id_ ELSE NULL END)) vip_teacher_ids_,
|
|
|
|
+ GROUP_CONCAT(DISTINCT (CASE WHEN cssp.group_type_ = 'VIP' THEN sut.real_name_ ELSE NULL END)) vip_teacher_names_,
|
|
|
|
+ COUNT(CASE WHEN cssp.group_type_ = 'PRACTICE' AND cs.status_ != 'NOT_START' THEN 1 ELSE NULL END) practice_over_num_,
|
|
|
|
+ COUNT(CASE WHEN cssp.group_type_ = 'PRACTICE' AND cs.status_ = 'NOT_START' THEN 1 ELSE NULL END) practice_not_start_num_,
|
|
|
|
+ GROUP_CONCAT(DISTINCT (CASE WHEN cssp.group_type_ = 'PRACTICE' THEN sut.id_ ELSE NULL END)) practice_teacher_ids_,
|
|
|
|
+ GROUP_CONCAT(DISTINCT (CASE WHEN cssp.group_type_ = 'PRACTICE' THEN sut.real_name_ ELSE NULL END)) practice_teacher_names_
|
|
|
|
+ FROM student s
|
|
|
|
+ LEFT JOIN sys_user su ON s.user_id_ = su.id_
|
|
|
|
+ LEFT JOIN course_schedule_student_payment cssp FORCE INDEX(group_type_) ON cssp.user_id_ = s.user_id_
|
|
|
|
+ LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
|
|
|
|
+ LEFT JOIN sys_user sut ON cs.actual_teacher_id_ = sut.id_
|
|
|
|
+ WHERE cssp.group_type_ IN ('VIP','PRACTICE')
|
|
|
|
+ <if test="organId">
|
|
|
|
+ AND su.organ_id_ = #{organId}
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY s.user_id_
|
|
|
|
+ </select>
|
|
</mapper>
|
|
</mapper>
|