diff --git a/web/src/main/resources/sql/jlw/teacherOpenCourse.md b/web/src/main/resources/sql/jlw/teacherOpenCourse.md index da752711..4bdeb965 100644 --- a/web/src/main/resources/sql/jlw/teacherOpenCourse.md +++ b/web/src/main/resources/sql/jlw/teacherOpenCourse.md @@ -382,59 +382,72 @@ getSchoolStartCourse getTeacherOpenCourseMergeCourseInfo === * 获取教师开课课程,以及授权课程 - - ( - SELECT - 1 `type`, - a.teacher_open_course_id, - a.teacher_open_course_title `course_name`, - a.teacher_open_course_cover `course_cover`, - t.teacher_name `name`, - a.start_time - FROM teacher_open_course a - LEFT JOIN teacher_open_course_merge_teacher tocmt on a.teacher_open_course_id = tocmt.teacher_open_course_id - LEFT JOIN teacher t on t.teacher_id = tocmt.teacher_id - WHERE 1 = 1 - AND a.teacher_open_course_status = 1 - AND tocmt.teacher_open_course_merge_teacher_status=1 - AND t.teacher_status=1 - @if(!isEmpty(orgId)){ - AND a.org_id =#orgId# - @} - @if(!isEmpty(courseLabelId)){ - AND a.teacher_open_course_id in ( - select teacher_open_course_id from teacher_open_course_merge_course_info c where c.course_label_id = #courseLabelId# and c.course_info_type = 1 and c.course_info_status = 1 - ) - @} - @if(!isEmpty(filterStartTime) && !isEmpty(filterEndTime)){ - AND a.start_time BETWEEN #filterStartTime# AND #filterEndTime# - @} - - ) - UNION ALL - ( - select - 2 `type`, - ci.course_info_id `teacher_open_course_id`, - ci.course_info_name `course_name`, - ci.course_info_thumbnail `course_cover`, - '系统管理员' `name`, - ucjcr.use_start_time AS start_time - from universities_colleges uc - LEFT JOIN universities_colleges_jurisdiction_curriculum_resources ucjcr ON ucjcr.universities_colleges_id = uc.universities_colleges_id - LEFT JOIN course_info ci ON ci.course_info_id = ucjcr.course_info_id AND ci.course_info_type =1 - where 1 = 1 - and uc.universities_colleges_status = 1 - and ci.course_info_status = 1 - and ucjcr.use_type in (1,2) - and now() between ucjcr.use_start_time and ucjcr.use_end_time - @if(!isEmpty(orgId)){ - AND uc.org_id =#orgId# - @} - @if(!isEmpty(courseLabelId)){ - and ci.course_label_id = #courseLabelId# - @} - @if(!isEmpty(filterStartTime) && !isEmpty(filterEndTime)){ - AND ucjcr.use_start_time BETWEEN #filterStartTime# AND #filterEndTime# - @} - ) +( +SELECT +1 type, +a.teacher_open_course_id, +a.teacher_open_course_title course_name, +a.teacher_open_course_cover course_cover, +t.teacher_name name, +a.start_time +FROM teacher_open_course a +LEFT JOIN teacher_open_course_merge_teacher tocmt on a.teacher_open_course_id = tocmt.teacher_open_course_id +LEFT JOIN teacher t on t.teacher_id = tocmt.teacher_id +WHERE 1 = 1 +AND a.teacher_open_course_status = 1 +AND tocmt.teacher_open_course_merge_teacher_status=1 +AND t.teacher_status=1 +@if(!isEmpty(orgId)){ +AND a.org_id = #orgId# +@} +AND ( +@if(!isEmpty(courseLabelId)){ +a.teacher_open_course_id in ( +select teacher_open_course_id +from teacher_open_course_merge_course_info c +where c.course_label_id = #courseLabelId# +and c.course_info_type = 1 +and c.course_info_status = 1 +) +@} else { +1 = 1 -- 当 courseLabelId 为空时不做限制 +@} +) +@if(!isEmpty(filterStartTime) && !isEmpty(filterEndTime)){ +AND a.start_time BETWEEN #filterStartTime# AND #filterEndTime# +@} +) +UNION ALL +( +SELECT +2 type, +ci.course_info_id teacher_open_course_id, +ci.course_info_name course_name, +ci.course_info_thumbnail course_cover, +'系统管理员' name, +ucjcr.use_start_time AS start_time +FROM universities_colleges uc +LEFT JOIN universities_colleges_jurisdiction_curriculum_resources ucjcr +ON ucjcr.universities_colleges_id = uc.universities_colleges_id +LEFT JOIN course_info ci +ON ci.course_info_id = ucjcr.course_info_id +AND ci.course_info_type = 1 +WHERE 1 = 1 +AND uc.universities_colleges_status = 1 +AND ci.course_info_status = 1 +AND ucjcr.use_type IN (1, 2) +AND NOW() BETWEEN ucjcr.use_start_time AND ucjcr.use_end_time +@if(!isEmpty(orgId)){ +AND uc.org_id = #orgId# +@} +AND ( +@if(!isEmpty(courseLabelId)){ +ci.course_label_id = #courseLabelId# +@} else { +1 = 1 -- 当 courseLabelId 为空时不做限制 +@} +) +@if(!isEmpty(filterStartTime) && !isEmpty(filterEndTime)){ +AND ucjcr.use_start_time BETWEEN #filterStartTime# AND #filterEndTime# +@} +)