|
@@ -334,6 +334,149 @@
|
|
|
</where>
|
|
|
order by cs.id_ desc
|
|
|
</select>
|
|
|
+ <select id="selectPracticeGroup" resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupPracticeVo">
|
|
|
+ SELECT
|
|
|
+ cg.id_ AS groupId,
|
|
|
+ cg.name_ AS groupName,
|
|
|
+ cg.subject_id_ AS subjectId,
|
|
|
+ sub.name_ AS subjectName,
|
|
|
+ cg.course_num_ AS courseNum,
|
|
|
+ IFNULL(cs.count_ ,0)AS completeCount,
|
|
|
+ cg.teacher_id_ AS teacherId,
|
|
|
+ tu.username_ AS teacherName,
|
|
|
+ tu.real_name_ AS teacherRealName,
|
|
|
+ sp.user_id_ AS studentId,
|
|
|
+ su.username_ AS studentName,
|
|
|
+ su.real_name_ AS studentRealName,
|
|
|
+ cg.status_ AS `status`,
|
|
|
+ cst.start_time_ AS startTime
|
|
|
+ FROM course_group cg
|
|
|
+ LEFT JOIN `subject` sub ON cg.subject_id_=sub.id_
|
|
|
+ LEFT JOIN sys_user tu ON cg.teacher_id_=tu.id_
|
|
|
+ LEFT JOIN (SELECT user_id_,course_group_id_ FROM course_schedule_student_payment WHERE course_type_='PRACTICE' GROUP BY course_group_id_) sp ON cg.id_=sp.course_group_id_
|
|
|
+ LEFT JOIN sys_user su ON sp.user_id_=su.id_
|
|
|
+ LEFT JOIN (SELECT course_group_id_,COUNT(1) AS count_ FROM course_schedule WHERE type_='PRACTICE' AND status_='COMPLETE' GROUP BY course_group_id_) cs ON cg.id_=cs.course_group_id_
|
|
|
+ LEFT JOIN (SELECT course_group_id_,start_time_ FROM course_schedule WHERE type_='PRACTICE' GROUP BY course_group_id_) cst ON cg.id_=cst.course_group_id_
|
|
|
+ WHERE cg.type_='PRACTICE'
|
|
|
+ <if test="param.search != null and param.search != ''">
|
|
|
+ AND (
|
|
|
+ cg.id_ LIKE concat('%',#{param.search},'%') OR
|
|
|
+ cg.teacher_id_ LIKE concat('%',#{param.search},'%') OR
|
|
|
+ sp.user_id_ LIKE concat('%',#{param.search},'%') OR
|
|
|
+ cg.name_ LIKE concat('%',#{param.search},'%') OR
|
|
|
+ tu.username_ 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="selectPracticeGroupDetail"
|
|
|
+ resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupPracticeDetailVo">
|
|
|
+ SELECT * FROM
|
|
|
+ (SELECT
|
|
|
+ cs.id_ AS courseId,
|
|
|
+ sb.name_ AS subjectName,
|
|
|
+ cs.teacher_id_ AS teacherId,
|
|
|
+ tu.username_ AS teacherName,
|
|
|
+ tu.real_name_ AS teacherRealName,
|
|
|
+ sp.user_id_ AS studentId,
|
|
|
+ su.username_ AS studentName,
|
|
|
+ su.real_name_ AS studentRealName,
|
|
|
+ cs.status_ AS `status`,
|
|
|
+ cs.start_time_ AS startTime,
|
|
|
+ cs.end_time_ AS endTime,
|
|
|
+ (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_ THEN 1 ELSE 0 END) AS studentInSign,
|
|
|
+ (CASE WHEN cs.end_time_ <= sa.sign_out_time_ THEN 1 ELSE 0 END) AS studentOutSign,
|
|
|
+ ts.status_ AS salaryStatus
|
|
|
+ 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 course_schedule_student_payment sp ON cs.id_=sp.course_id_
|
|
|
+ LEFT JOIN sys_user su ON sp.user_id_=su.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_teacher_salary ts ON cs.id_=ts.course_schedule_id_
|
|
|
+ WHERE cs.type_='PRACTICE'
|
|
|
+ AND cs.course_group_id_=#{param.courseGroupId}) a
|
|
|
+ <where>
|
|
|
+ <if test="param.search != null and param.search != ''">
|
|
|
+ AND (
|
|
|
+ courseId LIKE concat('%',#{param.search},'%') OR
|
|
|
+ teacherName LIKE concat('%',#{param.search},'%') OR
|
|
|
+ teacherId LIKE concat('%',#{param.search},'%') OR
|
|
|
+ studentName LIKE concat('%',#{param.search},'%') OR
|
|
|
+ studentId LIKE concat('%',#{param.search},'%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="param.teacherSign == 1">
|
|
|
+ AND teacherInSign = #{param.teacherSign}
|
|
|
+ </if>
|
|
|
+ <if test="param.teacherSign == 0">
|
|
|
+ AND teacherOutSign = #{param.teacherSign}
|
|
|
+ </if>
|
|
|
+ <if test="param.studentSign == 1">
|
|
|
+ AND studentInSign = #{param.studentSign}
|
|
|
+ </if>
|
|
|
+ <if test="param.studentSign == 0">
|
|
|
+ AND studentOutSign = #{param.studentSign}
|
|
|
+ </if>
|
|
|
+ <if test="param.status != null and param.status != ''">
|
|
|
+ AND `status` = #{param.status}
|
|
|
+ </if>
|
|
|
+ <if test="param.salaryStatus != null and param.salaryStatus != ''">
|
|
|
+ AND salaryStatus = #{param.salaryStatus}
|
|
|
+ </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="selectLiveGroup" resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupLiveVo">
|
|
|
+ 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.pre_student_num_ AS studentNum,
|
|
|
+ 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_='LIVE' 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_='LIVE' GROUP BY course_group_id_) st ON cg.id_=st.course_group_id_
|
|
|
+ WHERE cg.type_='LIVE'
|
|
|
+ <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>
|
|
|
|
|
|
<update id="opsPreStudentNum">
|
|
|
update course_group
|