|
@@ -71,22 +71,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="answer1 != null and answer1 != ''"> and answer1 = #{answer1}</if>
|
|
<if test="answer1 != null and answer1 != ''"> and answer1 = #{answer1}</if>
|
|
|
<if test="answer2 != null and answer2 != ''"> and answer2 = #{answer2}</if>
|
|
<if test="answer2 != null and answer2 != ''"> and answer2 = #{answer2}</if>
|
|
|
<if test="qtpye != null and qtpye != ''"> and qtpye = #{qtpye}</if>
|
|
<if test="qtpye != null and qtpye != ''"> and qtpye = #{qtpye}</if>
|
|
|
- <if test="subjectId != null "> and subjectId = #{subjectId}</if>
|
|
|
|
|
<if test="paperId != null "> and paperId = #{paperId}</if>
|
|
<if test="paperId != null "> and paperId = #{paperId}</if>
|
|
|
- <if test="knowledgeId != null ">
|
|
|
|
|
- and EXISTS (
|
|
|
|
|
- SELECT 1
|
|
|
|
|
- FROM learn_knowledge_question lkq
|
|
|
|
|
- WHERE lkq.question_id = learn_questions.id
|
|
|
|
|
- AND (
|
|
|
|
|
- lkq.knowledge_id = #{knowledgeId}
|
|
|
|
|
- OR EXISTS (
|
|
|
|
|
- SELECT 1
|
|
|
|
|
- FROM learn_knowledge_tree lkt
|
|
|
|
|
- WHERE lkt.id = lkq.knowledge_id
|
|
|
|
|
- AND (lkt.pid = #{knowledgeId} OR FIND_IN_SET(#{knowledgeId}, lkt.ancestors) > 0)
|
|
|
|
|
- )
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ <if test="subjectId != null or knowledgeId != null ">
|
|
|
|
|
+ and EXISTS ( SELECT 1 FROM learn_knowledge_question lkq WHERE lkq.question_id = learn_questions.id AND (
|
|
|
|
|
+ EXISTS (SELECT 1 FROM learn_knowledge_tree lkt
|
|
|
|
|
+ WHERE lkt.id = lkq.knowledge_id <if test="subjectId != null"> and lkt.subjectId = #{subjectId}</if>
|
|
|
|
|
+ <if test="knowledgeId != null"> AND (lkt.pid = #{knowledgeId} OR FIND_IN_SET(#{knowledgeId}, lkt.ancestors) > 0)</if>
|
|
|
|
|
+ ) <if test="knowledgeId != null"> OR lkq.knowledge_id = #{knowledgeId}</if>
|
|
|
|
|
+ )
|
|
|
)
|
|
)
|
|
|
</if>
|
|
</if>
|
|
|
<if test="diff != null "> and diff = #{diff}</if>
|
|
<if test="diff != null "> and diff = #{diff}</if>
|
|
@@ -320,6 +312,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
FROM `learn_knowledge_question` kq
|
|
FROM `learn_knowledge_question` kq
|
|
|
<if test="studentId != null">
|
|
<if test="studentId != null">
|
|
|
LEFT JOIN `learn_answer` a ON kq.`question_id` = a.`question_id` AND a.`student_id` = #{studentId}
|
|
LEFT JOIN `learn_answer` a ON kq.`question_id` = a.`question_id` AND a.`student_id` = #{studentId}
|
|
|
|
|
+ LEFT JOIN `learn_examinee` e ON a.`examinee_id` = e.`examinee_id` AND e.`state` >= 4
|
|
|
</if>
|
|
</if>
|
|
|
JOIN `learn_questions` q ON q.`id` = kq.`question_id`
|
|
JOIN `learn_questions` q ON q.`id` = kq.`question_id`
|
|
|
<where>
|
|
<where>
|
|
@@ -328,7 +321,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="isSubType != null and isSubType == 0"> and (kq.sub = 0)</if>
|
|
<if test="isSubType != null and isSubType == 0"> and (kq.sub = 0)</if>
|
|
|
<if test="knowIds != null"> and kq.`knowledge_id` in <foreach item="id" collection="knowIds" open="(" separator="," close=")">#{id}</foreach></if>
|
|
<if test="knowIds != null"> and kq.`knowledge_id` in <foreach item="id" collection="knowIds" open="(" separator="," close=")">#{id}</foreach></if>
|
|
|
<if test="types != null"> and q.`qtpye` in <foreach item="id" collection="types" open="(" separator="," close=")">#{id}</foreach></if>
|
|
<if test="types != null"> and q.`qtpye` in <foreach item="id" collection="types" open="(" separator="," close=")">#{id}</foreach></if>
|
|
|
- <if test="studentId != null"> AND a.`student_id` IS NULL</if>
|
|
|
|
|
|
|
+ <if test="studentId != null"> AND e.`examinee_id` IS NULL</if>
|
|
|
<if test="typeId != null"> AND kq.`type` = #{typeId}</if>
|
|
<if test="typeId != null"> AND kq.`type` = #{typeId}</if>
|
|
|
</where>
|
|
</where>
|
|
|
GROUP BY kq.knowledge_id, q.`qtpye`
|
|
GROUP BY kq.knowledge_id, q.`qtpye`
|
|
@@ -339,6 +332,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
FROM `learn_knowledge_question` kq
|
|
FROM `learn_knowledge_question` kq
|
|
|
<if test="id != null">
|
|
<if test="id != null">
|
|
|
LEFT JOIN `learn_answer` a ON kq.`question_id` = a.`question_id` AND a.`student_id` = #{id}
|
|
LEFT JOIN `learn_answer` a ON kq.`question_id` = a.`question_id` AND a.`student_id` = #{id}
|
|
|
|
|
+ LEFT JOIN `learn_examinee` e ON a.`examinee_id` = e.`examinee_id` AND e.`state` >= 4
|
|
|
</if>
|
|
</if>
|
|
|
JOIN `learn_questions` q ON q.`id` = kq.`question_id`
|
|
JOIN `learn_questions` q ON q.`id` = kq.`question_id`
|
|
|
<where>
|
|
<where>
|
|
@@ -347,7 +341,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="isSubType != null and isSubType == 0"> and (kq.sub = 0)</if>
|
|
<if test="isSubType != null and isSubType == 0"> and (kq.sub = 0)</if>
|
|
|
<if test="qtpye != null and qtpye != ''"> and qtpye = #{qtpye}</if>
|
|
<if test="qtpye != null and qtpye != ''"> and qtpye = #{qtpye}</if>
|
|
|
<if test="typeId != null"> and kq.type = #{typeId}</if>
|
|
<if test="typeId != null"> and kq.type = #{typeId}</if>
|
|
|
- <if test="id != null "> AND a.`student_id` IS NULL</if>
|
|
|
|
|
|
|
+ <if test="id != null "> AND e.`examinee_id` IS NULL</if>
|
|
|
<if test="knowledgeId != null "> and kq.knowledge_id = #{knowledgeId}</if>
|
|
<if test="knowledgeId != null "> and kq.knowledge_id = #{knowledgeId}</if>
|
|
|
</where>
|
|
</where>
|
|
|
limit #{number}, 500
|
|
limit #{number}, 500
|