智慧保安后台管理-验收版本
tangzy
2021-12-06 30df94c05573a426d030510d4dd58ae1d93bfb7a
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?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="org.springblade.modules.exam.mapper.ExamSubjectChoicesMapper">
 
    <!--选择题分页信息-->
    <select id="selectExamSubjectChoicesPage" resultType="org.springblade.modules.exam.vo.ExamSubjectChoicesVO">
        SELECT
            esc.*
        FROM
            exam_subject_choices esc
        WHERE
            1=1
        <if test="examSubjectChoices.subjectName!=null and  examSubjectChoices.subjectName!=''">
            and esc.subject_name like concat('%', #{examSubjectChoices.subjectName},'%')
        </if>
        <if test="examSubjectChoices.choicesType!=null and  examSubjectChoices.choicesType!=''">
            and choices_type = #{examSubjectChoices.choicesType}
        </if>
    </select>
 
    <!--查询试卷绑定的题目-->
    <select id="getEexPaperChoices" resultType="org.springblade.modules.exam.vo.ExamSubjectChoicesVO">
        SELECT
            esc.*
        FROM
            exam_subject_choices esc
        LEFT JOIN exam_examination_subject exa ON esc.id = exa.subject_id
        WHERE
            1=1
        <if test="examSubjectChoices.id!=null and  examSubjectChoices.id!=''">
            and exa.examination_id = #{examSubjectChoices.id}
        </if>
        <if test="examSubjectChoices.subjectName!=null and  examSubjectChoices.subjectName!=''">
            and esc.subject_name like concat('%', #{examSubjectChoices.subjectName},'%')
        </if>
        <if test="examSubjectChoices.choicesType!=null and  examSubjectChoices.choicesType!=''">
            and esc.choices_type = #{examSubjectChoices.choices_type}
        </if>
    </select>
 
 
    <!--ExamSubjectChoicesInfoMap 多表联查 一对多查询 -->
    <resultMap id="ExamSubjectChoicesInfoMap" type="org.springblade.modules.exam.vo.ExamSubjectChoicesVO">
        <id property="id" column="id"/>
        <id property="categoryId" column="category_id"/>
        <id property="subjectName" column="subject_name"/>
        <id property="choicesType" column="choices_type"/>
        <id property="score" column="score"/>
        <id property="analysis" column="analysis"/>
        <id property="level" column="level"/>
        <id property="creator" column="creator"/>
        <id property="createDate" column="create_date"/>
        <id property="modifier" column="modifier"/>
        <id property="modifyDate" column="modify_date"/>
        <id property="delFlag" column="del_flag"/>
        <id property="applicationCode" column="application_code"/>
        <id property="tenantCode" column="tenant_code"/>
        <result column="id" property="id"/>
        <collection property="examSubjectOptions" javaType="java.util.List" ofType="org.springblade.modules.exam.entity.ExamSubjectOption" autoMapping="true">
            <id property="id" column="eso_id"/>
        </collection>
    </resultMap>
 
 
    <!--选择题详情信息-->
    <select id="selectExamSubjectChoicesInfo" resultMap="ExamSubjectChoicesInfoMap">
        SELECT
        esc.*,
        eso.id eso_id,eso.subject_choices_id,eso.option_name,eso.option_content,eso.creator,
        eso.create_date,eso.modifier,eso.modify_date,eso.del_flag,eso.application_code,eso.tenant_code
        FROM
        exam_subject_choices esc
        left join
        exam_subject_option eso
        on
        esc.id = eso.subject_choices_id
        WHERE
        1=1
        <if test="examSubjectChoices.id!=null">
            and esc.id = #{examSubjectChoices.id}
        </if>
    </select>
 
    <update id="updateChoicesValue">
        update exam_subject_choices set score = #{value} where id = #{id}
    </update>
</mapper>