|
@@ -4079,8 +4079,9 @@
|
|
|
<select id="queryHasCourseStudentIds" resultType="java.lang.Integer">
|
|
|
SELECT DISTINCT s.user_id_ FROM student s
|
|
|
LEFT JOIN course_schedule_student_payment cssp ON s.user_id_ = cssp.user_id_
|
|
|
- LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_
|
|
|
- WHERE cs.group_type_ = #{groupType} AND cs.del_flag_ = 0 AND cs.pre_course_flag_ = 0
|
|
|
+ LEFT JOIN course_schedule cs ON cs.id_ = cssp.course_schedule_id_ AND cs.group_type_ = #{groupType} AND cs.del_flag_ = 0 AND cs.pre_course_flag_ = 0
|
|
|
+ LEFT JOIN sys_user su ON su.id_ = s.user_id_
|
|
|
+ WHERE 1=1
|
|
|
<if test="hasMember != null">
|
|
|
<if test="hasMember == 1">
|
|
|
AND s.member_rank_setting_id_ IS NOT NULL
|
|
@@ -4089,6 +4090,15 @@
|
|
|
AND s.member_rank_setting_id_ IS NULL
|
|
|
</if>
|
|
|
</if>
|
|
|
+ <if test="subjectId != null">
|
|
|
+ AND s.subject_id_list_ = #{subjectId}
|
|
|
+ </if>
|
|
|
+ <if test="search != null and search != ''">
|
|
|
+ AND (s.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="organId != null and organId != ''">
|
|
|
+ AND FIND_IN_SET(su.organ_id_,#{organId})
|
|
|
+ </if>
|
|
|
<if test="studentIds != null and studentIds.size > 0">
|
|
|
AND s.user_id_ IN
|
|
|
<foreach collection="studentIds" separator="," item="studentId" open="(" close=")">
|
|
@@ -4099,7 +4109,7 @@
|
|
|
GROUP BY s.user_id_ HAVING COUNT(CASE WHEN cs.status_ = 'NOT_START' THEN 1 ELSE NULL END) > 0
|
|
|
</if>
|
|
|
<if test="hasCourse == 0">
|
|
|
- GROUP BY s.user_id_ HAVING COUNT(CASE WHEN cs.status_ = 'NOT_START' THEN 1 ELSE NULL END) <= 0
|
|
|
+ GROUP BY s.user_id_ HAVING COUNT(CASE WHEN cs.status_ = 'NOT_START' THEN 1 ELSE NULL END) <= 0 OR MAX(cs.id_) IS NULL
|
|
|
</if>
|
|
|
</select>
|
|
|
</mapper>
|