|
|
queryByCondition
|
|
|
===
|
|
|
* 根据不为空的参数进行分页查询
|
|
|
|
|
|
select
|
|
|
@pageTag(){
|
|
|
t.*
|
|
|
#use("selectStudentAnswerFragment")#
|
|
|
@}
|
|
|
from general_resources_question_snapshot t
|
|
|
where 1=1
|
|
|
@//数据权限,该sql语句功能点,如果不考虑数据权限,可以删除此行
|
|
|
and #function("generalResourcesQuestionSnapshot.query")#
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotId)){
|
|
|
and t.general_resources_question_snapshot_id =#generalResourcesQuestionSnapshotId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotIdPlural)){
|
|
|
and find_in_set(t.general_resources_question_snapshot_id,#generalResourcesQuestionSnapshotIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingId)){
|
|
|
and t.general_question_setting_id =#generalQuestionSettingId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingIdPlural)){
|
|
|
and find_in_set(t.general_question_setting_id,#generalQuestionSettingIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoId)){
|
|
|
and t.business_course_info_id =#businessCourseInfoId#
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoIdPlural)){
|
|
|
and find_in_set(t.business_course_info_id,#businessCourseInfoIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoType)){
|
|
|
and t.business_course_info_type =#businessCourseInfoType#
|
|
|
@}
|
|
|
@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(questionAnalysis)){
|
|
|
and t.question_analysis =#questionAnalysis#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatus)){
|
|
|
and t.question_status =#questionStatus#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatusPlural)){
|
|
|
and find_in_set(t.question_status,#questionStatusPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(userIdPlural)){
|
|
|
and find_in_set(t.user_id,#userIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
@if(!isEmpty(orgIdPlural)){
|
|
|
and find_in_set(t.org_id,#orgIdPlural#)
|
|
|
@}
|
|
|
|
|
|
|
|
|
queryByConditionQuery
|
|
|
===
|
|
|
* 根据不为空的参数进行分页查询(无权限)
|
|
|
|
|
|
select
|
|
|
@pageTag(){
|
|
|
t.*
|
|
|
#use("selectStudentAnswerFragment")#
|
|
|
@}
|
|
|
from general_resources_question_snapshot t
|
|
|
where 1=1
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotId)){
|
|
|
and t.general_resources_question_snapshot_id =#generalResourcesQuestionSnapshotId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotIdPlural)){
|
|
|
and find_in_set(t.general_resources_question_snapshot_id,#generalResourcesQuestionSnapshotIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingId)){
|
|
|
and t.general_question_setting_id =#generalQuestionSettingId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingIdPlural)){
|
|
|
and find_in_set(t.general_question_setting_id,#generalQuestionSettingIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoId)){
|
|
|
and t.business_course_info_id =#businessCourseInfoId#
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoIdPlural)){
|
|
|
and find_in_set(t.business_course_info_id,#businessCourseInfoIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoType)){
|
|
|
and t.business_course_info_type =#businessCourseInfoType#
|
|
|
@}
|
|
|
@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(questionAnalysis)){
|
|
|
and t.question_analysis =#questionAnalysis#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatus)){
|
|
|
and t.question_status =#questionStatus#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatusPlural)){
|
|
|
and find_in_set(t.question_status,#questionStatusPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(userIdPlural)){
|
|
|
and find_in_set(t.user_id,#userIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
@if(!isEmpty(orgIdPlural)){
|
|
|
and find_in_set(t.org_id,#orgIdPlural#)
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deleteGeneralResourcesQuestionSnapshotByIds
|
|
|
===
|
|
|
|
|
|
* 批量删除
|
|
|
|
|
|
delete from general_resources_question_snapshot where find_in_set(general_resources_question_snapshot_id,#ids#)
|
|
|
|
|
|
deleteBySettingIds
|
|
|
===
|
|
|
|
|
|
* 批量删除(通过题目配置IDs)
|
|
|
|
|
|
delete from general_resources_question_snapshot where find_in_set(general_question_setting_id,#settingIds#)
|
|
|
|
|
|
|
|
|
|
|
|
getByIds
|
|
|
===
|
|
|
|
|
|
select * from general_resources_question_snapshot where find_in_set(general_resources_question_snapshot_id,#ids#)
|
|
|
|
|
|
|
|
|
updateGivenByIds
|
|
|
===
|
|
|
|
|
|
* 批量更新指定字段,无论此字段是否有值
|
|
|
|
|
|
update general_resources_question_snapshot
|
|
|
set
|
|
|
@if(contain("generalQuestionSettingId",_given)){
|
|
|
@if(isEmpty(generalQuestionSettingId)){
|
|
|
general_question_setting_id = null ,
|
|
|
@}else{
|
|
|
general_question_setting_id = #generalQuestionSettingId# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("businessCourseInfoId",_given)){
|
|
|
@if(isEmpty(businessCourseInfoId)){
|
|
|
business_course_info_id = null ,
|
|
|
@}else{
|
|
|
business_course_info_id = #businessCourseInfoId# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("businessCourseInfoType",_given)){
|
|
|
@if(isEmpty(businessCourseInfoType)){
|
|
|
business_course_info_type = null ,
|
|
|
@}else{
|
|
|
business_course_info_type = #businessCourseInfoType# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("questionType",_given)){
|
|
|
@if(isEmpty(questionType)){
|
|
|
question_type = null ,
|
|
|
@}else{
|
|
|
question_type = #questionType# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("questionScore",_given)){
|
|
|
@if(isEmpty(questionScore)){
|
|
|
question_score = null ,
|
|
|
@}else{
|
|
|
question_score = #questionScore# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("questionStem",_given)){
|
|
|
@if(isEmpty(questionStem)){
|
|
|
question_stem = null ,
|
|
|
@}else{
|
|
|
question_stem = #questionStem# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("questionOptionA",_given)){
|
|
|
@if(isEmpty(questionOptionA)){
|
|
|
question_option_a = null ,
|
|
|
@}else{
|
|
|
question_option_a = #questionOptionA# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("questionOptionB",_given)){
|
|
|
@if(isEmpty(questionOptionB)){
|
|
|
question_option_b = null ,
|
|
|
@}else{
|
|
|
question_option_b = #questionOptionB# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("questionOptionC",_given)){
|
|
|
@if(isEmpty(questionOptionC)){
|
|
|
question_option_c = null ,
|
|
|
@}else{
|
|
|
question_option_c = #questionOptionC# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("questionOptionD",_given)){
|
|
|
@if(isEmpty(questionOptionD)){
|
|
|
question_option_d = null ,
|
|
|
@}else{
|
|
|
question_option_d = #questionOptionD# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("questionOptionE",_given)){
|
|
|
@if(isEmpty(questionOptionE)){
|
|
|
question_option_e = null ,
|
|
|
@}else{
|
|
|
question_option_e = #questionOptionE# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("questionAnswer",_given)){
|
|
|
@if(isEmpty(questionAnswer)){
|
|
|
question_answer = null ,
|
|
|
@}else{
|
|
|
question_answer = #questionAnswer# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("questionAnalysis",_given)){
|
|
|
@if(isEmpty(questionAnalysis)){
|
|
|
question_analysis = null ,
|
|
|
@}else{
|
|
|
question_analysis = #questionAnalysis# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("questionStatus",_given)){
|
|
|
@if(isEmpty(questionStatus)){
|
|
|
question_status = null ,
|
|
|
@}else{
|
|
|
question_status = #questionStatus# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("userId",_given)){
|
|
|
@if(isEmpty(userId)){
|
|
|
user_id = null ,
|
|
|
@}else{
|
|
|
user_id = #userId# ,
|
|
|
@}
|
|
|
@}
|
|
|
@if(contain("orgId",_given)){
|
|
|
@if(isEmpty(orgId)){
|
|
|
org_id = null ,
|
|
|
@}else{
|
|
|
org_id = #orgId# ,
|
|
|
@}
|
|
|
@}
|
|
|
general_resources_question_snapshot_id = general_resources_question_snapshot_id
|
|
|
where find_in_set(general_resources_question_snapshot_id,#generalResourcesQuestionSnapshotIdPlural#)
|
|
|
|
|
|
|
|
|
|
|
|
getGeneralResourcesQuestionSnapshotValues
|
|
|
===
|
|
|
|
|
|
* 根据不为空的参数进行查询
|
|
|
|
|
|
select t.*
|
|
|
#use("selectStudentAnswerFragment")#
|
|
|
from general_resources_question_snapshot t
|
|
|
where 1=1
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotId)){
|
|
|
and t.general_resources_question_snapshot_id =#generalResourcesQuestionSnapshotId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingId)){
|
|
|
and t.general_question_setting_id =#generalQuestionSettingId#
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoId)){
|
|
|
and t.business_course_info_id =#businessCourseInfoId#
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoType)){
|
|
|
and t.business_course_info_type =#businessCourseInfoType#
|
|
|
@}
|
|
|
@if(!isEmpty(questionType)){
|
|
|
and t.question_type =#questionType#
|
|
|
@}
|
|
|
@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(questionAnalysis)){
|
|
|
and t.question_analysis =#questionAnalysis#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatus)){
|
|
|
and t.question_status =#questionStatus#
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
|
|
|
|
|
|
getValuesByQuery
|
|
|
===
|
|
|
|
|
|
* 根据不为空的参数进行查询
|
|
|
|
|
|
select t.*
|
|
|
#use("selectStudentAnswerFragment")#
|
|
|
from general_resources_question_snapshot t
|
|
|
where 1=1 and #function("generalResourcesQuestionSnapshot.query")#
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotId)){
|
|
|
and t.general_resources_question_snapshot_id =#generalResourcesQuestionSnapshotId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotIdPlural)){
|
|
|
and find_in_set(t.general_resources_question_snapshot_id,#generalResourcesQuestionSnapshotIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingId)){
|
|
|
and t.general_question_setting_id =#generalQuestionSettingId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingIdPlural)){
|
|
|
and find_in_set(t.general_question_setting_id,#generalQuestionSettingIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoId)){
|
|
|
and t.business_course_info_id =#businessCourseInfoId#
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoIdPlural)){
|
|
|
and find_in_set(t.business_course_info_id,#businessCourseInfoIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoType)){
|
|
|
and t.business_course_info_type =#businessCourseInfoType#
|
|
|
@}
|
|
|
@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(questionAnalysis)){
|
|
|
and t.question_analysis =#questionAnalysis#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatus)){
|
|
|
and t.question_status =#questionStatus#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatusPlural)){
|
|
|
and find_in_set(t.question_status,#questionStatusPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(userIdPlural)){
|
|
|
and find_in_set(t.user_id,#userIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
@if(!isEmpty(orgIdPlural)){
|
|
|
and find_in_set(t.org_id,#orgIdPlural#)
|
|
|
@}
|
|
|
|
|
|
selectStudentAnswerFragment
|
|
|
===
|
|
|
* 查询学生的分数
|
|
|
|
|
|
@if(!isEmpty(studentId!)){
|
|
|
,(select b.general_question_log_answer
|
|
|
from general_question_log b
|
|
|
where 1 = 1 and b.student_id = #studentId#
|
|
|
and b.general_question_log_status = 1
|
|
|
and b.general_question_setting_id = t.general_question_setting_id
|
|
|
and b.general_resources_question_snapshot_id = t.general_resources_question_snapshot_id
|
|
|
order by general_question_log_add_time desc limit 1
|
|
|
) as general_question_log_answer
|
|
|
@}
|
|
|
|
|
|
getValuesByQueryNotWithPermission
|
|
|
===
|
|
|
|
|
|
* 根据不为空的参数进行查询(不包含权限)
|
|
|
|
|
|
select t.*
|
|
|
#use("selectStudentAnswerFragment")#
|
|
|
from general_resources_question_snapshot t
|
|
|
where 1=1
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotId)){
|
|
|
and t.general_resources_question_snapshot_id =#generalResourcesQuestionSnapshotId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotIdPlural)){
|
|
|
and find_in_set(t.general_resources_question_snapshot_id,#generalResourcesQuestionSnapshotIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingId)){
|
|
|
and t.general_question_setting_id =#generalQuestionSettingId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingIdPlural)){
|
|
|
and find_in_set(t.general_question_setting_id,#generalQuestionSettingIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoId)){
|
|
|
and t.business_course_info_id =#businessCourseInfoId#
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoIdPlural)){
|
|
|
and find_in_set(t.business_course_info_id,#businessCourseInfoIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoType)){
|
|
|
and t.business_course_info_type =#businessCourseInfoType#
|
|
|
@}
|
|
|
@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(questionAnalysis)){
|
|
|
and t.question_analysis =#questionAnalysis#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatus)){
|
|
|
and t.question_status =#questionStatus#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatusPlural)){
|
|
|
and find_in_set(t.question_status,#questionStatusPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(userIdPlural)){
|
|
|
and find_in_set(t.user_id,#userIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
@if(!isEmpty(orgIdPlural)){
|
|
|
and find_in_set(t.org_id,#orgIdPlural#)
|
|
|
@}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getExcelValues
|
|
|
===
|
|
|
|
|
|
* 根据不为空的参数进行查询导入需要的参数
|
|
|
|
|
|
SELECT * FROM (
|
|
|
(
|
|
|
select
|
|
|
MAX(LENGTH(t.general_question_setting_id)) general_question_setting_id,
|
|
|
MAX(LENGTH(t.business_course_info_id)) business_course_info_id,
|
|
|
MAX(LENGTH(t.business_course_info_type)) business_course_info_type,
|
|
|
MAX(LENGTH(t.question_type)) question_type,
|
|
|
MAX(LENGTH(t.question_score)) question_score,
|
|
|
MAX(LENGTH(t.question_stem)) question_stem,
|
|
|
MAX(LENGTH(t.question_option_a)) question_option_a,
|
|
|
MAX(LENGTH(t.question_option_b)) question_option_b,
|
|
|
MAX(LENGTH(t.question_option_c)) question_option_c,
|
|
|
MAX(LENGTH(t.question_option_d)) question_option_d,
|
|
|
MAX(LENGTH(t.question_option_e)) question_option_e,
|
|
|
MAX(LENGTH(t.question_answer)) question_answer,
|
|
|
MAX(LENGTH(t.question_analysis)) question_analysis,
|
|
|
MAX(LENGTH(t.question_status)) question_status,
|
|
|
from general_resources_question_snapshot t
|
|
|
where 1=1 and #function("generalResourcesQuestionSnapshot.query")#
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotId)){
|
|
|
and t.general_resources_question_snapshot_id =#generalResourcesQuestionSnapshotId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotIdPlural)){
|
|
|
and find_in_set(t.general_resources_question_snapshot_id,#generalResourcesQuestionSnapshotIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingId)){
|
|
|
and t.general_question_setting_id =#generalQuestionSettingId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingIdPlural)){
|
|
|
and find_in_set(t.general_question_setting_id,#generalQuestionSettingIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoId)){
|
|
|
and t.business_course_info_id =#businessCourseInfoId#
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoIdPlural)){
|
|
|
and find_in_set(t.business_course_info_id,#businessCourseInfoIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoType)){
|
|
|
and t.business_course_info_type =#businessCourseInfoType#
|
|
|
@}
|
|
|
@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(questionAnalysis)){
|
|
|
and t.question_analysis =#questionAnalysis#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatus)){
|
|
|
and t.question_status =#questionStatus#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatusPlural)){
|
|
|
and find_in_set(t.question_status,#questionStatusPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(userIdPlural)){
|
|
|
and find_in_set(t.user_id,#userIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
@if(!isEmpty(orgIdPlural)){
|
|
|
and find_in_set(t.org_id,#orgIdPlural#)
|
|
|
@}
|
|
|
)
|
|
|
UNION ALL
|
|
|
(
|
|
|
select
|
|
|
t.general_question_setting_id ,
|
|
|
t.business_course_info_id ,
|
|
|
t.business_course_info_type ,
|
|
|
t.question_type ,
|
|
|
t.question_score ,
|
|
|
t.question_stem ,
|
|
|
t.question_option_a ,
|
|
|
t.question_option_b ,
|
|
|
t.question_option_c ,
|
|
|
t.question_option_d ,
|
|
|
t.question_option_e ,
|
|
|
t.question_answer ,
|
|
|
t.question_analysis ,
|
|
|
t.question_status ,
|
|
|
from general_resources_question_snapshot t
|
|
|
where 1=1 and #function("generalResourcesQuestionSnapshot.query")#
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotId)){
|
|
|
and t.general_resources_question_snapshot_id =#generalResourcesQuestionSnapshotId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalResourcesQuestionSnapshotIdPlural)){
|
|
|
and find_in_set(t.general_resources_question_snapshot_id,#generalResourcesQuestionSnapshotIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingId)){
|
|
|
and t.general_question_setting_id =#generalQuestionSettingId#
|
|
|
@}
|
|
|
@if(!isEmpty(generalQuestionSettingIdPlural)){
|
|
|
and find_in_set(t.general_question_setting_id,#generalQuestionSettingIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoId)){
|
|
|
and t.business_course_info_id =#businessCourseInfoId#
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoIdPlural)){
|
|
|
and find_in_set(t.business_course_info_id,#businessCourseInfoIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(businessCourseInfoType)){
|
|
|
and t.business_course_info_type =#businessCourseInfoType#
|
|
|
@}
|
|
|
@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(questionAnalysis)){
|
|
|
and t.question_analysis =#questionAnalysis#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatus)){
|
|
|
and t.question_status =#questionStatus#
|
|
|
@}
|
|
|
@if(!isEmpty(questionStatusPlural)){
|
|
|
and find_in_set(t.question_status,#questionStatusPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(userId)){
|
|
|
and t.user_id =#userId#
|
|
|
@}
|
|
|
@if(!isEmpty(userIdPlural)){
|
|
|
and find_in_set(t.user_id,#userIdPlural#)
|
|
|
@}
|
|
|
@if(!isEmpty(orgId)){
|
|
|
and t.org_id =#orgId#
|
|
|
@}
|
|
|
@if(!isEmpty(orgIdPlural)){
|
|
|
and find_in_set(t.org_id,#orgIdPlural#)
|
|
|
@}
|
|
|
)
|
|
|
)t
|
|
|
|
|
|
getQuestionBySettingOptionDTO
|
|
|
===
|
|
|
* 根据题目设置随机出题(从系统的题库获取)
|
|
|
|
|
|
select
|
|
|
@if(!isEmpty(singleScore)){
|
|
|
'' as general_resources_question_snapshot_id,
|
|
|
'' as general_question_setting_id,
|
|
|
'' as business_course_info_type,
|
|
|
t.course_info_id as business_course_info_id,
|
|
|
t.question_type,
|
|
|
t.question_stem,
|
|
|
t.question_option_a,
|
|
|
t.question_option_b,
|
|
|
t.question_option_c,
|
|
|
t.question_option_d,
|
|
|
t.question_option_e,
|
|
|
t.question_answer,
|
|
|
#singleScore# as question_score,
|
|
|
t.question_analysis,
|
|
|
t.question_status,
|
|
|
t.user_id,
|
|
|
t.org_id
|
|
|
@} else {
|
|
|
t.*,
|
|
|
t.course_info_id as business_course_info_id
|
|
|
@}
|
|
|
from resources_question t
|
|
|
where 1=1
|
|
|
and t.question_status = 1
|
|
|
@// 题目ID优先级高
|
|
|
@if(!isEmpty(resourcesQuestionIdPlural)) {
|
|
|
and find_in_set(t.resources_question_id, #resourcesQuestionIdPlural#)
|
|
|
@} else {
|
|
|
@// 随机抽题,根据题目配置动态抽取题目。会存在题库抽不够数的情况。
|
|
|
@if(!isEmpty(questionType)){
|
|
|
and find_in_set(t.question_type, #questionType#)
|
|
|
@}
|
|
|
@if(!isEmpty(selectCount)){
|
|
|
ORDER BY RAND()
|
|
|
limit #selectCount#
|
|
|
@}
|
|
|
@}
|
|
|
|
|
|
|
|
|
getQuestionTestSimpleInfo
|
|
|
===
|
|
|
* 学生端- 题目的简单信息(包含学生得分)
|
|
|
SELECT
|
|
|
@pageTag(){
|
|
|
t.general_question_setting_id,
|
|
|
t.general_question_setting_name,
|
|
|
t.general_question_setting_type,
|
|
|
t.general_question_start_time,
|
|
|
t.general_question_end_time,
|
|
|
(
|
|
|
SELECT
|
|
|
sum(
|
|
|
@ // 已经交卷的状态才算分
|
|
|
CASE WHEN ta.question_log_add_type = 'FINALLY_SUBMIT' THEN IFNULL( ta.student_score, 0 ) ELSE 0 END
|
|
|
)
|
|
|
FROM
|
|
|
general_question_log ta
|
|
|
WHERE
|
|
|
ta.general_question_setting_id = t.general_question_setting_id
|
|
|
and ta.general_question_log_status = 1
|
|
|
AND t.general_question_setting_status = 1
|
|
|
AND t.general_question_setting_push_status = 1
|
|
|
AND ta.student_id = #studentId#
|
|
|
) AS my_score,
|
|
|
(
|
|
|
SELECT
|
|
|
count( 1 )
|
|
|
FROM
|
|
|
resources_question_snapshot tb
|
|
|
WHERE
|
|
|
tb.general_question_setting_id = t.general_question_setting_id
|
|
|
AND tb.question_status = 1
|
|
|
) AS question_total_count,
|
|
|
(
|
|
|
SELECT
|
|
|
count( 1 ) > 0
|
|
|
FROM
|
|
|
general_question_log tc
|
|
|
WHERE
|
|
|
tc.general_question_setting_id = t.general_question_setting_id
|
|
|
AND tc.general_question_log_status = 1
|
|
|
@ // 是否已交卷
|
|
|
AND tc.question_log_add_type = 'FINALLY_SUBMIT'
|
|
|
LIMIT 1
|
|
|
) AS is_finished,
|
|
|
(
|
|
|
SELECT max(TIMEDIFF( td.general_question_log_update_time , td.general_question_log_add_time )) as finish_time
|
|
|
FROM general_question_log td
|
|
|
WHERE td.general_question_log_status = 1
|
|
|
@if(!isEmpty(studentId)) {
|
|
|
and td.student_id = #studentId#
|
|
|
@}
|
|
|
and td.question_log_add_type = 'FINALLY_SUBMIT'
|
|
|
and td.general_question_setting_id = t.general_question_setting_id
|
|
|
AND td.general_question_log_update_time IS NOT NULL
|
|
|
) as finish_time,
|
|
|
(
|
|
|
SELECT abs(max(TIMESTAMPDIFF(SECOND, te.general_question_log_update_time , te.general_question_log_add_time ))) as finish_second_time
|
|
|
FROM general_question_log te
|
|
|
WHERE te.general_question_log_status = 1
|
|
|
@if(!isEmpty(studentId)) {
|
|
|
and te.student_id = #studentId#
|
|
|
@}
|
|
|
and te.question_log_add_type = 'FINALLY_SUBMIT'
|
|
|
and te.general_question_setting_id = t.general_question_setting_id
|
|
|
AND te.general_question_log_update_time IS NOT NULL
|
|
|
) as finish_second_time,
|
|
|
(
|
|
|
SELECT round(sum(case when tf.question_score = tf.student_score then 1 else 0 end)
|
|
|
/ ifnull(count(distinct(tf.general_resources_question_snapshot_id)), 0) * 100, 2) as finish_second_time
|
|
|
FROM general_question_log tf
|
|
|
WHERE tf.general_question_log_status = 1
|
|
|
@if(!isEmpty(studentId)) {
|
|
|
and tf.student_id = #studentId#
|
|
|
@}
|
|
|
and tf.question_log_add_type = 'FINALLY_SUBMIT'
|
|
|
and tf.general_question_setting_id = t.general_question_setting_id
|
|
|
AND tf.general_question_log_update_time IS NOT NULL
|
|
|
) as correct_rate
|
|
|
@}
|
|
|
FROM
|
|
|
general_question_setting t
|
|
|
WHERE
|
|
|
1 = 1
|
|
|
AND t.general_question_setting_type = #teacherOpenCourseQuestionSettingType#
|
|
|
AND t.general_question_setting_push_status = 1
|
|
|
AND t.general_question_setting_status = 1
|
|
|
AND t.general_id = #teacherOpenCourseId#
|
|
|
order by t.general_question_setting_name asc
|
|
|
|
|
|
|
|
|
questionTestResults
|
|
|
===
|
|
|
* 教师端-题目的练习详情
|
|
|
SELECT
|
|
|
@pageTag(){
|
|
|
z.*
|
|
|
@}
|
|
|
FROM
|
|
|
(SELECT
|
|
|
t.student_id,
|
|
|
t.student_sn,
|
|
|
t.student_name,
|
|
|
th.class_name,
|
|
|
@ // 完成用时
|
|
|
max(TIMEDIFF( te.general_question_log_update_time , te.general_question_log_add_time )) AS finish_time,
|
|
|
@ // 题目总数
|
|
|
count(td.general_resources_question_snapshot_id) AS question_total_count,
|
|
|
@ // 正确的题数
|
|
|
count(case when te.question_score > 0 then 1 else 0 end) AS correct_count,
|
|
|
@ // 错误的题数
|
|
|
count(case when te.question_score = 0 then 1 else 0 end) AS wrong_count,
|
|
|
@ // 正确率 100为最大值
|
|
|
count(case when te.question_score > 0 then 1 else 0 end)
|
|
|
/ IF(count(td.general_resources_question_snapshot_id) = 0,1, count(td.general_resources_question_snapshot_id)) * 100 AS correct_rate,
|
|
|
@ // 该学生的总得分
|
|
|
sum(IFNULL(te.question_score, 0)) AS total_score
|
|
|
FROM
|
|
|
student t
|
|
|
LEFT JOIN general_merge_student tc ON tc.student_id = t.student_id
|
|
|
LEFT JOIN teacher_open_course ta ON ta.general_id = tc.general_id
|
|
|
LEFT JOIN general_question_setting tb ON tb.general_id = ta.general_id
|
|
|
LEFT JOIN resources_question_snapshot td ON td.general_question_setting_id = tb.general_question_setting_id
|
|
|
LEFT JOIN general_question_log te ON te.general_question_setting_id = tb.general_question_setting_id
|
|
|
LEFT JOIN school_class th ON th.class_id = t.class_id
|
|
|
@if(!isEmpty(teacherOpenCourseMergeSchoolClassIds)) {
|
|
|
LEFT JOIN general_merge_school_class ti ON ti.general_id = ta.general_id
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)) {
|
|
|
LEFT JOIN general_merge_course_info tj ON tj.general_id = ta.general_id
|
|
|
@}
|
|
|
WHERE
|
|
|
1 = 1
|
|
|
AND ta.general_status = 1
|
|
|
AND tb.general_question_setting_status = 1
|
|
|
AND tc.general_school_class_merge_student_status = 1
|
|
|
AND td.question_status = 1
|
|
|
AND te.general_question_log_status = 1
|
|
|
AND th.class_status = 1
|
|
|
@if(!isEmpty(teacherOpenCourseMergeSchoolClassIds)) {
|
|
|
AND ti.general_merge_school_class_status = 1
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)) {
|
|
|
AND tj.course_info_status = 1
|
|
|
@}
|
|
|
@ // 开课关联的班级ID
|
|
|
@if(!isEmpty(teacherOpenCourseMergeSchoolClassIds)) {
|
|
|
AND FIND_IN_SET(ti.general_merge_school_class_id, #teacherOpenCourseMergeSchoolClassIds#)
|
|
|
@}
|
|
|
@if(!isEmpty(studentSnOrStudentName)) {
|
|
|
AND CONCAT( t.student_sn, t.student_name ) LIKE #'%' + studentSnOrStudentName + '%'#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)) {
|
|
|
AND tj.general_merge_course_info_id = #teacherOpenCourseMergeCourseInfoId#
|
|
|
@}
|
|
|
@if(!isEmpty(teacherOpenCourseQuestionSettingId)) {
|
|
|
AND tb.general_question_setting_id = #teacherOpenCourseQuestionSettingId#
|
|
|
@}
|
|
|
GROUP BY
|
|
|
t.student_id,
|
|
|
t.student_sn,
|
|
|
t.student_name,
|
|
|
th.class_name
|
|
|
) z |