|
@@ -89,6 +89,7 @@
|
|
|
and b.type_ = #{param.type}
|
|
|
</if>
|
|
|
</where>
|
|
|
+ order by b.created_time_
|
|
|
</select>
|
|
|
|
|
|
<select id="queryStudentCourseGroup" resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupVo">
|
|
@@ -696,6 +697,253 @@
|
|
|
</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+1)*(a.studentCount+1-1)) AS courseTime,
|
|
|
+ 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>
|
|
|
+ <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>
|