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/resourcesQuestionSnapshot.md

851 lines
27 KiB
Markdown

queryByCondition
===
* 根据不为空的参数进行分页查询
3 years ago
select
@pageTag(){
t.*
@}
from resources_question_snapshot t
where 1=1
@//数据权限该sql语句功能点,如果不考虑数据权限,可以删除此行
and #function("resourcesQuestionSnapshot.query")#
@if(!isEmpty(resourcesQuestionSnapshotId)){
and t.resources_question_snapshot_id =#resourcesQuestionSnapshotId#
@}
@if(!isEmpty(resourcesQuestionSnapshotIdPlural)){
and find_in_set(t.resources_question_snapshot_id,#resourcesQuestionSnapshotIdPlural#)
@}
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(teacherOpenCourseMergeCourseInfoId)){
and t.teacher_open_course_merge_course_info_id =#teacherOpenCourseMergeCourseInfoId#
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoIdPlural)){
and find_in_set(t.teacher_open_course_merge_course_info_id,#teacherOpenCourseMergeCourseInfoIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionId)){
and t.teacher_open_course_merge_resources_question_id =#teacherOpenCourseMergeResourcesQuestionId#
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionIdPlural)){
and find_in_set(t.teacher_open_course_merge_resources_question_id,#teacherOpenCourseMergeResourcesQuestionIdPlural#)
@}
@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#)
@}
3 years ago
queryByConditionQuery
===
* 根据不为空的参数进行分页查询(无权限)
3 years ago
select
@pageTag(){
t.*
@}
from resources_question_snapshot t
where 1=1
@if(!isEmpty(resourcesQuestionSnapshotId)){
and t.resources_question_snapshot_id =#resourcesQuestionSnapshotId#
@}
@if(!isEmpty(resourcesQuestionSnapshotIdPlural)){
and find_in_set(t.resources_question_snapshot_id,#resourcesQuestionSnapshotIdPlural#)
@}
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(teacherOpenCourseMergeCourseInfoId)){
and t.teacher_open_course_merge_course_info_id =#teacherOpenCourseMergeCourseInfoId#
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoIdPlural)){
and find_in_set(t.teacher_open_course_merge_course_info_id,#teacherOpenCourseMergeCourseInfoIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionId)){
and t.teacher_open_course_merge_resources_question_id =#teacherOpenCourseMergeResourcesQuestionId#
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionIdPlural)){
and find_in_set(t.teacher_open_course_merge_resources_question_id,#teacherOpenCourseMergeResourcesQuestionIdPlural#)
@}
@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#)
@}
3 years ago
deleteResourcesQuestionSnapshotByIds
===
3 years ago
* 批量删除
3 years ago
delete from resources_question_snapshot where find_in_set(resources_question_snapshot_id,#ids#)
3 years ago
updateQuestionStatusByTeacherOpenCourseMergeResourcesQuestionIds
===
* 通过对应的开课题目库ID批量修改题目快照状态
update resources_question_snapshot set question_status = #questionStatus# where find_in_set(teacher_open_course_merge_resources_question_id,#ids#)
2 years ago
deleteBySettingIds
===
* 批量删除(通过题目配置ID)
delete from resources_question_snapshot where find_in_set(teacher_open_course_question_setting_id,#settingIds#)
3 years ago
getByIds
===
3 years ago
select * from resources_question_snapshot where find_in_set(resources_question_snapshot_id,#ids#)
updateGivenByIds
===
3 years ago
* 批量更新指定字段,无论此字段是否有值
3 years ago
update resources_question_snapshot
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("teacherOpenCourseMergeCourseInfoId",_given)){
@if(isEmpty(teacherOpenCourseMergeCourseInfoId)){
teacher_open_course_merge_course_info_id = null ,
@}else{
teacher_open_course_merge_course_info_id = #teacherOpenCourseMergeCourseInfoId# ,
@}
@}
@if(contain("teacherOpenCourseMergeResourcesQuestionId",_given)){
@if(isEmpty(teacherOpenCourseMergeResourcesQuestionId)){
teacher_open_course_merge_resources_question_id = null ,
@}else{
teacher_open_course_merge_resources_question_id = #teacherOpenCourseMergeResourcesQuestionId# ,
@}
@}
@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# ,
@}
@}
resources_question_snapshot_id = resources_question_snapshot_id
where find_in_set(resources_question_snapshot_id,#resourcesQuestionSnapshotIdPlural#)
3 years ago
getResourcesQuestionSnapshotValues
===
3 years ago
* 根据不为空的参数进行查询
3 years ago
select t.*
from resources_question_snapshot t
where 1=1
@if(!isEmpty(resourcesQuestionSnapshotId)){
and t.resources_question_snapshot_id =#resourcesQuestionSnapshotId#
@}
3 years ago
@if(!isEmpty(teacherOpenCourseQuestionSettingId)){
and t.teacher_open_course_question_setting_id =#teacherOpenCourseQuestionSettingId#
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)){
and t.teacher_open_course_merge_course_info_id =#teacherOpenCourseMergeCourseInfoId#
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionId)){
and t.teacher_open_course_merge_resources_question_id =#teacherOpenCourseMergeResourcesQuestionId#
@}
@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
===
3 years ago
* 根据不为空的参数进行查询
3 years ago
select t.*
from resources_question_snapshot t
where 1=1 and #function("resourcesQuestionSnapshot.query")#
@if(!isEmpty(resourcesQuestionSnapshotId)){
and t.resources_question_snapshot_id =#resourcesQuestionSnapshotId#
@}
@if(!isEmpty(resourcesQuestionSnapshotIdPlural)){
and find_in_set(t.resources_question_snapshot_id,#resourcesQuestionSnapshotIdPlural#)
@}
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(teacherOpenCourseMergeCourseInfoId)){
and t.teacher_open_course_merge_course_info_id =#teacherOpenCourseMergeCourseInfoId#
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoIdPlural)){
and find_in_set(t.teacher_open_course_merge_course_info_id,#teacherOpenCourseMergeCourseInfoIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionId)){
and t.teacher_open_course_merge_resources_question_id =#teacherOpenCourseMergeResourcesQuestionId#
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionIdPlural)){
and find_in_set(t.teacher_open_course_merge_resources_question_id,#teacherOpenCourseMergeResourcesQuestionIdPlural#)
@}
@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#)
@}
order by question_type
@// 同一大题,是否随机排序
@if(rand == true){
,rand()
@}
asc
selectStudentAnswerFragment
===
* 查询学生的分数
2 years ago
@if(!isEmpty(studentId!) && !isReSend){
,(select b.teacher_open_course_question_log_answer
from teacher_open_course_question_log b
where 1 = 1 and b.student_id = #studentId#
and b.teacher_open_course_question_log_status = 1
2 years ago
and b.question_log_add_type != 'FINALLY_SUBMIT'
and b.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
and b.resources_question_snapshot_id = t.resources_question_snapshot_id
order by teacher_open_course_question_log_add_time desc limit 1
2 years ago
) as teacher_open_course_question_log_answer,
(select count(1) > 0 from teacher_open_course_question_log ba
where 1 = 1 and ba.teacher_open_course_question_log_status = 1
and ba.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
and ba.resources_question_snapshot_id = t.resources_question_snapshot_id
and ba.is_tuck = 1 limit 1) as is_tuck
@}
getValuesByQueryNotWithPermission
===
* 根据不为空的参数进行查询
select t.*
2 years ago
#use("selectStudentAnswerFragment")#
from resources_question_snapshot t
where 1=1
@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(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(teacherOpenCourseMergeCourseInfoId)){
and t.teacher_open_course_merge_course_info_id =#teacherOpenCourseMergeCourseInfoId#
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoIdPlural)){
and find_in_set(t.teacher_open_course_merge_course_info_id,#teacherOpenCourseMergeCourseInfoIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionId)){
and t.teacher_open_course_merge_resources_question_id =#teacherOpenCourseMergeResourcesQuestionId#
@}
@if(!isEmpty(teacherOpenCourseMergeResourcesQuestionIdPlural)){
and find_in_set(t.teacher_open_course_merge_resources_question_id,#teacherOpenCourseMergeResourcesQuestionIdPlural#)
@}
@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#)
@}
order by question_type
@// 同一大题,是否随机排序
@if(rand == true){
,rand()
@}
asc
getQuestionTestSimpleInfo1
===
2 years ago
* 学生端- 题目的简单信息(包含学生得分)
2 years ago
2 years ago
SELECT
@pageTag(){
2 years ago
z.teacher_open_course_question_setting_id,
z.teacher_open_course_question_setting_name,
z.teacher_open_course_question_setting_type,
z.teacher_open_course_question_start_time,
z.teacher_open_course_question_end_time,
z.question_total_count,
2 years ago
z.my_score,
2 years ago
z.is_finished,
z.finish_time,
z.finish_second_time,
z.my_success_count,
round(z.my_success_count / z.question_total_count * 100, 2) as correct_rate
@}
FROM
(
SELECT
t.teacher_open_course_question_setting_id,
t.teacher_open_course_question_setting_name,
t.teacher_open_course_question_setting_type,
t.teacher_open_course_question_start_time,
t.teacher_open_course_question_end_time,
2 years ago
(
2 years ago
SELECT
@// 我的分数
sum( ta.student_score )
FROM
teacher_open_course_question_log ta
WHERE
ta.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND ta.teacher_open_course_question_log_status = 1
AND ta.question_log_add_type = #questionLogAddType#
AND ta.student_id = #studentId#
) AS my_score,
@// 题目总数
( SELECT count( 1 ) FROM resources_question_snapshot tb WHERE tb.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id AND tb.question_status = 1 ) AS question_total_count,
@// 是否交卷
2 years ago
(
SELECT
count( 1 ) > 0
FROM
teacher_open_course_question_log tc
WHERE
tc.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
AND tc.teacher_open_course_question_log_status = 1
AND tc.question_log_add_type = #questionLogAddType#
2 years ago
LIMIT 1
) AS is_finished,
2 years ago
@// 完成时间 00:00:00
(
2 years ago
SELECT
max(
TIMEDIFF( td.teacher_open_course_question_log_update_time, td.teacher_open_course_question_log_add_time )) AS finish_time
FROM
teacher_open_course_question_log td
WHERE
td.teacher_open_course_question_log_status = 1
AND td.student_id = #studentId#
AND td.question_log_add_type = #questionLogAddType#
AND td.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
) AS finish_time,
@// 完成时间(秒)
(
2 years ago
SELECT
abs(
max(
TIMESTAMPDIFF( SECOND, te.teacher_open_course_question_log_update_time, te.teacher_open_course_question_log_add_time )))
FROM
teacher_open_course_question_log te
WHERE
te.teacher_open_course_question_log_status = 1
AND te.student_id = #studentId#
AND te.question_log_add_type = #questionLogAddType#
AND te.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
) AS finish_second_time,
@// 题目正确数大于0就算对的
(
2 years ago
SELECT
2 years ago
sum( tf.student_score > 0 )
FROM
teacher_open_course_question_log tf
WHERE
tf.teacher_open_course_question_log_status = 1
AND tf.student_id = #studentId#
AND tf.question_log_add_type = #questionLogAddType#
AND tf.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
) AS my_success_count
2 years ago
FROM
teacher_open_course_question_setting t
WHERE
1 = 1
AND t.teacher_open_course_question_setting_type = #teacherOpenCourseQuestionSettingType#
AND t.teacher_open_course_question_setting_push_status = 1
AND t.teacher_open_course_question_setting_status = 1
AND t.teacher_open_course_id = #teacherOpenCourseId#
@pageIgnoreTag() {
2 years ago
ORDER BY
t.teacher_open_course_question_setting_name ASC
@}
2 years ago
) z
3 years ago
getQuestionTestSimpleInfo
===
* 学生端- 题目的简单信息(包含学生得分)
SELECT
@pageTag(){
t.teacher_open_course_question_setting_id,
t.teacher_open_course_question_setting_name,
t.teacher_open_course_question_setting_type,
t.teacher_open_course_question_start_time,
t.teacher_open_course_question_end_time,
t.teacher_open_course_merge_course_info_id,
ta.*,
( select count(distinct(tb.resources_question_snapshot_id)) from resources_question_snapshot tb
where tb.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
and tb.question_status = 1
) as question_total_count
@}
FROM
teacher_open_course_question_setting t
left join question_log_summary ta on ta.question_setting_id = t.teacher_open_course_question_setting_id
AND ta.person_id = #studentId#
AND ta.question_log_summary_status = 1
WHERE
1 = 1
AND t.teacher_open_course_question_setting_push_status = 1
AND t.teacher_open_course_question_setting_status = 1
AND t.teacher_open_course_question_setting_type = #teacherOpenCourseQuestionSettingType#
AND t.teacher_open_course_id = #teacherOpenCourseId#
AND ( select count(distinct(tb.resources_question_snapshot_id)) from resources_question_snapshot tb
where tb.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
and tb.question_status = 1
)>0
@pageIgnoreTag() {
ORDER BY
2 years ago
CONVERT(regexp_replace ( t.teacher_open_course_question_setting_name, '[^0-9]+', '' ),unsigned) asc
@}
3 years ago
questionTestResults
===
* 教师端-题目的练习详情
SELECT
2 years ago
@pageTag(){
z.*
@}
FROM
(SELECT
t.student_id,
t.student_sn,
t.student_name,
th.class_name,
@ // 完成用时
max(TIMEDIFF( te.teacher_open_course_question_log_update_time , te.teacher_open_course_question_log_add_time )) AS finish_time,
@ // 题目总数
count(td.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.resources_question_snapshot_id) = 0,1, count(td.resources_question_snapshot_id)) * 100 AS correct_rate,
@ // 该学生的总得分
sum(IFNULL(te.question_score, 0)) AS total_score
FROM
student t
LEFT JOIN teacher_open_course_merge_student tc ON tc.student_id = t.student_id
LEFT JOIN teacher_open_course ta ON ta.teacher_open_course_id = tc.teacher_open_course_id
LEFT JOIN teacher_open_course_question_setting tb ON tb.teacher_open_course_id = ta.teacher_open_course_id
LEFT JOIN resources_question_snapshot td ON td.teacher_open_course_question_setting_id = tb.teacher_open_course_question_setting_id
LEFT JOIN teacher_open_course_question_log te ON te.teacher_open_course_question_setting_id = tb.teacher_open_course_question_setting_id
LEFT JOIN school_class th ON th.class_id = t.class_id
@if(!isEmpty(teacherOpenCourseMergeSchoolClassIds)) {
LEFT JOIN teacher_open_course_merge_school_class ti ON ti.teacher_open_course_id = ta.teacher_open_course_id
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)) {
LEFT JOIN teacher_open_course_merge_course_info tj ON tj.teacher_open_course_id = ta.teacher_open_course_id
2 years ago
@}
3 years ago
WHERE
1 = 1
AND ta.teacher_open_course_status = 1
3 years ago
AND tb.teacher_open_course_question_setting_status = 1
AND tc.teacher_open_course_school_class_merge_student_status = 1
AND td.question_status = 1
AND te.teacher_open_course_question_log_status = 1
AND th.class_status = 1
@if(!isEmpty(teacherOpenCourseMergeSchoolClassIds)) {
AND ti.teacher_open_course_merge_school_class_status = 1
@}
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)) {
AND tj.course_info_status = 1
@}
@ // 开课关联的班级ID
@if(!isEmpty(teacherOpenCourseMergeSchoolClassIds)) {
AND FIND_IN_SET(ti.teacher_open_course_merge_school_class_id, #teacherOpenCourseMergeSchoolClassIds#)
3 years ago
@}
@if(!isEmpty(studentSnOrStudentName)) {
AND CONCAT( t.student_sn, t.student_name ) LIKE #'%' + studentSnOrStudentName + '%'#
3 years ago
@}
2 years ago
@if(!isEmpty(teacherOpenCourseMergeCourseInfoId)) {
AND tj.teacher_open_course_merge_course_info_id = #teacherOpenCourseMergeCourseInfoId#
2 years ago
@}
@if(!isEmpty(teacherOpenCourseQuestionSettingId)) {
AND tb.teacher_open_course_question_setting_id = #teacherOpenCourseQuestionSettingId#
@}
GROUP BY
t.student_id,
t.student_sn,
t.student_name,
th.class_name
) z
getQuestionTestInfoSupplyCenter
===
*学生端-获取章节练习的简单信息,供课程中心使用
SELECT
@pageTag(){
t.teacher_open_course_question_setting_id,
t.teacher_open_course_question_setting_name,
t.teacher_open_course_question_setting_type,
t.teacher_open_course_question_start_time,
t.teacher_open_course_question_end_time,
t.teacher_open_course_merge_course_info_id,
(select count(distinct (tb.resources_question_snapshot_id))
from resources_question_snapshot tb
where tb.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
and tb.question_status = 1) as question_total_count
@}
FROM teacher_open_course_question_setting t
WHERE 1 = 1
AND t.teacher_open_course_question_setting_push_status = 1
AND t.teacher_open_course_question_setting_status = 1
AND t.teacher_open_course_question_setting_type = #teacherOpenCourseQuestionSettingType#
AND t.teacher_open_course_id = #teacherOpenCourseId#
AND (select count(distinct (tb.resources_question_snapshot_id))
from resources_question_snapshot tb
where tb.teacher_open_course_question_setting_id = t.teacher_open_course_question_setting_id
and tb.question_status = 1) > 0
@pageIgnoreTag() {
ORDER BY t.teacher_open_course_question_setting_id desc
@}