kongzy
2024-06-26 daf7acb4f107a427e4a83ba1eb26e5e6012cbdaf
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
88
89
90
91
92
93
94
95
96
<?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.gkhy.exam.system.mapper.ExExamPaperMapper">
    <resultMap type="com.gkhy.exam.system.domain.ExExamPaper" id="ExamPaperResult">
        <result property="id"       column="id"       />
        <result property="name"    column="name"    />
        <result property="code"     column="code"     />
        <result property="status"  column="status"  />
        <result property="companyId"         column="company_id"          />
        <result property="categoryId"         column="category_id"          />
        <result property="limitTime"         column="limit_time"          />
        <result property="limit"         column="limit"          />
        <result property="singleNum"         column="single_num"          />
        <result property="singleScore"         column="single_score"          />
        <result property="singleBankId"         column="single_bank_id"          />
        <result property="singleMethod"         column="single_method"          />
        <result property="multiNum"         column="multi_num"          />
        <result property="multiScore"         column="multi_score"          />
        <result property="multiBankId"         column="multi_bank_id"          />
        <result property="multiMethod"         column="multi_method"          />
        <result property="judgeNum"         column="judge_num"          />
        <result property="judgeScore"         column="judge_score"          />
        <result property="judgeBankId"         column="judge_bank_id"          />
        <result property="judgeMethod"         column="judge_method"          />
        <result property="passScore"         column="pass_score"          />
        <result property="version"         column="version"          />
        <result property="delFlag"         column="del_flag"          />
        <result property="createBy"       column="create_by"       />
        <result property="createTime"     column="create_time"     />
        <result property="updateBy"       column="update_by"       />
        <result property="updateTime"     column="update_time"     />
        <result property="remark"         column="remark"          />
        <result property="companyName"         column="company_name"          />
        <collection property="singleQuestions" ofType="com.gkhy.exam.system.domain.ExQuestion" select="getQuestionByPaperId" column="{paperId=id,questionType=1}"/>
        <collection property="multiQuestions" ofType="com.gkhy.exam.system.domain.ExQuestion" select="getQuestionByPaperId" column="{paperId=id,questionType=2}"/>
        <collection property="judgeQuestions" ofType="com.gkhy.exam.system.domain.ExQuestion" select="getQuestionByPaperId" column="{paperId=id,questionType=3}"/>
    </resultMap>
 
 
    <sql id="selectExamPaperVo">
        select a.id, a.name, a.code, a.status, a.company_id,a.category_id,a.limit_time,a.limit,a.single_num,a.single_score,a.single_bank_id,
               a.single_method,a.multi_num,a.multi_score,
               a.multi_bank_id,a.multi_method,a.judge_num,a.judge_score,a.judge_bank_id,a.judge_method,a.pass_score,
               a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,b.name as company_name
        from ex_exam_paper a
        left join sys_company b on b.id=a.company_id
    </sql>
 
    <update id="deletePaperById">
        update ex_exam_paper set del_flag=1 where id=#{paperId}
    </update>
 
 
    <select id="selectExamPaperList" resultMap="ExamPaperResult">
        <include refid="selectExamPaperVo"/>
        <where>
            and a.del_flag=0
            <if test="name != null and name != ''">
                AND a.name like concat('%', #{name}, '%')
            </if>
            <if test="code != null and code != ''">
                AND a.credit_code like concat('%', #{creditCode}, '%')
            </if>
            <if test="companyId != null and companyId != ''">
                AND a.company_id= #{companyId}
            </if>
        </where>
        order by a.id desc
    </select>
 
    <select id="selectExamPaperById" resultMap="ExamPaperResult">
        <include refid="selectExamPaperVo"/>
        where a.id=#{paperId}
    </select>
 
    <select id="selectCountBetweenDay" resultType="java.lang.Long">
        select count(1) from ex_exam_paper where create_time &gt;= #{startTime} and create_time &lt;= #{endTime}
    </select>
 
    <select id="checkNameUnique" resultType="com.gkhy.exam.system.domain.ExExamPaper">
        select id ,name from ex_exam_paper where name=#{name} limit 1
    </select>
 
    <select id="getQuestionByPaperId" resultType="com.gkhy.exam.system.domain.ExQuestion">
        select a.* from ex_question a
        inner join ex_paper_question b on a.id=b.question_id
        where b.paper_id=#{paperId} and a.question_type=#{questionType}
        order by a.id asc
    </select>
 
 
 
 
 
 
</mapper>