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.

10 KiB

queryByCondition

  • 根据不为空的参数进行分页查询 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
    @//数据权限该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#) @} order by ta.teacher_open_course_merge_teacher_order_index asc

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

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