“djh”
20 小时以前 75309a59a676fb70f91dd01b05d93c7704a3836f
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
<?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.ExExamRecordMapper">
    <resultMap type="com.gkhy.exam.system.domain.ExExamRecord" id="ExamRecordResult">
        <result property="id"       column="id"       />
        <result property="companyId"    column="company_id"    />
        <result property="studentId"     column="student_id"     />
        <result property="planName"         column="plan_name"          />
        <result property="courseName"         column="course_name"          />
        <result property="level"         column="level"          />
        <result property="period"         column="period"          />
        <result property="actualPeriod"         column="actual_period"          />
        <result property="score"         column="score"          />
        <result property="companyId"         column="company_id"          />
        <result property="passed"         column="passed"          />
        <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"          />
        <association property="student" javaType="com.gkhy.exam.system.domain.ExStudent" resultMap="exStudentResult" />
    </resultMap>
 
    <resultMap id="exStudentResult" type="com.gkhy.exam.system.domain.ExStudent">
        <result property="id"       column="student_id"       />
        <result property="name"       column="student_name"       />
        <result property="phone"       column="student_phone"       />
        <result property="idNo"       column="student_idno"       />
    </resultMap>
 
    <sql id="selectExamRecordVo">
        select a.id, a.company_id, a.student_id, a.plan_name, a.course_name,a.level,a.period,a.actual_period,a.score,
               a.passed, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,b.name as company_name,
               c.name as student_name,c.id_no as student_idno,c.phone as student_phone
        from ex_exam_record a
        left join sys_company b on b.id=a.company_id
        left join ex_student c on c.id=a.student_id
    </sql>
    <insert id="insertFile">
        INSERT INTO `record_file`
        (`record_id`, `file_name`, `file_path`)
        VALUES
        <foreach collection="files" separator="," item="item">
            (  #{recordId},#{item.fileName}, #{item.filePath})
        </foreach>
    </insert>
    <delete id="deletedFile">
        delete from  record_file where record_id = #{id}
    </delete>
 
    <select id="selectExamRecordList" resultMap="ExamRecordResult">
        <include refid="selectExamRecordVo"/>
        <where>
            <if test="courseName != null and courseName != ''">
                AND a.course_name like concat('%', #{courseName}, '%')
            </if>
            <if test="companyName != null ">
                AND b.name like concat('%',#{companyName},'%')
            </if>
            <if test="companyId!=null">
                and a.company_id = #{companyId}
            </if>
        </where>
        order by a.id desc
    </select>
 
    <select id="selectExamRecordById" resultMap="ExamRecordResult">
        <include refid="selectExamRecordVo"/>
        where a.id=#{recordId}
    </select>
    <select id="selectFiles" resultType="com.gkhy.exam.system.domain.RecordFile">
        select
            id,
            record_id,
            file_name,
            file_path
        from record_file
        where record_id = #{id}
    </select>
</mapper>