|
|
@@ -2049,7 +2049,7 @@
|
|
|
select DISTINCT eb.id exercise_book_id, eb.book_id id, eb.book_year, eb.book_name name, eb.grade, eb.course_name subject, eb.version version_type,
|
|
|
eb.semester, eb.book_type,eb.ai_rollback_import aiRollbackImport
|
|
|
from kmt_exercise_book eb, kmt_exercise_questions eq,tr_train_exercise_role er
|
|
|
- where eb.id=eq.exercise_book_id and eb.part_flag != 3 and eb.id = er.exercise_id
|
|
|
+ where eb.id=eq.exercise_book_id and eb.part_flag != 3 and eb.book_id = er.exercise_id
|
|
|
<if test="questionId != null and questionId != ''">
|
|
|
and eb.id=#{questionId}
|
|
|
</if>
|
|
|
@@ -2081,12 +2081,24 @@
|
|
|
select eq.id question_id, eq.course_name, eb.handle_user_id, eb.auditing_user_id, eb.analysis_user_id, eb.analysis_auditer_id, eq.book_course_id course_id,
|
|
|
eq.big_question_index, eq.small_question_name small_question_index, qw.is_diff is_common_flag,
|
|
|
eq.deal_status question_status, eq.create_time, eq.remark reason, eq.from_user_id, eq.to_user_id,
|
|
|
- eq.question_type question_types, eq.difficulty_level difficulty_levels, eq.real_exam_type real_exam_types,
|
|
|
- eq.training_skill training_skills, eq.parent_id, eq.proofread_status, eq.question_path, qw.number num, eq.page_index,
|
|
|
- eq.image question_image, eq.concise_id start_X, eq.analysis_submit_type start_Y, eq.update_type end_X, eq.es_loaded end_Y,eq.enumerate, eq.exercise_book_id
|
|
|
+ ifnull(ue.question_type,eq.question_type) question_types,
|
|
|
+ ifnull(ue.difficulty_level,eq.difficulty_level) difficulty_levels,
|
|
|
+ ifnull(ue.real_exam_type,eq.real_exam_type) real_exam_types,
|
|
|
+ ifnull(ue.training_skill,eq.training_skill) training_skills,
|
|
|
+ eq.parent_id, eq.proofread_status,
|
|
|
+ ifnull(ue.question_path,eq.question_path) as question_path,
|
|
|
+ qw.number num, eq.page_index,
|
|
|
+ ifnull(ue.question_path,eq.image) question_image,
|
|
|
+ ifnull(ue.concise_id,eq.concise_id) start_X,
|
|
|
+ ifnull(ue.analysis_submit_type,eq.analysis_submit_type) start_Y,
|
|
|
+ ifnull(ue.update_type,eq.update_type) end_X,
|
|
|
+ ifnull(ue.es_loaded,eq.es_loaded) end_Y,
|
|
|
+ ifnull(ue.enumerate,eq.enumerate) as enumerate,
|
|
|
+ eq.exercise_book_id
|
|
|
from kmt_exercise_questions eq
|
|
|
left join q_question_workbook qw on eq.id=qw.question_id
|
|
|
left join kmt_exercise_book eb on eq.exercise_book_id=eb.id
|
|
|
+ left join tr_train_user_exercise ue on eq.id = ue.question_id and ue.user_id=#{userId}
|
|
|
where eq.id=#{questionId}
|
|
|
and qw.sub_book_id=#{bookId} and eq.deal_status !=6
|
|
|
</select>
|
|
|
@@ -2191,11 +2203,9 @@
|
|
|
eq.parent_id,
|
|
|
eq.proofread_status,
|
|
|
ifnull(ue.question_path,eq.question_path) as question_path,
|
|
|
- <!-- eq.num,
|
|
|
- eq.page_index, -->
|
|
|
t.number as num,
|
|
|
t.page_index,
|
|
|
- eq.image question_image,
|
|
|
+ ifnull(ue.question_path,eq.image) question_image,
|
|
|
ifnull(ue.concise_id,eq.concise_id) start_X,
|
|
|
ifnull(ue.analysis_submit_type,eq.analysis_submit_type) start_Y,
|
|
|
ifnull(ue.update_type,eq.update_type) end_X,
|
|
|
@@ -2206,7 +2216,7 @@
|
|
|
q_question_workbook t
|
|
|
LEFT JOIN kmt_exercise_questions eq ON t.question_id=eq.id
|
|
|
LEFT JOIN kmt_exercise_book eb ON eq.exercise_book_id = eb.id
|
|
|
- left join tr_train_user_exercise ue on eb.id = ue.exercise_id and ue.user_id=#{userId}
|
|
|
+ left join tr_train_user_exercise ue on t.question_id = ue.question_id and ue.user_id=#{userId}
|
|
|
<if test="req.publishStatus==3">
|
|
|
LEFT JOIN q_question_info qi on t.question_id=qi.id
|
|
|
</if>
|
|
|
@@ -2221,6 +2231,10 @@
|
|
|
<if test="req.questionId !=null and req.questionId !=''">
|
|
|
and eq.id=#{req.questionId}
|
|
|
</if>
|
|
|
+ <if test="type == 0">
|
|
|
+ and (ue.id is null or ue.status = 2)
|
|
|
+ </if>
|
|
|
+
|
|
|
order by t.number
|
|
|
</select>
|
|
|
|
|
|
@@ -2310,55 +2324,41 @@
|
|
|
t.unit_name as NAME,
|
|
|
t.course_name as book_course_id,
|
|
|
t.course_name as book_course
|
|
|
- FROM
|
|
|
- q_question_workbook t
|
|
|
- INNER JOIN kmt_exercise_questions eq ON t.question_id = eq.id
|
|
|
- LEFT JOIN kmt_exercise_book eb ON eq.exercise_book_id = eb.id
|
|
|
- where eq.exercise_book_id=#{bookId}
|
|
|
- <choose>
|
|
|
- <when test = "dealType == 1">
|
|
|
- and eq.deal_status in (0, 1) and eb.handle_user_id=#{userId}
|
|
|
- <if test="questionId != null and questionId != ''">
|
|
|
- and eq.id=#{questionId}
|
|
|
- </if>
|
|
|
- </when>
|
|
|
- <when test = "dealType == 2">
|
|
|
- and eq.deal_status in (3, 7) and eb.auditing_user_id=#{userId}
|
|
|
- <if test="questionId != null and questionId != ''">
|
|
|
- and eq.id=#{questionId}
|
|
|
- </if>
|
|
|
- </when>
|
|
|
- <when test = "dealType == 4">
|
|
|
- and eq.deal_status in (5, 8) and eb.analysis_user_id=#{userId}
|
|
|
- <if test="questionId != null and questionId != ''">
|
|
|
- and eq.id=#{questionId}
|
|
|
- </if>
|
|
|
- </when>
|
|
|
- <when test = "dealType == 5">
|
|
|
- and eq.deal_status in (9, 10) and eb.analysis_auditer_id=#{userId}
|
|
|
- <if test="questionId != null and questionId != ''">
|
|
|
- and eq.id=#{questionId}
|
|
|
- </if>
|
|
|
- </when>
|
|
|
- <when test = "dealType == 6">
|
|
|
- and eq.deal_status >= 4 and eq.deal_status != 7 and eb.answer_correcter_id=#{userId} and eq.proofread_status = 0
|
|
|
- <if test="questionId != null and questionId != ''">
|
|
|
- and eq.id=#{questionId}
|
|
|
- </if>
|
|
|
- </when>
|
|
|
- <when test = "dealType == 7">
|
|
|
- and eq.proofread_status > 0 and eb.answer_correcter_id=#{userId}
|
|
|
- <if test="questionId != null and questionId != ''">
|
|
|
- and eq.id=#{questionId}
|
|
|
- </if>
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- <if test="questionId != null and questionId != ''">
|
|
|
- and eq.id=#{questionId}
|
|
|
- </if>
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
- order by t.number
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t.unit_name,
|
|
|
+ t.course_name,
|
|
|
+ @group_row :=
|
|
|
+ CASE
|
|
|
+
|
|
|
+ WHEN @parent_code = t.course_name COLLATE utf8mb4_0900_ai_ci THEN
|
|
|
+ @group_row + 1 ELSE 1
|
|
|
+ END AS groupRow,
|
|
|
+ @group_row2 :=
|
|
|
+ CASE
|
|
|
+
|
|
|
+ WHEN @parent_code = t.course_name COLLATE utf8mb4_0900_ai_ci
|
|
|
+ AND eb.id IS NOT NULL THEN
|
|
|
+ @group_row2 + 1 ELSE 1
|
|
|
+ END AS groupRow2,
|
|
|
+ @parent_code := t.course_name AS parent_code
|
|
|
+ FROM
|
|
|
+ q_question_workbook t
|
|
|
+ INNER JOIN kmt_exercise_questions eq ON t.question_id = eq.id
|
|
|
+ LEFT JOIN tr_train_user_exercise eb ON eq.id = eb.question_id and eb.user_id =#{userId}
|
|
|
+ LEFT JOIN ( SELECT @group_row := 1, @group_row2 := 1, @parent_code := '' ) AS b ON 1 = 1
|
|
|
+ WHERE
|
|
|
+ eq.exercise_book_id =#{bookId}
|
|
|
+ <if test="questionId != null and questionId != ''">
|
|
|
+ and eq.id=#{questionId}
|
|
|
+ </if>
|
|
|
+ ORDER BY
|
|
|
+ t.number
|
|
|
+ ) t
|
|
|
+ WHERE
|
|
|
+ t.groupRow <![CDATA[ <> ]]> t.groupRow2
|
|
|
+
|
|
|
) a,(select @i:=0) num
|
|
|
</select>
|
|
|
|