heheng
2025-06-25 076baf821f6ff0296826ecebac31b45ecce346a3
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
<?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.ExStudentStudyMapper">
    <resultMap type="com.gkhy.exam.system.domain.ExStudentStudy" id="ExStudentStudyResult">
        <result property="id"       column="id"       />
        <result property="phaseId"    column="phase_id"    />
        <result property="courseId"     column="course_id"     />
        <result property="chapterId"  column="chapter_id"  />
        <result property="periodId"         column="period_id"          />
        <result property="studentId"         column="student_id"          />
        <result property="currentDuration"         column="current_duration"          />
        <result property="currentPage"         column="current_page"          />
        <result property="progress"         column="progress"          />
        <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="version"         column="version"          />
        <result property="courseName"         column="course_name"          />
        <result property="chapterName"         column="chapter_mame"          />
        <result property="periodName"         column="period_name"          />
    </resultMap>
 
    <sql id="selectStudentStudyVo">
        select a.id, a.phase_id, a.course_id, a.chapter_id, a.period_id,a.student_id,a.current_duration,a.current_page,a.progress,
               a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,b.name as course_name,d.name as chapter_mame,c.name as period_name
        from ex_student_study a
        left join ex_course b on b.id=a.course_id
        left join ex_course_chapter c on c.id=a.chapter_id
        left join ex_course_chapter_period d on d.id=a.period_id
    </sql>
    <delete id="deleteStudentStudyByPhaseId">
        delete from ex_student_study where phase_id=#{phaseId} and student_id=#{studentId}
    </delete>
 
    <select id="countByPhaseId" resultType="java.lang.Integer">
        select count(1) from ex_student_study where phase_id=#{phaseId} and student_id=#{studentId}
    </select>
 
    <select id="selectStudyByPhaseAndStudentId" resultMap="ExStudentStudyResult">
        <include refid="selectStudentStudyVo"/>
        where a.phase_id=#{phaseId} and a.student_id=#{studentId} and a.course_id=#{courseId} order by a.create_time desc
    </select>
 
    <select id="selectStudyByObject" resultType="com.gkhy.exam.system.domain.ExStudentStudy">
        select * from ex_student_study where phase_id=#{phaseId} and  period_id=#{periodId} and student_id=#{studentId} limit 1
    </select>
</mapper>