PaperDictMapper.xml
2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.meishu.mapper.PaperDictMapper">
<select id="exercises" parameterType="long" resultType="com.meishu.vo.paper.ExercisesVO">
SELECT
t2.id,
t2.title,
t2.items,
t2.exercise_type
FROM
paper_exercises t
LEFT JOIN exercise_dict t2 ON t.exercise_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.paper_id = #{paperId}
</select>
<select id="exercisesWithAnswer" parameterType="long" resultType="com.meishu.vo.exercise.ExercisesWithAnswerVO">
SELECT
t2.id,
t2.title,
t2.items,
t2.exercise_type,
t2.right_answer
FROM
paper_exercises t
LEFT JOIN exercise_dict t2 ON t.exercise_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.paper_id = #{paperId}
<if test="exerciseType != null and exerciseType != ''">
and t2.exercise_type = #{exerciseType}
</if>
</select>
<select id="exerciseTypes" parameterType="long" resultType="string">
SELECT
distinct t2.exercise_type
FROM
paper_exercises t
LEFT JOIN exercise_dict t2 ON t.exercise_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.paper_id = #{paperId}
</select>
<select id="examExercises" resultType="com.meishu.vo.exercise.ExercisesWithAnswerVO">
SELECT
t.id,
t2.title,
t2.items,
t2.exercise_type,
t2.right_answer
FROM
exercise_done_history t
LEFT JOIN exercise_dict t2 ON t.exercise_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.student_id = #{studentId}
AND t.batch_exam_id = #{examId}
AND t.paper_id = #{paperId}
order by t.order_no
</select>
</mapper>