You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 KiB

queryByCondition

  • 根据不为空的参数进行分页查询 select @pageTag(){ t., tb.teacher_id, ta.teacher_open_course_merge_teacher_auth_code, IFNULL((select count() from teacher_open_course_schedule_session_snap tocsss where tocsss.teacher_open_course_id=t.teacher_open_course_id and tocsss.teacher_open_course_schedule_session_snap_status=1),0) as course_hours @} from teacher_open_course t left join teacher_open_course_merge_teacher ta on ta.teacher_open_course_id = t.teacher_open_course_id left join teacher tb on tb.teacher_id = ta.teacher_id and tb.teacher_status = 1 left join (select max(course_label_id) as course_label_id, teacher_open_course_id from teacher_open_course_merge_course_info where course_label_id is not null group by teacher_open_course_id) tc on tc.teacher_open_course_id = t.teacher_open_course_id where 1=1
    @//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
    and #function("teacherOpenCourse.query")# @if(!isEmpty(teacherOpenCourseId)){ and t.teacher_open_course_id =#teacherOpenCourseId# @} @if(!isEmpty(teacherOpenCourseIdPlural)){ and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#) @} @if(!isEmpty(teacherOpenCourseTitle)){ and t.teacher_open_course_title =#teacherOpenCourseTitle# @} @if(!isEmpty(teacherOpenCourseCode)){ and t.teacher_open_course_code =#teacherOpenCourseCode# @} @if(!isEmpty(teacherOpenCourseCover)){ and t.teacher_open_course_cover =#teacherOpenCourseCover# @} @if(!isEmpty(teacherOpenCourseStatus)){ and t.teacher_open_course_status =#teacherOpenCourseStatus# @} @if(!isEmpty(teacherOpenCourseStatusPlural)){ and find_in_set(t.teacher_open_course_status,#teacherOpenCourseStatusPlural#) @} @if(!isEmpty(teacherId)){ and tb.teacher_id =#teacherId# @} @if(!isEmpty(teacherIdPlural)){ and find_in_set(tb.teacher_id,#teacherIdPlural#) @} @if(!isEmpty(startTime)){ and t.start_time =#startTime# @} @if(!isEmpty(endTime)){ and t.end_time =#endTime# @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @} @if(!isEmpty(orgIdPlural)){ and find_in_set(t.org_id,#orgIdPlural#) @} @if(!isEmpty(userId)){ and t.user_id =#userId# @} @if(!isEmpty(userIdPlural)){ and find_in_set(t.user_id,#userIdPlural#) @} @if(!isEmpty(createTime)){ and t.create_time =#createTime# @} @if(!isEmpty(teacherOpenCourseMergeAuthCode)){ and ta.teacher_open_course_merge_teacher_auth_code =#teacherOpenCourseMergeAuthCode# @} @if(!isEmpty(courseLabelIdPlural)){ and find_in_set(tc.course_label_id, #courseLabelIdPlural#) @} @pageIgnoreTag(){ order by ta.teacher_open_course_merge_teacher_order_index desc @}

