lanan-system/dl-module-jx/src/main/resources/mapper/exam/ExamBatchMapper.xml
2025-06-18 17:24:30 +08:00

77 lines
2.5 KiB
XML

<?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="cn.iocoder.yudao.module.exam.mapper.ExamBatchMapper">
<select id="queryListPage" resultType="cn.iocoder.yudao.module.exam.vo.ExamBatchVO">
SELECT
dseb.*
FROM
drive_school_exam_batch dseb
WHERE dseb.deleted=0
<if test="entity.coachId != null and entity.coachId != ''">
and dseb.coach_id =#{entity.coachId}
</if>
<if test="entity.courseId != null and entity.courseId != ''">
and dseb.course_id =#{entity.courseId}
</if>
<if test="entity.subject != null and entity.subject != ''">
and dseb.subject =#{entity.subject}
</if>
<if test="entity.startTimeSearch!=null and entity.startTimeSearch!=''">
AND dseb.start_time &gt;= #{entity.startTimeSearch}
</if>
<if test="entity.endTimeSearch!=null and entity.endTimeSearch!=''">
AND dseb.start_time &lt;= #{entity.endTimeSearch}
</if>
ORDER BY dseb.create_time DESC
</select>
<select id="getStudentByCoachId" resultType="cn.iocoder.yudao.module.exam.vo.ExamBatchNewVO">
SELECT
dss.name,
dss.user_id,
dss.avatar,
dss.phone,
dseb.start_time
FROM
drive_school_coach dsc
INNER JOIN
drive_school_exam_batch dseb
ON dseb.coach_id = dsc.user_id
AND dseb.deleted = 0
AND dseb.subject = #{subject}
INNER JOIN
drive_school_exam_batch_item dsebi
ON dsebi.batch_id = dseb.id
AND dsebi.deleted = 0
AND dsebi.if_pass = #{ifPass}
INNER JOIN
drive_school_student dss
ON dsebi.user_id = dss.user_id
WHERE
<if test="coachId != null">
dsc.user_id = #{coachId}
</if>
<if test="startTime != null and startTime != '' ">
AND dseb.start_time &gt;= #{startTime}
</if>
<if test="endTime != null and endTime != '' ">
AND dseb.start_time &lt;= #{endTime}
</if>
<if test="name != null and name != ''">
AND dss.name LIKE CONCAT('%', #{name}, '%')
</if>
ORDER BY
<choose>
<when test="sort == 'asc'">
dseb.start_time ASC
</when>
<otherwise>
dseb.start_time DESC
</otherwise>
</choose>
</select>
</mapper>