|
@@ -705,7 +705,7 @@
|
|
|
tu.real_name_ AS teacherRealName,
|
|
|
cs.status_ AS `status`,
|
|
|
a.studentCount AS studentCount,
|
|
|
- (cs.single_course_time_ * a.studentCount) AS course_time_,
|
|
|
+ (cs.single_course_time_ * (a.studentCount+1)*(a.studentCount+1-1)) AS courseTime,
|
|
|
cs.start_time_ AS startTime,
|
|
|
cs.end_time_ AS endTime,
|
|
|
b.teacherInSign AS teacherInSign,
|
|
@@ -799,4 +799,150 @@
|
|
|
AND g.status_ = #{param.status}
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <select id="selectPianoGroupStudentDetail"
|
|
|
+ resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupPianoDetailVo">
|
|
|
+ SELECT * FROM (
|
|
|
+ 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+1)*(a.studentCount+1-1)) AS courseTime,
|
|
|
+ cs.start_time_ AS startTime,
|
|
|
+ cs.end_time_ AS endTime,
|
|
|
+ p.user_id_ AS studentId,
|
|
|
+ (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,
|
|
|
+ (CASE WHEN cs.start_time_ >= sa.sign_in_time_ AND cs.end_time_ <= sa.sign_out_time_ THEN 1 ELSE 0 END) AS studentSign,
|
|
|
+ (CASE WHEN cs.start_time_ >= ta.sign_in_time_ AND cs.end_time_ <= ta.sign_out_time_ THEN 1 ELSE 0 END) AS teacherSign
|
|
|
+ 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 teacher_attendance ta ON cs.id_=ta.course_schedule_id_
|
|
|
+ LEFT JOIN student_attendance sa ON cs.id_=sa.course_schedule_id_
|
|
|
+ LEFT JOIN course_schedule_student_payment p ON cs.id_=p.course_id_
|
|
|
+ WHERE cs.type_='PIANO_ROOM_CLASS'
|
|
|
+ AND p.user_id_=#{param.studentId}
|
|
|
+ AND p.course_group_id_=#{param.courseGroupId}) m
|
|
|
+ <where>
|
|
|
+ <if test="param.search != null and param.search != ''">
|
|
|
+ AND courseId LIKE concat('%',#{param.search},'%')
|
|
|
+ </if>
|
|
|
+ <if test="param.studentSign != null">
|
|
|
+ AND studentSign = #{param.studentSign}
|
|
|
+ </if>
|
|
|
+ <if test="param.teacherSign != null">
|
|
|
+ AND teacherSign = #{param.teacherSign}
|
|
|
+ </if>
|
|
|
+ <if test="param.status != null and param.status != ''">
|
|
|
+ AND `status` = #{param.status}
|
|
|
+ </if>
|
|
|
+ <if test="param.startTime != null">
|
|
|
+ AND startTime <= #{param.startTime}
|
|
|
+ </if>
|
|
|
+ <if test="param.endTime != null">
|
|
|
+ AND endTime >= #{param.endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <select id="selectPianoGroupTeacher" resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupPianoVo">
|
|
|
+ SELECT
|
|
|
+ cg.id_ AS courseGroupId,
|
|
|
+ cg.name_ AS courseGroupName,
|
|
|
+ cg.subject_id_ AS subjectId,
|
|
|
+ sb.name_ AS subjectName,
|
|
|
+ cg.teacher_id_ AS teacherId,
|
|
|
+ su.username_ AS teacherName,
|
|
|
+ su.real_name_ AS teacherRealName,
|
|
|
+ cg.course_num_ AS courseNum,
|
|
|
+ cg.status_ AS `status`,
|
|
|
+ IFNULL(cm.count_,0) AS completeCount,
|
|
|
+ st.start_time_ AS startTime
|
|
|
+ FROM course_group cg
|
|
|
+ LEFT JOIN `subject` sb ON cg.subject_id_=sb.id_
|
|
|
+ LEFT JOIN sys_user su ON su.id_=cg.teacher_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 cg.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 cg.id_=st.course_group_id_
|
|
|
+ WHERE cg.type_='PIANO_ROOM_CLASS'
|
|
|
+ AND cg.teacher_id_=#{param.teacherId}
|
|
|
+ <if test="param.search != null and param.search != ''">
|
|
|
+ AND (
|
|
|
+ cg.id_ LIKE concat('%',#{param.search},'%') OR
|
|
|
+ cg.teacher_id_ LIKE concat('%',#{param.search},'%') OR
|
|
|
+ cg.name_ LIKE concat('%',#{param.search},'%') OR
|
|
|
+ su.username_ LIKE concat('%',#{param.search},'%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="param.subjectId != null">
|
|
|
+ AND cg.subject_id_ = #{param.subjectId}
|
|
|
+ </if>
|
|
|
+ <if test="param.status != null and param.status != ''">
|
|
|
+ AND cg.status_ = #{param.status}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="selectPianoGroupTeacherDetail"
|
|
|
+ resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupPianoDetailVo">
|
|
|
+ SELECT * FROM (
|
|
|
+ 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+1)*(a.studentCount+1-1)) AS courseTime,
|
|
|
+ cs.start_time_ AS startTime,
|
|
|
+ cs.end_time_ AS endTime,
|
|
|
+ p.user_id_ AS studentId,
|
|
|
+ su.username_ AS studentName,
|
|
|
+ su.real_name_ AS studentRealName,
|
|
|
+ (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,
|
|
|
+ (CASE WHEN cs.start_time_ >= sa.sign_in_time_ AND cs.end_time_ <= sa.sign_out_time_ THEN 1 ELSE 0 END) AS studentSign,
|
|
|
+ (CASE WHEN cs.start_time_ >= ta.sign_in_time_ AND cs.end_time_ <= ta.sign_out_time_ THEN 1 ELSE 0 END) AS teacherSign
|
|
|
+ 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 teacher_attendance ta ON cs.id_=ta.course_schedule_id_
|
|
|
+ LEFT JOIN student_attendance sa ON cs.id_=sa.course_schedule_id_
|
|
|
+ LEFT JOIN course_schedule_student_payment p ON cs.id_=p.course_id_
|
|
|
+ LEFT JOIN sys_user su ON cs.teacher_id_ = su.id_
|
|
|
+ WHERE cs.type_='PIANO_ROOM_CLASS'
|
|
|
+ AND cs.teacher_id_=#{param.teacherId}
|
|
|
+ AND p.course_group_id_=#{param.courseGroupId}) m
|
|
|
+ <where>
|
|
|
+ <if test="param.search != null and param.search != ''">
|
|
|
+ AND (
|
|
|
+ courseId LIKE concat('%',#{param.search},'%') OR
|
|
|
+ studentName LIKE concat('%',#{param.search},'%') OR
|
|
|
+ studentId LIKE concat('%',#{param.search},'%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="param.studentSign != null">
|
|
|
+ AND studentSign = #{param.studentSign}
|
|
|
+ </if>
|
|
|
+ <if test="param.teacherSign != null">
|
|
|
+ AND teacherSign = #{param.teacherSign}
|
|
|
+ </if>
|
|
|
+ <if test="param.status != null and param.status != ''">
|
|
|
+ AND `status` = #{param.status}
|
|
|
+ </if>
|
|
|
+ <if test="param.startTime != null">
|
|
|
+ AND startTime <= #{param.startTime}
|
|
|
+ </if>
|
|
|
+ <if test="param.endTime != null">
|
|
|
+ AND endTime >= #{param.endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
</mapper>
|