queryByConditionQuery

  • 根据不为空的参数进行分页查询(无权限) select @pageTag(){ t.*, tb.teacher_id, ta.teacher_open_course_merge_teacher_auth_code @} from teacher_open_course t left join teacher_open_course_merge_teacher ta on ta.teacher_open_course_id = t.teacher_open_course_id left join teacher tb on tb.teacher_id = ta.teacher_id and tb.teacher_status = 1 left join (select max(course_label_id) as course_label_id, teacher_open_course_id from teacher_open_course_merge_course_info where course_label_id is not null group by teacher_open_course_id) tc on tc.teacher_open_course_id = t.teacher_open_course_id where 1=1
    @if(!isEmpty(teacherOpenCourseId)){ and t.teacher_open_course_id =#teacherOpenCourseId# @} @if(!isEmpty(teacherOpenCourseIdPlural)){ and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#) @} @if(!isEmpty(teacherOpenCourseTitle)){ and t.teacher_open_course_title =#teacherOpenCourseTitle# @} @if(!isEmpty(teacherOpenCourseCode)){ and t.teacher_open_course_code =#teacherOpenCourseCode# @} @if(!isEmpty(teacherOpenCourseCover)){ and t.teacher_open_course_cover =#teacherOpenCourseCover# @} @if(!isEmpty(teacherOpenCourseStatus)){ and t.teacher_open_course_status =#teacherOpenCourseStatus# @} @if(!isEmpty(teacherOpenCourseStatusPlural)){ and find_in_set(t.teacher_open_course_status,#teacherOpenCourseStatusPlural#) @} @if(!isEmpty(teacherId)){ and tb.teacher_id =#teacherId# @} @if(!isEmpty(teacherIdPlural)){ and find_in_set(tb.teacher_id,#teacherIdPlural#) @} @if(!isEmpty(startTime)){ and t.start_time =#startTime# @} @if(!isEmpty(endTime)){ and t.end_time =#endTime# @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @} @if(!isEmpty(orgIdPlural)){ and find_in_set(t.org_id,#orgIdPlural#) @} @if(!isEmpty(userId)){ and t.user_id =#userId# @} @if(!isEmpty(userIdPlural)){ and find_in_set(t.user_id,#userIdPlural#) @} @if(!isEmpty(createTime)){ and t.create_time =#createTime# @} @if(!isEmpty(teacherOpenCourseMergeAuthCode)){ and ta.teacher_open_course_merge_teacher_auth_code =#teacherOpenCourseMergeAuthCode# @} @if(!isEmpty(courseLabelIdPlural)){ and find_in_set(tc.course_label_id, #courseLabelIdPlural#) @} @pageIgnoreTag(){ order by ta.teacher_open_course_merge_teacher_order_index asc @}

deleteTeacherOpenCourseByIds

  • 批量删除 delete from teacher_open_course where find_in_set(teacher_open_course_id,#ids#)

logicDeleteTeacherOpenCourseByIds

  • 批量逻辑删除 update teacher_open_course t set t.teacher_open_course_status = 0 where find_in_set(teacher_open_course_id, #ids#)

getByIds

select * from teacher_open_course where find_in_set(teacher_open_course_id,#ids#)

updateGivenByIds

  • 批量更新指定字段,无论此字段是否有值 update teacher_open_course set @if(contain("teacherOpenCourseTitle",_given)){ @if(isEmpty(teacherOpenCourseTitle)){ teacher_open_course_title = null , @}else{ teacher_open_course_title = #teacherOpenCourseTitle# , @} @} @if(contain("teacherOpenCourseCode",_given)){ @if(isEmpty(teacherOpenCourseCode)){ teacher_open_course_code = null , @}else{ teacher_open_course_code = #teacherOpenCourseCode# , @} @} @if(contain("teacherOpenCourseCover",_given)){ @if(isEmpty(teacherOpenCourseCover)){ teacher_open_course_cover = null , @}else{ teacher_open_course_cover = #teacherOpenCourseCover# , @} @} @if(contain("teacherOpenCourseStatus",_given)){ @if(isEmpty(teacherOpenCourseStatus)){ teacher_open_course_status = null , @}else{ teacher_open_course_status = #teacherOpenCourseStatus# , @} @} @if(contain("startTime",_given)){ @if(isEmpty(startTime)){ start_time = null , @}else{ start_time = #startTime# , @} @} @if(contain("endTime",_given)){ @if(isEmpty(endTime)){ end_time = null , @}else{ end_time = #endTime# , @} @} @if(contain("orgId",_given)){ @if(isEmpty(orgId)){ org_id = null , @}else{ org_id = #orgId# , @} @} @if(contain("userId",_given)){ @if(isEmpty(userId)){ user_id = null , @}else{ user_id = #userId# , @} @} @if(contain("createTime",_given)){ @if(isEmpty(createTime)){ create_time = null , @}else{ create_time = #createTime# , @} @} teacher_open_course_id = teacher_open_course_id where find_in_set(teacher_open_course_id,#teacherOpenCourseIdPlural#)

getTeacherOpenCourseValues

  • 根据不为空的参数进行查询 select t.*, tb.teacher_id, ta.teacher_open_course_merge_teacher_auth_code from teacher_open_course t left join teacher_open_course_merge_teacher ta on ta.teacher_open_course_id = t.teacher_open_course_id left join teacher tb on tb.teacher_id = ta.teacher_id and tb.teacher_status = 1 where 1=1
    @if(!isEmpty(teacherOpenCourseId)){ and t.teacher_open_course_id =#teacherOpenCourseId# @} @if(!isEmpty(teacherOpenCourseTitle)){ and t.teacher_open_course_title =#teacherOpenCourseTitle# @} @if(!isEmpty(teacherOpenCourseCode)){ and t.teacher_open_course_code =#teacherOpenCourseCode# @} @if(!isEmpty(teacherOpenCourseCover)){ and t.teacher_open_course_cover =#teacherOpenCourseCover# @} @if(!isEmpty(teacherOpenCourseStatus)){ and t.teacher_open_course_status =#teacherOpenCourseStatus# @} @if(!isEmpty(teacherId)){ and tb.teacher_id =#teacherId# @} @if(!isEmpty(startTime)){ and t.start_time =#startTime# @} @if(!isEmpty(endTime)){ and t.end_time =#endTime# @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @} @if(!isEmpty(userId)){ and t.user_id =#userId# @} @if(!isEmpty(createTime)){ and t.create_time =#createTime# @} @if(!isEmpty(teacherOpenCourseMergeAuthCode)){ and ta.teacher_open_course_merge_teacher_auth_code =#teacherOpenCourseMergeAuthCode# @}

getValuesByQuery

  • 根据不为空的参数进行查询 select t.* @//, 交给@FetchSql注解来处理关联逻辑这样在多个查询里面都可以用。 @//tb.teacher_id, ta.teacher_open_course_merge_teacher_auth_code from teacher_open_course t left join teacher_open_course_merge_teacher ta on ta.teacher_open_course_id = t.teacher_open_course_id left join teacher tb on tb.teacher_id = ta.teacher_id and tb.teacher_status = 1 where 1=1 and #function("teacherOpenCourse.query")# @if(!isEmpty(teacherOpenCourseId)){ and t.teacher_open_course_id =#teacherOpenCourseId# @} @if(!isEmpty(teacherOpenCourseIdPlural)){ and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#) @} @if(!isEmpty(teacherOpenCourseTitle)){ and t.teacher_open_course_title =#teacherOpenCourseTitle# @} @if(!isEmpty(teacherOpenCourseCode)){ and t.teacher_open_course_code =#teacherOpenCourseCode# @} @if(!isEmpty(teacherOpenCourseCover)){ and t.teacher_open_course_cover =#teacherOpenCourseCover# @} @if(!isEmpty(teacherOpenCourseStatus)){ and t.teacher_open_course_status =#teacherOpenCourseStatus# @} @if(!isEmpty(teacherOpenCourseStatusPlural)){ and find_in_set(t.teacher_open_course_status,#teacherOpenCourseStatusPlural#) @} @if(!isEmpty(teacherId)){ and tb.teacher_id =#teacherId# @} @if(!isEmpty(teacherIdPlural)){ and find_in_set(tb.teacher_id,#teacherIdPlural#) @} @if(!isEmpty(startTime)){ and t.start_time =#startTime# @} @if(!isEmpty(endTime)){ and t.end_time =#endTime# @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @} @if(!isEmpty(orgIdPlural)){ and find_in_set(t.org_id,#orgIdPlural#) @} @if(!isEmpty(userId)){ and t.user_id =#userId# @} @if(!isEmpty(userIdPlural)){ and find_in_set(t.user_id,#userIdPlural#) @} @if(!isEmpty(createTime)){ and t.create_time =#createTime# @} @if(!isEmpty(teacherOpenCourseMergeAuthCode)){ and ta.teacher_open_course_merge_teacher_auth_code =#teacherOpenCourseMergeAuthCode# @}

getSchoolStartCourse

  • 获取院校所有开课课程 SELECT a.teacher_open_course_id, a.teacher_open_course_title, a.teacher_open_course_cover, c.teacher_name as name FROM teacher_open_course a LEFT JOIN ( SELECT ucjcr.org_id , e.course_info_status, e.course_label_id, e.course_label_status FROM universities_colleges_jurisdiction_curriculum_resources ucjcr LEFT JOIN ( SELECT ci.course_info_id, ci.course_info_status, cl.course_label_id, cl.course_label_status FROM course_info ci LEFT JOIN course_label cl ON ci.course_label_id = cl.course_label_id ) e ON e.course_info_id = ucjcr.course_info_id ) b ON b.org_id = a.org_id LEFT JOIN teacher c ON c.user_id = a.user_id WHERE 1 = 1 AND a.teacher_open_course_status = 1 AND b.course_info_status = 1 AND b.course_label_status = 1 AND c.teacher_status = 1 @if(!isEmpty(courseLabelIdPlural)){ AND b.course_label_id =#courseLabelIdPlural# @} @if(!isEmpty(orgId)){ AND b.org_id =#orgId# @}

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# @} 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# @} )