|
@@ -696,6 +696,107 @@
|
|
|
</select>
|
|
|
<select id="selectPianoGroupDetail"
|
|
|
resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupPianoDetailVo">
|
|
|
-
|
|
|
+ SELECT
|
|
|
+ cs.id_ AS courseId,
|
|
|
+ sb.id_ AS subjectId,
|
|
|
+ sb.name_ AS subjectName,
|
|
|
+ cs.teacher_id_ AS teacherId,
|
|
|
+ tu.username_ AS teacherName,
|
|
|
+ tu.real_name_ AS teacherRealName,
|
|
|
+ cs.status_ AS `status`,
|
|
|
+ a.studentCount AS studentCount,
|
|
|
+ (cs.single_course_time_ * a.studentCount) AS course_time_,
|
|
|
+ cs.start_time_ AS startTime,
|
|
|
+ cs.end_time_ AS endTime,
|
|
|
+ b.teacherInSign AS teacherInSign,
|
|
|
+ b.teacherOutSign AS teacherOutSign
|
|
|
+ FROM course_schedule cs
|
|
|
+ LEFT JOIN course_group cg ON cs.course_group_id_ = cg.id_
|
|
|
+ LEFT JOIN `subject` sb ON cg.subject_id_ = sb.id_
|
|
|
+ LEFT JOIN sys_user tu ON cs.teacher_id_ = tu.id_
|
|
|
+ LEFT JOIN (SELECT course_id_,COUNT(1) AS studentCount FROM course_schedule_student_payment WHERE course_type_='PIANO_ROOM_CLASS' GROUP BY course_id_) a ON cs.id_=a.course_id_
|
|
|
+ LEFT JOIN (SELECT cs.id_ AS cid,( CASE WHEN cs.start_time_ >= ta.sign_in_time_ THEN 1 ELSE 0 END ) AS teacherInSign,( CASE WHEN cs.end_time_ <= ta.sign_out_time_ THEN 1 ELSE 0 END ) AS teacherOutSign
|
|
|
+ FROM course_schedule cs LEFT JOIN teacher_attendance ta ON cs.id_=ta.course_schedule_id_ WHERE cs.type_='PIANO_ROOM_CLASS') b ON cs.id_=b.cid
|
|
|
+ WHERE cs.type_='PIANO_ROOM_CLASS'
|
|
|
+ AND cs.course_group_id_=#{param.courseGroupId}
|
|
|
+ <if test="param.search != null and param.search != ''">
|
|
|
+ AND cs.id_ LIKE concat('%',#{param.search},'%')
|
|
|
+ </if>
|
|
|
+ <if test="param.status != null and param.status != ''">
|
|
|
+ AND cs.status_ = #{param.status}
|
|
|
+ </if>
|
|
|
+ <if test="param.startTime != null">
|
|
|
+ AND cs.start_time_ <= #{param.startTime}
|
|
|
+ </if>
|
|
|
+ <if test="param.endTime != null">
|
|
|
+ AND cs.start_time_ >= #{param.endTime}
|
|
|
+ </if>
|
|
|
+ <if test="param.teacherSign == 1">
|
|
|
+ AND b.teacherInSign = #{param.teacherSign}
|
|
|
+ </if>
|
|
|
+ <if test="param.teacherSign == 0">
|
|
|
+ AND b.teacherOutSign = #{param.teacherSign}
|
|
|
+ </if>
|
|
|
+ <if test="param.studentSign != null">
|
|
|
+ AND cs.id_ IN
|
|
|
+ <foreach collection="param.courseIds" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="studentSign" resultType="com.yonge.cooleshow.biz.dal.vo.StudentSignVo">
|
|
|
+ SELECT
|
|
|
+ p.course_id_ AS courseId,
|
|
|
+ p.user_id_ AS userId,
|
|
|
+ u.username_ AS userName,
|
|
|
+ u.real_name_ AS realName,
|
|
|
+ ( CASE WHEN c.start_time_ >= a.sign_in_time_ THEN 1 ELSE 0 END ) AS studentInSign,
|
|
|
+ ( CASE WHEN c.end_time_ <= a.sign_out_time_ THEN 1 ELSE 0 END ) AS studentOutSign
|
|
|
+ FROM course_schedule_student_payment p
|
|
|
+ LEFT JOIN sys_user u ON p.user_id_=u.id_
|
|
|
+ LEFT JOIN course_schedule c ON p.course_id_=c.id_
|
|
|
+ LEFT JOIN student_attendance a ON p.user_id_=a.student_id_
|
|
|
+ <where>
|
|
|
+ <if test="courseId !=null">
|
|
|
+ AND p.course_id_=#{courseId}
|
|
|
+ </if>
|
|
|
+ <if test="type !=null and type!=''">
|
|
|
+ AND p.course_type_=#{type}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <select id="selectPianoGroupStudent" resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupPianoVo">
|
|
|
+ SELECT DISTINCT
|
|
|
+ g.id_ AS courseGroupId,
|
|
|
+ g.name_ AS courseGroupName,
|
|
|
+ s.id_ AS subjectId,
|
|
|
+ s.name_ AS subjectName,
|
|
|
+ g.teacher_id_ AS teacherId,
|
|
|
+ u.username_ AS teacherName,
|
|
|
+ u.real_name_ AS teacherRealName,
|
|
|
+ g.course_num_ AS courseNum,
|
|
|
+ IFNULL(cm.count_,0) AS completeCount,
|
|
|
+ g.status_ AS `status`,
|
|
|
+ st.start_time_ AS startTime
|
|
|
+ FROM course_schedule_student_payment p
|
|
|
+ LEFT JOIN course_group g ON p.course_group_id_=g.id_
|
|
|
+ LEFT JOIN `subject` s ON g.subject_id_=s.id_
|
|
|
+ LEFT JOIN sys_user u ON g.teacher_id_=u.id_
|
|
|
+ LEFT JOIN (SELECT course_group_id_,COUNT(1) AS count_ FROM course_schedule WHERE type_='PIANO_ROOM_CLASS' AND status_='COMPLETE' GROUP BY course_group_id_) cm ON p.course_group_id_=cm.course_group_id_
|
|
|
+ LEFT JOIN (SELECT course_group_id_,start_time_ FROM course_schedule WHERE type_='PIANO_ROOM_CLASS' GROUP BY course_group_id_) st ON p.course_group_id_=st.course_group_id_
|
|
|
+ WHERE p.course_type_='PIANO_ROOM_CLASS'
|
|
|
+ AND p.user_id_=#{param.studentId}
|
|
|
+ <if test="param.search != null and param.search != ''">
|
|
|
+ AND (
|
|
|
+ g.id_ LIKE concat('%',#{param.search},'%') OR
|
|
|
+ g.name_ LIKE concat('%',#{param.search},'%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="param.subjectId != null">
|
|
|
+ AND s.id_ = #{param.subjectId}
|
|
|
+ </if>
|
|
|
+ <if test="param.status != null and param.status != ''">
|
|
|
+ AND g.status_ = #{param.status}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
</mapper>
|