<?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.ThStudyDetailMapper">
|
<select id="listByPage" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO">
|
SELECT
|
d.*,
|
s.name,
|
b.batch_name,
|
c.course_name,
|
cc.chapter_name
|
FROM
|
th_study_detail d
|
LEFT JOIN th_student s ON s.idcard = d.idcard
|
LEFT JOIN th_batch b ON b.uuid = d.batch_uuid
|
LEFT JOIN th_course c ON c.uuid = d.course_uuid
|
LEFT JOIN th_course_chapter cc ON cc.uuid = d.chapter_uuid
|
where d.del_flag = 0
|
<if test="query.idcard != null and query.idcard != ''">
|
and d.idcard = #{query.idcard}
|
</if>
|
<if test="query.courseUuid != null and query.courseUuid != ''">
|
and d.course_uuid = #{query.courseUuid}
|
</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(d.create_time,'%y-%m-%d') >= date_format(#{query.startTime},'%y-%m-%d')
|
</if>
|
<if test="query.endTime != null"><!-- 结束时间检索 -->
|
and date_format(d.create_time,'%y-%m-%d') <= date_format(#{query.endTime},'%y-%m-%d')
|
</if>
|
order by d.create_time desc
|
</select>
|
|
<select id="statisticDurationByIdcard" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudyVO">
|
SELECT
|
d.idcard,
|
sum( d.duration ) duration
|
FROM
|
th_study_detail d
|
WHERE
|
d.del_flag = 0
|
AND d.batch_uuid = #{batchUuid}
|
GROUP BY
|
d.idcard
|
</select>
|
<select id="listByBatchUuid" resultType="com.gkhy.exam.institutionalaccess.model.vo.ThStudyDetailVO">
|
SELECT
|
d.*,
|
cc.chapter_name,
|
cc.lesson_num
|
|
FROM
|
th_study_detail d
|
LEFT JOIN th_course_chapter cc ON cc.uuid = d.chapter_uuid
|
where d.del_flag = 0
|
AND d.batch_uuid = #{batchUuid}
|
</select>
|
|
</mapper>
|