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.
tianze-pro/web/src/main/resources/sql/jlw/teacherOpenCourseQuestionLo...

1315 lines
48 KiB
Markdown

2 years ago
queryByCondition
===
* 根据不为空的参数进行分页查询
select
@pageTag(){
2 years ago
t.*,
ta.student_name,
ta.student_sn,
tb.class_name
@}
from teacher_open_course_question_log t
2 years ago
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
@if(!isEmpty(questionSettingType)){
2 years ago
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where 1=1
@//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
and #function("teacherOpenCourseQuestionLog.query")#
@if(!isEmpty(teacherOpenCourseQuestionLogId)){
and t.teacher_open_course_question_log_id =#teacherOpenCourseQuestionLogId#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogIdPlural)){
and find_in_set(t.teacher_open_course_question_log_id,#teacherOpenCourseQuestionLogIdPlural#)
@}
3 years ago
@if(!isEmpty(teacherOpenCourseQuestionSettingId)){
and t.teacher_open_course_question_setting_id =#teacherOpenCourseQuestionSettingId#
@}
3 years ago
@if(!isEmpty(teacherOpenCourseQuestionSettingIdPlural)){
and find_in_set(t.teacher_open_course_question_setting_id,#teacherOpenCourseQuestionSettingIdPlural#)
@}
@if(!isEmpty(resourcesQuestionSnapshotId)){
and t.resources_question_snapshot_id =#resourcesQuestionSnapshotId#
@}
@if(!isEmpty(resourcesQuestionSnapshotIdPlural)){
and find_in_set(t.resources_question_snapshot_id,#resourcesQuestionSnapshotIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAnswer)){
and t.teacher_open_course_question_log_answer =#teacherOpenCourseQuestionLogAnswer#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUploadFile)){
and t.teacher_open_course_question_log_upload_file =#teacherOpenCourseQuestionLogUploadFile#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAddTime)){
and t.teacher_open_course_question_log_add_time =#teacherOpenCourseQuestionLogAddTime#
@}
@if(isEmpty(teacherOpenCourseQuestionLogStatus) && isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
and t.teacher_open_course_question_log_status != 2
@}else{
@if(!isEmpty(teacherOpenCourseQuestionLogStatus)){
and t.teacher_open_course_question_log_status =#teacherOpenCourseQuestionLogStatus#
@}else if(!isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
and find_in_set(t.teacher_open_course_question_log_status,#teacherOpenCourseQuestionLogStatusPlural#)
@}
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
@if(!isEmpty(studentScore)){
and t.student_score =#studentScore#
@}
@if(!isEmpty(questionType)){
and t.question_type =#questionType#
@}
@if(!isEmpty(questionTypePlural)){
and find_in_set(t.question_type,#questionTypePlural#)
@}
@if(!isEmpty(questionScore)){
and t.question_score =#questionScore#
@}
@if(!isEmpty(questionStem)){
and t.question_stem =#questionStem#
@}
@if(!isEmpty(questionOptionA)){
and t.question_option_a =#questionOptionA#
@}
@if(!isEmpty(questionOptionB)){
and t.question_option_b =#questionOptionB#
@}
@if(!isEmpty(questionOptionC)){
and t.question_option_c =#questionOptionC#
@}
@if(!isEmpty(questionOptionD)){
and t.question_option_d =#questionOptionD#
@}
@if(!isEmpty(questionOptionE)){
and t.question_option_e =#questionOptionE#
@}
@if(!isEmpty(questionAnswer)){
and t.question_answer =#questionAnswer#
@}
@if(!isEmpty(isTuck)){
and t.is_tuck =#isTuck#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUpdateTime)){
and t.teacher_open_course_question_log_update_time =#teacherOpenCourseQuestionLogUpdateTime#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogFinishTime)){
and t.teacher_open_course_question_log_finish_time =#teacherOpenCourseQuestionLogFinishTime#
@}
@if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite#)
@}
@if(!isEmpty(questionLogAddType)){
and tc.question_log_add_type =#questionLogAddType#
@}
@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#)
@}
2 years ago
@if(!isEmpty(studentSnOrName)){
and (ta.student_sn like #'%'+studentSnOrName+'%'# or ta.student_name like #'%'+studentSnOrName+'%'#)
@}
@if(!isEmpty(schoolClassIdPlural)){
and find_in_set(ta.class_id, #schoolClassIdPlural#)
@}
@if(!isEmpty(questionSettingType)){
2 years ago
and tc.teacher_open_course_question_setting_type = #questionSettingType#
and tc.teacher_open_course_question_setting_status = 1
and tc.teacher_open_course_question_setting_push_status = 1
@}
queryByConditionQuery
===
* 根据不为空的参数进行分页查询(无权限)
select
@pageTag(){
2 years ago
t.*,
ta.student_name,
ta.student_sn,
tb.class_name
@}
from teacher_open_course_question_log t
2 years ago
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
@if(!isEmpty(questionSettingType)){
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
2 years ago
@}
where 1=1
@if(!isEmpty(questionSettingType)) {
@if(questionSettingType=="HOMEWORK_FILE"){
@// and t.teacher_open_course_question_log_id = (
@// select substring_index(qls.question_log_ids,',',-1) from question_log_summary qls where 1=1
@// @if(!isEmpty(teacherOpenCourseQuestionSettingId)){
@// and qls.question_setting_id =#teacherOpenCourseQuestionSettingId#
@// @}
@// and qls.question_setting_type = #questionSettingType#
@// @if(!isEmpty(studentId)){
@// and qls.person_id =#studentId#
@// @}else{
@// and qls.person_id =t.student_id
@// @}
@// and qls.question_log_summary_status=1
@// )
@}else{
and find_in_set(t.teacher_open_course_question_log_id, (
select question_log_ids from question_log_summary qls where 1=1
@if(!isEmpty(teacherOpenCourseQuestionSettingId)){
and qls.question_setting_id =#teacherOpenCourseQuestionSettingId#
@}
and qls.question_setting_type = #questionSettingType#
@if(!isEmpty(studentId)){
and qls.person_id =#studentId#
@}else{
and qls.person_id =t.student_id
@}
and qls.question_log_summary_status=1
order by qls.question_log_summary_add_time desc
limit 1
)
)
@}
@}
@if(!isEmpty(teacherOpenCourseQuestionLogId)){
and t.teacher_open_course_question_log_id =#teacherOpenCourseQuestionLogId#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogIdPlural)){
and find_in_set(t.teacher_open_course_question_log_id,#teacherOpenCourseQuestionLogIdPlural#)
@}
3 years ago
@if(!isEmpty(teacherOpenCourseQuestionSettingId)){
and t.teacher_open_course_question_setting_id =#teacherOpenCourseQuestionSettingId#
@}
3 years ago
@if(!isEmpty(teacherOpenCourseQuestionSettingIdPlural)){
and find_in_set(t.teacher_open_course_question_setting_id,#teacherOpenCourseQuestionSettingIdPlural#)
@}
@if(!isEmpty(resourcesQuestionSnapshotId)){
and t.resources_question_snapshot_id =#resourcesQuestionSnapshotId#
@}
@if(!isEmpty(resourcesQuestionSnapshotIdPlural)){
and find_in_set(t.resources_question_snapshot_id,#resourcesQuestionSnapshotIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAnswer)){
and t.teacher_open_course_question_log_answer =#teacherOpenCourseQuestionLogAnswer#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUploadFile)){
and t.teacher_open_course_question_log_upload_file =#teacherOpenCourseQuestionLogUploadFile#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAddTime)){
and t.teacher_open_course_question_log_add_time =#teacherOpenCourseQuestionLogAddTime#
@}
@if(isEmpty(teacherOpenCourseQuestionLogStatus) && isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
2 years ago
@// and t.teacher_open_course_question_log_status != 2
@}else{
@if(!isEmpty(teacherOpenCourseQuestionLogStatus)){
and t.teacher_open_course_question_log_status =#teacherOpenCourseQuestionLogStatus#
@}else if(!isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
and find_in_set(t.teacher_open_course_question_log_status,#teacherOpenCourseQuestionLogStatusPlural#)
@}
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
@if(!isEmpty(studentScore)){
and t.student_score =#studentScore#
@}
@if(!isEmpty(questionType)){
and t.question_type =#questionType#
@}
@if(!isEmpty(questionTypePlural)){
and find_in_set(t.question_type,#questionTypePlural#)
@}
@if(!isEmpty(questionScore)){
and t.question_score =#questionScore#
@}
@if(!isEmpty(questionStem)){
and t.question_stem =#questionStem#
@}
@if(!isEmpty(questionOptionA)){
and t.question_option_a =#questionOptionA#
@}
@if(!isEmpty(questionOptionB)){
and t.question_option_b =#questionOptionB#
@}
@if(!isEmpty(questionOptionC)){
and t.question_option_c =#questionOptionC#
@}
@if(!isEmpty(questionOptionD)){
and t.question_option_d =#questionOptionD#
@}
@if(!isEmpty(questionOptionE)){
and t.question_option_e =#questionOptionE#
@}
@if(!isEmpty(questionAnswer)){
and t.question_answer =#questionAnswer#
@}
@if(!isEmpty(isTuck)){
and t.is_tuck =#isTuck#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUpdateTime)){
and t.teacher_open_course_question_log_update_time =#teacherOpenCourseQuestionLogUpdateTime#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogFinishTime)){
and t.teacher_open_course_question_log_finish_time =#teacherOpenCourseQuestionLogFinishTime#
@}
@if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite#)
@}
@if(!isEmpty(questionLogAddType)){
2 years ago
and t.question_log_add_type = #questionLogAddType#
@}
@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#)
@}
2 years ago
@if(!isEmpty(studentSnOrName)){
and (ta.student_sn like #'%'+studentSnOrName+'%'# or ta.student_name like #'%'+studentSnOrName+'%'#)
@}
@if(!isEmpty(schoolClassIdPlural)){
and find_in_set(ta.class_id, #schoolClassIdPlural#)
@}
@if(!isEmpty(questionSettingType)){
2 years ago
and tc.teacher_open_course_question_setting_type = #questionSettingType#
and tc.teacher_open_course_question_setting_status = 1
and tc.teacher_open_course_question_setting_push_status = 1
@}
studentScoreList
===
* 根据不为空的参数进行分页查询(无权限) 查询得分总和
select
@pageTag(){
tz.*
@}
from (
SELECT
distinct *
FROM
(
SELECT
t.student_id,
ta.student_sn,
ta.student_name,
t.teacher_open_course_question_setting_id,
sum( t.student_score ) AS sum_student_score,
SUBSTRING_INDEX( GROUP_CONCAT( t.teacher_open_course_question_log_add_time ORDER BY t.teacher_open_course_question_log_add_time DESC ), ',', 1 ) AS add_time
FROM
teacher_open_course_question_log t
LEFT JOIN student ta ON ta.student_id = t.student_id
WHERE
1 = 1
@// AND ta.student_sn IS NOT NULL
@if(!isEmpty(questionSettingType)&&questionSettingType=="HOMEWORK_FILE"){
@//附件作业不需要查因为没评阅之前是没有成绩表数据的只需要查status=1的数据逻辑保证了只有一条
and t.teacher_open_course_question_log_status = 1
@}else{
@//不这么写会把多次考试的分数都加起来
AND find_in_set(t.teacher_open_course_question_log_id ,(
select question_log_ids from (select question_log_ids from question_log_summary qls where qls.question_setting_id = t.teacher_open_course_question_setting_id and qls.person_id = t.student_id and qls.question_log_summary_status=1 order by qls.question_log_summary_add_time desc limit 1) tt
))
@}
@if(!isEmpty(schoolClassId)){
and ta.class_id =#schoolClassId#
@}
@if(!isEmpty(studentOrName)){
and (ta.student_sn like #'%'+studentOrName+'%'# or ta.student_name like #'%'+studentOrName+'%'#)
@}
@if(!isEmpty(teacherOpenCourseQuestionLogId)){
and t.teacher_open_course_question_log_id =#teacherOpenCourseQuestionLogId#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogIdPlural)){
and find_in_set(t.teacher_open_course_question_log_id,#teacherOpenCourseQuestionLogIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseQuestionSettingId)){
and t.teacher_open_course_question_setting_id =#teacherOpenCourseQuestionSettingId#
@}
@if(!isEmpty(teacherOpenCourseQuestionSettingIdPlural)){
and find_in_set(t.teacher_open_course_question_setting_id,#teacherOpenCourseQuestionSettingIdPlural#)
@}
@if(!isEmpty(resourcesQuestionSnapshotId)){
and t.resources_question_snapshot_id =#resourcesQuestionSnapshotId#
@}
@if(!isEmpty(resourcesQuestionSnapshotIdPlural)){
and find_in_set(t.resources_question_snapshot_id,#resourcesQuestionSnapshotIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAnswer)){
and t.teacher_open_course_question_log_answer =#teacherOpenCourseQuestionLogAnswer#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUploadFile)){
and t.teacher_open_course_question_log_upload_file =#teacherOpenCourseQuestionLogUploadFile#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAddTime)){
and t.teacher_open_course_question_log_add_time =#teacherOpenCourseQuestionLogAddTime#
@}
@if(isEmpty(teacherOpenCourseQuestionLogStatus) && isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
and t.teacher_open_course_question_log_status != 2
@}else{
@if(!isEmpty(teacherOpenCourseQuestionLogStatus)){
and t.teacher_open_course_question_log_status =#teacherOpenCourseQuestionLogStatus#
@}else if(!isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
and find_in_set(t.teacher_open_course_question_log_status,#teacherOpenCourseQuestionLogStatusPlural#)
@}
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
@if(!isEmpty(studentScore)){
and t.student_score =#studentScore#
@}
@if(!isEmpty(questionType)){
and t.question_type =#questionType#
@}
@if(!isEmpty(questionTypePlural)){
and find_in_set(t.question_type,#questionTypePlural#)
@}
@if(!isEmpty(questionScore)){
and t.question_score =#questionScore#
@}
@if(!isEmpty(questionStem)){
and t.question_stem =#questionStem#
@}
@if(!isEmpty(questionOptionA)){
and t.question_option_a =#questionOptionA#
@}
@if(!isEmpty(questionOptionB)){
and t.question_option_b =#questionOptionB#
@}
@if(!isEmpty(questionOptionC)){
and t.question_option_c =#questionOptionC#
@}
@if(!isEmpty(questionOptionD)){
and t.question_option_d =#questionOptionD#
@}
@if(!isEmpty(questionOptionE)){
and t.question_option_e =#questionOptionE#
@}
@if(!isEmpty(questionAnswer)){
and t.question_answer =#questionAnswer#
@}
@if(!isEmpty(isTuck)){
and t.is_tuck =#isTuck#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUpdateTime)){
and t.teacher_open_course_question_log_update_time =#teacherOpenCourseQuestionLogUpdateTime#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogFinishTime)){
and t.teacher_open_course_question_log_finish_time =#teacherOpenCourseQuestionLogFinishTime#
@}
@if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite#)
@}
@if(!isEmpty(questionLogAddType)){
2 years ago
and t.question_log_add_type =#questionLogAddType#
@}
@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(studentSnOrName)){
and (ta.student_sn like #'%'+studentSnOrName+'%'# or ta.student_name like #'%'+studentSnOrName+'%'#)
@}
@if(!isEmpty(schoolClassIdPlural)){
and find_in_set(ta.class_id, #schoolClassIdPlural#)
@}
@if(!isEmpty(questionLogAddType)){
and tc.teacher_open_course_question_setting_type = #questionSettingType#
and tc.teacher_open_course_question_setting_status = 1
and tc.teacher_open_course_question_setting_push_status = 1
@}
GROUP BY
t.student_id,
ta.student_sn,
ta.student_name,
t.teacher_open_course_question_setting_id
2 years ago
@//HAVING
@//sum( t.student_score ) IS NOT NULL
) a
2 years ago
WHERE 1=1
ORDER BY
add_time ASC
)tz
deleteTeacherOpenCourseQuestionLogByIds
===
* 批量删除(假删除)
update teacher_open_course_question_log set teacher_open_course_question_log_status = 2 where find_in_set(teacher_open_course_question_log_id,#ids#) and (teacher_open_course_question_log_status = 1 or teacher_open_course_question_log_status is null)
2 years ago
logicDeleteBySettingIds
===
* 根据题目配置ID批量删除假删除
update teacher_open_course_question_log set teacher_open_course_question_log_status = 2
where find_in_set(teacher_open_course_question_setting_id, #settingIds#)
and student_id = #studentId#
and (teacher_open_course_question_log_status = 1 or teacher_open_course_question_log_status is null)
deleteByIds
===
* 批量删除(真删除)
delete from teacher_open_course_question_log where find_in_set(teacher_open_course_question_log_id,#ids#)
2 years ago
deleteBySettingIds
===
* 根据题目配置ID 批量(真删除)
2 years ago
delete from teacher_open_course_question_log where find_in_set(teacher_open_course_question_setting_id, #settingIds#)
getByIds
===
select * from teacher_open_course_question_log where find_in_set(teacher_open_course_question_log_id,#ids#)
updateGivenByIds
===
* 批量更新指定字段,无论此字段是否有值
update teacher_open_course_question_log
set
3 years ago
@if(contain("teacherOpenCourseQuestionSettingId",_given)){
@if(isEmpty(teacherOpenCourseQuestionSettingId)){
teacher_open_course_question_setting_id = null ,
@}else{
3 years ago
teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# ,
@}
@}
@if(contain("resourcesQuestionSnapshotId",_given)){
@if(isEmpty(resourcesQuestionSnapshotId)){
resources_question_snapshot_id = null ,
@}else{
resources_question_snapshot_id = #resourcesQuestionSnapshotId# ,
@}
@}
@if(contain("teacherOpenCourseQuestionLogAnswer",_given)){
@if(isEmpty(teacherOpenCourseQuestionLogAnswer)){
teacher_open_course_question_log_answer = null ,
@}else{
teacher_open_course_question_log_answer = #teacherOpenCourseQuestionLogAnswer# ,
@}
@}
@if(contain("teacherOpenCourseQuestionLogUploadFile",_given)){
@if(isEmpty(teacherOpenCourseQuestionLogUploadFile)){
teacher_open_course_question_log_upload_file = null ,
@}else{
teacher_open_course_question_log_upload_file = #teacherOpenCourseQuestionLogUploadFile# ,
@}
@}
@if(contain("teacherOpenCourseQuestionLogAddTime",_given)){
@if(isEmpty(teacherOpenCourseQuestionLogAddTime)){
teacher_open_course_question_log_add_time = null ,
@}else{
teacher_open_course_question_log_add_time = #teacherOpenCourseQuestionLogAddTime# ,
@}
@}
@if(contain("teacherOpenCourseQuestionLogStatus",_given)){
@if(isEmpty(teacherOpenCourseQuestionLogStatus)){
teacher_open_course_question_log_status = null ,
@}else{
teacher_open_course_question_log_status = #teacherOpenCourseQuestionLogStatus# ,
@}
@}
@if(contain("studentId",_given)){
@if(isEmpty(studentId)){
student_id = null ,
@}else{
student_id = #studentId# ,
@}
@}
@if(contain("isTuck",_given)){
@if(isEmpty(isTick)){
is_tuck = null ,
@}else{
is_tuck = #isTuck# ,
@}
@}
@if(contain("isErrorFavorite",_given)){
@if(isEmpty(isErrorFavorite)){
is_error_favorite = null ,
@}else{
is_error_favorite = #isErrorFavorite# ,
@}
@}
@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# ,
@}
@}
teacher_open_course_question_log_id = teacher_open_course_question_log_id
where find_in_set(teacher_open_course_question_log_id,#teacherOpenCourseQuestionLogIdPlural#)
getTeacherOpenCourseQuestionLogValues
===
* 根据不为空的参数进行查询
2 years ago
select t.*,
ta.student_name,
ta.student_sn,
tb.class_name
from teacher_open_course_question_log t
2 years ago
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
2 years ago
@if(!isEmpty(questionLogAddType)){
2 years ago
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where 1=1
@if(!isEmpty(teacherOpenCourseQuestionLogId)){
and t.teacher_open_course_question_log_id =#teacherOpenCourseQuestionLogId#
@}
3 years ago
@if(!isEmpty(teacherOpenCourseQuestionSettingId)){
and t.teacher_open_course_question_setting_id =#teacherOpenCourseQuestionSettingId#
@}
@if(!isEmpty(resourcesQuestionSnapshotId)){
and t.resources_question_snapshot_id =#resourcesQuestionSnapshotId#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAnswer)){
and t.teacher_open_course_question_log_answer =#teacherOpenCourseQuestionLogAnswer#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUploadFile)){
and t.teacher_open_course_question_log_upload_file =#teacherOpenCourseQuestionLogUploadFile#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAddTime)){
and t.teacher_open_course_question_log_add_time =#teacherOpenCourseQuestionLogAddTime#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogStatus)){
and t.teacher_open_course_question_log_status =#teacherOpenCourseQuestionLogStatus#
@}else{
and t.teacher_open_course_question_log_status != 2
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(isTuck)){
and t.is_tuck =#isTuck#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUpdateTime)){
and t.teacher_open_course_question_log_update_time =#teacherOpenCourseQuestionLogUpdateTime#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogFinishTime)){
and t.teacher_open_course_question_log_finish_time =#teacherOpenCourseQuestionLogFinishTime#
@}
@if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite#)
@}
@if(!isEmpty(questionLogAddType)){
2 years ago
and t.question_log_add_type =#questionLogAddType#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
getValuesByQuery
===
* 根据不为空的参数进行查询
2 years ago
select t.*,
ta.student_name,
ta.student_sn,
tb.class_name
from teacher_open_course_question_log t
2 years ago
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
2 years ago
@if(!isEmpty(questionLogAddType)){
2 years ago
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where 1=1 and #function("teacherOpenCourseQuestionLog.query")#
@if(!isEmpty(teacherOpenCourseQuestionLogId)){
and t.teacher_open_course_question_log_id =#teacherOpenCourseQuestionLogId#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogIdPlural)){
and find_in_set(t.teacher_open_course_question_log_id,#teacherOpenCourseQuestionLogIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseQuestionSettingId)){
and t.teacher_open_course_question_setting_id =#teacherOpenCourseQuestionSettingId#
@}
@if(!isEmpty(teacherOpenCourseQuestionSettingIdPlural)){
and find_in_set(t.teacher_open_course_question_setting_id,#teacherOpenCourseQuestionSettingIdPlural#)
@}
@if(!isEmpty(resourcesQuestionSnapshotId)){
and t.resources_question_snapshot_id =#resourcesQuestionSnapshotId#
@}
@if(!isEmpty(resourcesQuestionSnapshotIdPlural)){
and find_in_set(t.resources_question_snapshot_id,#resourcesQuestionSnapshotIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAnswer)){
and t.teacher_open_course_question_log_answer =#teacherOpenCourseQuestionLogAnswer#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUploadFile)){
and t.teacher_open_course_question_log_upload_file =#teacherOpenCourseQuestionLogUploadFile#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAddTime)){
and t.teacher_open_course_question_log_add_time =#teacherOpenCourseQuestionLogAddTime#
@}
@if(isEmpty(teacherOpenCourseQuestionLogStatus) && isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
and t.teacher_open_course_question_log_status != 2
@}else{
@if(!isEmpty(teacherOpenCourseQuestionLogStatus)){
and t.teacher_open_course_question_log_status =#teacherOpenCourseQuestionLogStatus#
@}else if(!isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
and find_in_set(t.teacher_open_course_question_log_status,#teacherOpenCourseQuestionLogStatusPlural#)
@}
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
@if(!isEmpty(isTuck)){
and t.is_tuck =#isTuck#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUpdateTime)){
and t.teacher_open_course_question_log_update_time =#teacherOpenCourseQuestionLogUpdateTime#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogFinishTime)){
and t.teacher_open_course_question_log_finish_time =#teacherOpenCourseQuestionLogFinishTime#
@}
@if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite#)
@}
@if(!isEmpty(questionLogAddType)){
2 years ago
and t.question_log_add_type =#questionLogAddType#
@}
@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#)
@}
2 years ago
@if(!isEmpty(studentSnOrName)){
and (ta.student_sn like #'%'+studentSnOrName+'%'# or ta.student_name like #'%'+studentSnOrName+'%'#)
@}
@if(!isEmpty(schoolClassIdPlural)){
and find_in_set(ta.class_id, #schoolClassIdPlural#)
@}
2 years ago
@if(!isEmpty(questionLogAddType)){
2 years ago
and tc.teacher_open_course_question_setting_type = #questionSettingType#
and tc.teacher_open_course_question_setting_status = 1
and tc.teacher_open_course_question_setting_push_status = 1
@}
getValuesByQueryNotWithPermission
===
* 根据不为空的参数进行查询
2 years ago
select t.*,
ta.student_name,
ta.student_sn,
tb.class_name
from teacher_open_course_question_log t
2 years ago
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
@if(!isEmpty(questionSettingType)){
2 years ago
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where 1=1
@if(!isEmpty(teacherOpenCourseQuestionLogId)){
and t.teacher_open_course_question_log_id =#teacherOpenCourseQuestionLogId#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogIdPlural)){
and find_in_set(t.teacher_open_course_question_log_id,#teacherOpenCourseQuestionLogIdPlural#)
@}
3 years ago
@if(!isEmpty(teacherOpenCourseQuestionSettingId)){
and t.teacher_open_course_question_setting_id =#teacherOpenCourseQuestionSettingId#
@}
3 years ago
@if(!isEmpty(teacherOpenCourseQuestionSettingIdPlural)){
and find_in_set(t.teacher_open_course_question_setting_id,#teacherOpenCourseQuestionSettingIdPlural#)
@}
@if(!isEmpty(resourcesQuestionSnapshotId)){
and t.resources_question_snapshot_id =#resourcesQuestionSnapshotId#
@}
@if(!isEmpty(resourcesQuestionSnapshotIdPlural)){
and find_in_set(t.resources_question_snapshot_id,#resourcesQuestionSnapshotIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAnswer)){
and t.teacher_open_course_question_log_answer =#teacherOpenCourseQuestionLogAnswer#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUploadFile)){
and t.teacher_open_course_question_log_upload_file =#teacherOpenCourseQuestionLogUploadFile#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAddTime)){
and t.teacher_open_course_question_log_add_time =#teacherOpenCourseQuestionLogAddTime#
@}
@if(isEmpty(teacherOpenCourseQuestionLogStatus) && isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
and t.teacher_open_course_question_log_status != 2
@}else{
@if(!isEmpty(teacherOpenCourseQuestionLogStatus)){
and t.teacher_open_course_question_log_status =#teacherOpenCourseQuestionLogStatus#
@}else if(!isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
and find_in_set(t.teacher_open_course_question_log_status,#teacherOpenCourseQuestionLogStatusPlural#)
@}
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
@if(!isEmpty(isTuck)){
and t.is_tuck =#isTuck#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUpdateTime)){
and t.teacher_open_course_question_log_update_time =#teacherOpenCourseQuestionLogUpdateTime#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogFinishTime)){
and t.teacher_open_course_question_log_finish_time =#teacherOpenCourseQuestionLogFinishTime#
@}
@if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite#)
@}
@if(!isEmpty(questionLogAddType)){
and t.question_log_add_type = #questionLogAddType#
@}
@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#)
@}
2 years ago
@if(!isEmpty(studentSnOrName)){
and (ta.student_sn like #'%'+studentSnOrName+'%'# or ta.student_name like #'%'+studentSnOrName+'%'#)
@}
@if(!isEmpty(schoolClassIdPlural)){
and find_in_set(ta.class_id, #schoolClassIdPlural#)
@}
@if(!isEmpty(questionSettingType)){
and tc.teacher_open_course_question_setting_type =#questionSettingType#
2 years ago
and tc.teacher_open_course_question_setting_status = 1
and tc.teacher_open_course_question_setting_push_status = 1
@}
3 years ago
getQuestionLogScoreDetailsInfo
===
* 查询学生详细得分信息,查询分数详细信息
3 years ago
2 years ago
select
@pageTag() {
tz.*
@}
from (
select
t.student_id,
ta.student_name,
ta.student_sn,
ta.class_id,
tb.class_name,
count(distinct(t.resources_question_snapshot_id)) as question_count,
sum(case when t.teacher_open_course_question_log_update_time is not null then 1 else 0 end) as finish_count,
sum(case when t.teacher_open_course_question_log_update_time is not null and t.question_score = t.student_score then 1 else 0 end) as success_count,
sum(case when t.teacher_open_course_question_log_update_time is not null and t.question_score <> t.student_score then 1 else 0 end) as error_count,
sum(case when t.teacher_open_course_question_log_update_time is not null and t.question_score = t.student_score then 1 else 0 end) / IF(count(distinct(t.resources_question_snapshot_id)) = 0, 1, count(distinct(t.resources_question_snapshot_id))) * 100 as success_rate,
sum(case when t.teacher_open_course_question_log_update_time is not null and t.question_score = t.student_score then t.question_score else ifnull(t.student_score, 0) end) as student_score,
sum(case when t.teacher_open_course_question_log_update_time is not null then 1 else 0 end) / IF(count(distinct(t.resources_question_snapshot_id)) = 0, 1, count(distinct(t.resources_question_snapshot_id))) finish_progress
from
teacher_open_course_question_log t
left join resources_question_snapshot tc on tc.resources_question_snapshot_id = t.resources_question_snapshot_id
2 years ago
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
2 years ago
@ // 如果关联类型不为空,则关联题目配置表
2 years ago
@if(!isEmpty(questionLogAddType)){
2 years ago
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where
1 = 1
and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId#
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)){
and tc.teacher_open_course_merge_course_info_id = #teacherOpenCourseMergeCourseInfoId#
@}
@if(!isEmpty(studentOrName)){
and (ta.student_name like #'%'+studentOrName+'%'# or ta.student_sn like #'%'+studentOrName+'%'#)
@}
@if(!isEmpty(classId)){
and ta.class_id =#classId#
@}
@if(!isEmpty(studentId)){
and ta.student_id =#studentId#
@}
GROUP BY
t.student_id,
ta.student_name,
ta.student_sn,
ta.class_id,
tb.class_name
2 years ago
) tz
validateQuestionLogAddTimeLatest
===
* 验证前端传递过来的添加时间是否是最新的
select
if(t.teacher_open_course_question_log_update_time is null, true, t.teacher_open_course_question_log_update_time < #addTime#)
from
teacher_open_course_question_log t
where 1 = 1
and t.teacher_open_course_question_setting_id = #questionSettingId#
and FIND_IN_SET(t.resources_question_snapshot_id, #questionSnapshotIds#)
and t.student_id = #studentId#
and t.teacher_open_course_question_log_status = 1
order by teacher_open_course_question_log_add_time desc
limit 1
verifyLogAddTypeIsReSend
===
* 如果查询题目日志,如果有最后一次是交卷状态,或者压根没有过考试记录, 则返回重新发题的标记
SELECT IF(IFNULL(ta.question_log_add_type, 'NON') = #questionLogAddType#,1
,
(select count(*) from teacher_open_course_question_log where teacher_open_course_question_setting_id = #questionSettingId# and student_id = #studentId# ) = 0
)
FROM teacher_open_course_question_setting t
LEFT JOIN teacher_open_course_question_log ta
ON ta.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id AND ta.student_id = #studentId#
where t.teacher_open_course_question_setting_status = 1
AND t.teacher_open_course_question_setting_type = #questionSettingType#
AND t.teacher_open_course_question_setting_id = #questionSettingId#
order by ta.teacher_open_course_question_log_add_time desc
limit 1
2 years ago
getNotSubmitQuestionLogs
===
* 查询未提交的试卷
SELECT
*
FROM
teacher_open_course_question_log t
WHERE
NOT EXISTS (
SELECT
1
FROM
question_log_summary ta
WHERE
ta.person_id = #studentId#
AND ta.question_setting_id = #questionSettingId#
AND FIND_IN_SET( t.teacher_open_course_question_log_id, ta.question_log_ids )
)
AND t.student_id = #studentId#
AND t.teacher_open_course_question_setting_id = #questionSettingId#
getNotSubmitQuestionLogsCount
===
* 查询未提交试卷的题目数量
SELECT
count(1)
FROM
teacher_open_course_question_log t
WHERE
NOT EXISTS (
SELECT
1
FROM
question_log_summary ta
WHERE
ta.person_id = #studentId#
AND ta.question_setting_id = #questionSettingId#
AND FIND_IN_SET( t.teacher_open_course_question_log_id, ta.question_log_ids )
)
AND t.student_id = #studentId#
AND t.teacher_open_course_question_setting_id = #questionSettingId#
getHomeWorkLogExportPageList
===
* 查询附件作业-日志(分页)
SELECT
@pageTag() {
ta.student_sn,
ta.student_name,
tb.teacher_open_course_question_setting_id AS question_setting_id,
tb.teacher_open_course_question_setting_name AS question_setting_name,
t.teacher_open_course_question_log_upload_file AS question_setting_file,
t.teacher_open_course_question_log_reply AS question_log_reply,
t.student_score
@}
FROM
teacher_open_course_question_log t
INNER JOIN teacher_open_course_question_setting tb ON tb.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND tb.teacher_open_course_question_setting_status = 1
INNER JOIN student ta ON ta.student_id = t.student_id
AND ta.student_status = 1
WHERE
1
AND t.teacher_open_course_question_log_status = 1
AND t.student_score is not null
@if(isNotEmpty(teacherOpenCourseQuestionSettingId)) {
and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId#
@}
getHomeWorkLogExportList
===
* 查询附件作业-日志
SELECT
ta.student_sn,
ta.student_name,
tb.teacher_open_course_question_setting_id AS question_setting_id,
tb.teacher_open_course_question_setting_name AS question_setting_name,
t.teacher_open_course_question_log_upload_file AS question_setting_file,
t.teacher_open_course_question_log_reply AS question_log_reply,
t.student_score
FROM
teacher_open_course_question_log t
INNER JOIN teacher_open_course_question_setting tb ON tb.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND tb.teacher_open_course_question_setting_status = 1
INNER JOIN student ta ON ta.student_id = t.student_id
AND ta.student_status = 1
WHERE
1
AND t.teacher_open_course_question_log_status = 1
@if(isNotEmpty(teacherOpenCourseQuestionSettingId)) {
and t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId#
@}
logicDeleteQuestionLogBySummaryQuestionIds
===
* 删除题目的统计数据,附带删除题目做题日志数据
* 有可能只删除题目统计表,这时候需要删除做题日志相对应的数据
DELETE
FROM
teacher_open_course_question_log t
WHERE
@// 有可能只删除题目统计表,这时候需要删除做题日志相对应的数据
not find_in_set(
t.teacher_open_course_question_log_id,
( SELECT question_log_ids FROM question_log_summary a WHERE a.question_setting_id = t.teacher_open_course_question_setting_id ))
AND t.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId#
getChapterExerciseParticipantsValuesNumber
===
* 获取练习章节参与人数
SELECT
a.student_id
FROM
teacher_open_course_question_log a
WHERE
1 = 1
@if(isNotEmpty(teacherOpenCourseQuestionSettingIdPlural)) {
AND FIND_IN_SET(a.teacher_open_course_question_setting_id,#teacherOpenCourseQuestionSettingIdPlural#)
@}
2 years ago
GROUP BY a.student_id
getPageList
===
* 根据不为空的条件查询分页列表条件成立的情况下会联合question_log_summary表查出最新的做题记录
select
@pageTag(){
t.*,
ta.student_name,
ta.student_sn,
tb.class_name
@}
from teacher_open_course_question_log t
left join student ta on ta.student_id = t.student_id and ta.student_status = 1
left join school_class tb on tb.class_id = ta.class_id and tb.class_status = 1
@ // 如果关联类型不为空,则关联题目配置表
@if(!isEmpty(questionSettingType)){
inner join teacher_open_course_question_setting tc on tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
@}
where 1=1
@if(!isEmpty(questionSettingType)) {
and find_in_set(t.teacher_open_course_question_log_id, (
select question_log_ids from question_log_summary qls where 1=1
@if(!isEmpty(teacherOpenCourseQuestionSettingId)){
and qls.question_setting_id =#teacherOpenCourseQuestionSettingId#
@}
and qls.question_setting_type = #questionSettingType#
@if(!isEmpty(studentId)){
and qls.person_id =#studentId#
@}else{
and qls.person_id =t.student_id
@}
and qls.question_log_summary_status=1
order by qls.question_log_summary_add_time desc
limit 1
2 years ago
)
)
@}
@if(!isEmpty(teacherOpenCourseQuestionLogId)){
and t.teacher_open_course_question_log_id =#teacherOpenCourseQuestionLogId#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogIdPlural)){
and find_in_set(t.teacher_open_course_question_log_id,#teacherOpenCourseQuestionLogIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseQuestionSettingId)){
and t.teacher_open_course_question_setting_id =#teacherOpenCourseQuestionSettingId#
@}
@if(!isEmpty(teacherOpenCourseQuestionSettingIdPlural)){
and find_in_set(t.teacher_open_course_question_setting_id,#teacherOpenCourseQuestionSettingIdPlural#)
@}
@if(!isEmpty(resourcesQuestionSnapshotId)){
and t.resources_question_snapshot_id =#resourcesQuestionSnapshotId#
@}
@if(!isEmpty(resourcesQuestionSnapshotIdPlural)){
and find_in_set(t.resources_question_snapshot_id,#resourcesQuestionSnapshotIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAnswer)){
and t.teacher_open_course_question_log_answer =#teacherOpenCourseQuestionLogAnswer#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUploadFile)){
and t.teacher_open_course_question_log_upload_file =#teacherOpenCourseQuestionLogUploadFile#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAddTime)){
and t.teacher_open_course_question_log_add_time =#teacherOpenCourseQuestionLogAddTime#
@}
@if(isEmpty(teacherOpenCourseQuestionLogStatus) && isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
@// and t.teacher_open_course_question_log_status != 2
@}else{
@if(!isEmpty(teacherOpenCourseQuestionLogStatus)){
and t.teacher_open_course_question_log_status =#teacherOpenCourseQuestionLogStatus#
@}else if(!isEmpty(teacherOpenCourseQuestionLogStatusPlural)){
and find_in_set(t.teacher_open_course_question_log_status,#teacherOpenCourseQuestionLogStatusPlural#)
@}
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
@if(!isEmpty(studentScore)){
and t.student_score =#studentScore#
@}
@if(!isEmpty(questionType)){
and t.question_type =#questionType#
@}
@if(!isEmpty(questionTypePlural)){
and find_in_set(t.question_type,#questionTypePlural#)
@}
@if(!isEmpty(questionScore)){
and t.question_score =#questionScore#
@}
@if(!isEmpty(questionStem)){
and t.question_stem =#questionStem#
@}
@if(!isEmpty(questionOptionA)){
and t.question_option_a =#questionOptionA#
@}
@if(!isEmpty(questionOptionB)){
and t.question_option_b =#questionOptionB#
@}
@if(!isEmpty(questionOptionC)){
and t.question_option_c =#questionOptionC#
@}
@if(!isEmpty(questionOptionD)){
and t.question_option_d =#questionOptionD#
@}
@if(!isEmpty(questionOptionE)){
and t.question_option_e =#questionOptionE#
@}
@if(!isEmpty(questionAnswer)){
and t.question_answer =#questionAnswer#
@}
@if(!isEmpty(isTuck)){
and t.is_tuck =#isTuck#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUpdateTime)){
and t.teacher_open_course_question_log_update_time =#teacherOpenCourseQuestionLogUpdateTime#
@}
@if(!isEmpty(teacherOpenCourseQuestionLogFinishTime)){
and t.teacher_open_course_question_log_finish_time =#teacherOpenCourseQuestionLogFinishTime#
@}
@if(!isEmpty(isErrorFavorite)){
and (t.is_error_favorite =#isErrorFavorite#)
@}
@if(!isEmpty(questionLogAddType)){
and t.question_log_add_type = #questionLogAddType#
@}
@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(studentSnOrName)){
and (ta.student_sn like #'%'+studentSnOrName+'%'# or ta.student_name like #'%'+studentSnOrName+'%'#)
@}
@if(!isEmpty(schoolClassIdPlural)){
and find_in_set(ta.class_id, #schoolClassIdPlural#)
@}
@if(!isEmpty(questionSettingType)){
and tc.teacher_open_course_question_setting_type = #questionSettingType#
and tc.teacher_open_course_question_setting_status = 1
and tc.teacher_open_course_question_setting_push_status = 1
@}
updateStudentAnswerLockUpdateTime
===
*类似于乐观锁的形式更新
update teacher_open_course_question_log
set
@if(!isEmpty(teacherOpenCourseQuestionLogAnswer)){
teacher_open_course_question_log_answer = #teacherOpenCourseQuestionLogAnswer# ,
@}
@if(!isEmpty(teacherOpenCourseQuestionSettingId)){
teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId# ,
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUploadFile)){
teacher_open_course_question_log_upload_file = #teacherOpenCourseQuestionLogUploadFile# ,
@}
@if(!isEmpty(teacherOpenCourseQuestionLogAddTime)){
teacher_open_course_question_log_add_time = #teacherOpenCourseQuestionLogAddTime# ,
@}
@if(!isEmpty(teacherOpenCourseQuestionLogStatus)){
teacher_open_course_question_log_status = #teacherOpenCourseQuestionLogStatus# ,
@}
@if(!isEmpty(studentId)){
student_id = #studentId# ,
@}
@if(!isEmpty(questionType)){
question_type = #questionType# ,
@}
@if(!isEmpty(questionScore)){
question_score = #questionScore# ,
@}
@if(!isEmpty(isTuck)){
@if(isTuck){
is_tuck = 1 ,
@}else{
is_tuck = 0 ,
@}
@}
@if(!isEmpty(isErrorFavorite)){
@if(isErrorFavorite){
is_error_favorite = 1 ,
@}else{
is_error_favorite = 0 ,
@}
@}
@if(!isEmpty(studentScore)){
student_score = #studentScore# ,
@}
@if(!isEmpty(teacherOpenCourseQuestionLogUpdateTime)){
teacher_open_course_question_log_update_time = #teacherOpenCourseQuestionLogUpdateTime# ,
@}
@if(!isEmpty(teacherOpenCourseQuestionLogFinishTime)){
teacher_open_course_question_log_finish_time = #teacherOpenCourseQuestionLogFinishTime# ,
@}
@if(!isEmpty(questionLogAddType)){
question_log_add_type = #questionLogAddType# ,
@}
@if(!isEmpty(orgId)){
org_id = #orgId# ,
@}
@if(!isEmpty(userId)){
user_id = #userId# ,
@}
teacher_open_course_question_log_id = teacher_open_course_question_log_id
where 1=1
and teacher_open_course_question_log_id = #teacherOpenCourseQuestionLogId#
and IF(teacher_open_course_question_log_update_time <= #teacherOpenCourseQuestionLogUpdateTime#,1,IFNULL(teacher_open_course_question_log_update_time,0)=0)