zhangf
2024-06-24 21362fd048558832cdcaca8ee957d2d7aa753be2
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
<?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.institutionalaccess.mapper.ThExamRecordMapper">
<select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThExamRecordVO">
    SELECT
        e.*,
        s.`name`,
        c.course_name,
        b.batch_name
    FROM
        th_exam_record e
            LEFT JOIN th_student s ON s.idcard = e.idcard
            LEFT JOIN th_course c ON c.uuid = e.course_uuid
            LEFT JOIN th_batch b ON b.uuid = e.batch_uuid
    WHERE e.del_flag = 0
    <if test="query.idcard != null and query.idcard != ''">
        and e.idcard = #{query.idcard}
    </if>
    <if test="query.name != null and query.name != ''">
        and s.name like concat('%', #{query.name}, '%')
    </if>
    <if test="query.startTime != null"><!-- 开始时间检索 -->
        and date_format(e.exam_start_time,'%y-%m-%d') &gt;= date_format(#{query.startTime},'%y-%m-%d')
    </if>
    <if test="query.endTime != null"><!-- 结束时间检索 -->
        and date_format(e.exam_start_time,'%y-%m-%d') &lt;= date_format(#{query.endTime},'%y-%m-%d')
    </if>
    order by e.create_time desc
</select>
 
</mapper>