2025-01-15 18:09:45 +08:00
|
|
|
|
<?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.course.mapper.ProcessMapper">
|
|
|
|
|
|
|
2025-01-21 00:12:53 +08:00
|
|
|
|
<update id="updateProcessBatch">
|
|
|
|
|
|
UPDATE drive_school_process
|
|
|
|
|
|
SET exam_status = '9'
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
user_id IN
|
|
|
|
|
|
<foreach collection="userIdList" item="item" open="(" separator="," close=")">
|
|
|
|
|
|
#{item}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
AND course_id = #{courseId}
|
|
|
|
|
|
AND `subject` = #{subject}
|
|
|
|
|
|
AND coach_id = #{coachId}
|
2025-04-17 18:38:34 +08:00
|
|
|
|
AND (exam_status IS NULL OR exam_status = '0')
|
2025-01-21 00:12:53 +08:00
|
|
|
|
AND deleted =0
|
|
|
|
|
|
</update>
|
2025-01-21 14:46:26 +08:00
|
|
|
|
<update id="updateProcessExamResult">
|
|
|
|
|
|
|
|
|
|
|
|
</update>
|
2025-02-10 09:34:01 +08:00
|
|
|
|
<select id="selectNewMaxByUserId" resultType="cn.iocoder.yudao.module.course.entity.Process">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
dsp.* FROM drive_school_process dsp
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
dsp.user_id = #{userId}
|
2025-02-11 10:15:55 +08:00
|
|
|
|
<if test="coachId != null and coachId != ''">
|
|
|
|
|
|
AND dsp.coach_id=#{coachId}
|
|
|
|
|
|
</if>
|
2025-02-10 09:34:01 +08:00
|
|
|
|
ORDER BY dsp.`subject` DESC, dsp.create_time DESC LIMIT 1
|
|
|
|
|
|
</select>
|
2025-02-11 15:30:07 +08:00
|
|
|
|
<select id="selectAllTrainTime" resultType="java.lang.Double">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
SUM(dsp.train_time)
|
|
|
|
|
|
FROM
|
|
|
|
|
|
drive_school_process dsp
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
dsp.user_id = #{userId}
|
|
|
|
|
|
AND dsp.deleted = 0
|
|
|
|
|
|
AND dsp.course_id = #{courseId}
|
|
|
|
|
|
AND (( dsp.`status` = '2' AND dsp.exam_status = '1' ) OR dsp.`status` = '1' )
|
|
|
|
|
|
</select>
|
2025-05-10 16:35:42 +08:00
|
|
|
|
|
2025-02-17 17:31:46 +08:00
|
|
|
|
<select id="pageProcess" resultType="cn.iocoder.yudao.module.course.vo.ProcessVO">
|
|
|
|
|
|
SELECT
|
2025-05-10 16:35:42 +08:00
|
|
|
|
dsp.*,
|
|
|
|
|
|
dss.id_card AS studentIdCard,
|
|
|
|
|
|
sysu.nickname AS updateName
|
|
|
|
|
|
FROM drive_school_process dsp
|
|
|
|
|
|
LEFT JOIN drive_school_student dss ON dss.user_id = dsp.user_id
|
|
|
|
|
|
LEFT JOIN system_users sysu on sysu.id = dsp.updater
|
2025-02-17 17:31:46 +08:00
|
|
|
|
<where>
|
2025-02-19 16:18:17 +08:00
|
|
|
|
dsp.deleted = 0
|
|
|
|
|
|
<if test="entity.coachName != null and entity.coachName != '' "> and dsp.coach_name like concat('%', #{entity.coachName}, '%')</if>
|
|
|
|
|
|
<if test="entity.userName != null and entity.userName != '' "> and dsp.user_name like concat('%', #{entity.userName}, '%')</if>
|
2025-04-01 17:55:33 +08:00
|
|
|
|
<if test="entity.courseName != null and entity.courseName != '' "> and dsp.name like concat('%', #{entity.courseName}, '%')</if>
|
|
|
|
|
|
<if test="entity.userId != null "> and dsp.user_id = #{entity.userId}</if>
|
2025-04-02 15:31:03 +08:00
|
|
|
|
<if test="entity.courseId != null and entity.courseId != '' "> and dsp.course_id = #{entity.courseId}</if>
|
2025-05-28 17:14:39 +08:00
|
|
|
|
<!--<if test="entity.studentIdCard != null and entity.studentIdCard != '' "> AND RIGHT(dss.id_card, 4) = RIGHT(#{entity.studentIdCard}, 4) </if>-->
|
|
|
|
|
|
<if test="entity.studentIdCard != null and entity.studentIdCard != '' ">
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<!-- 精确匹配:当输入18位时 -->
|
|
|
|
|
|
<when test="entity.studentIdCard.length() == 18">
|
|
|
|
|
|
AND dss.id_card = #{entity.studentIdCard}
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<!-- 后4位匹配:当输入正好4位时 -->
|
|
|
|
|
|
<when test="entity.studentIdCard.length() == 4">
|
|
|
|
|
|
AND RIGHT(dss.id_card, 4) = #{entity.studentIdCard}
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<!-- 模糊搜索:当输入大于4位但不足18位时 -->
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
AND dss.id_card LIKE concat('%', #{entity.studentIdCard}, '%')
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
</if>
|
2025-02-17 17:31:46 +08:00
|
|
|
|
</where>
|
2025-04-02 13:44:13 +08:00
|
|
|
|
ORDER BY
|
|
|
|
|
|
(CASE
|
2025-05-10 16:35:42 +08:00
|
|
|
|
WHEN dsp.exam_status = '1' AND dsp.finance_pass IS NULL THEN 1 -- 优先级最高
|
|
|
|
|
|
WHEN dsp.exam_status = '9' THEN 2
|
|
|
|
|
|
WHEN dsp.status = '1' THEN 2
|
2025-04-02 13:44:13 +08:00
|
|
|
|
ELSE 4
|
|
|
|
|
|
END),
|
2025-05-10 16:35:42 +08:00
|
|
|
|
dsp.create_time DESC; -- 再按创建时间降序
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-06-05 14:30:56 +08:00
|
|
|
|
<select id="pageProcessNew" resultType="cn.iocoder.yudao.module.course.vo.ProcessVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
dsp.*,
|
|
|
|
|
|
dss.id_card AS studentIdCard,
|
|
|
|
|
|
sysu.nickname AS updateName
|
|
|
|
|
|
FROM drive_school_process dsp
|
|
|
|
|
|
LEFT JOIN drive_school_student dss ON dss.user_id = dsp.user_id
|
|
|
|
|
|
LEFT JOIN system_users sysu on sysu.id = dsp.updater
|
|
|
|
|
|
<where>
|
|
|
|
|
|
dsp.deleted = 0 AND dsp.subject in (2,3)
|
|
|
|
|
|
<if test="entity.coachName != null and entity.coachName != '' "> and dsp.coach_name like concat('%', #{entity.coachName}, '%')</if>
|
|
|
|
|
|
<if test="entity.userName != null and entity.userName != '' "> and dsp.user_name like concat('%', #{entity.userName}, '%')</if>
|
|
|
|
|
|
<if test="entity.courseName != null and entity.courseName != '' "> and dsp.name like concat('%', #{entity.courseName}, '%')</if>
|
|
|
|
|
|
<if test="entity.userId != null "> and dsp.user_id = #{entity.userId}</if>
|
|
|
|
|
|
<if test="entity.courseId != null and entity.courseId != '' "> and dsp.course_id = #{entity.courseId}</if>
|
|
|
|
|
|
<if test="entity.examStatus != null ">and dsp.exam_status = #{entity.examStatus}</if>
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<when test="entity.financePass == true">
|
|
|
|
|
|
AND dsp.finance_pass = 1
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<when test="entity.financePass == false">
|
|
|
|
|
|
AND dsp.finance_pass = 0
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<when test="entity.financePass == null">
|
|
|
|
|
|
AND dsp.finance_pass IS NULL
|
|
|
|
|
|
</when>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
<if test="entity.studentIdCard != null and entity.studentIdCard != '' ">
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<!-- 精确匹配:当输入18位时 -->
|
|
|
|
|
|
<when test="entity.studentIdCard.length() == 18">
|
|
|
|
|
|
AND dss.id_card = #{entity.studentIdCard}
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<!-- 后4位匹配:当输入正好4位时 -->
|
|
|
|
|
|
<when test="entity.studentIdCard.length() == 4">
|
|
|
|
|
|
AND RIGHT(dss.id_card, 4) = #{entity.studentIdCard}
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<!-- 模糊搜索:当输入大于4位但不足18位时 -->
|
|
|
|
|
|
<otherwise>
|
|
|
|
|
|
AND dss.id_card LIKE concat('%', #{entity.studentIdCard}, '%')
|
|
|
|
|
|
</otherwise>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
ORDER BY
|
|
|
|
|
|
(CASE
|
|
|
|
|
|
WHEN dsp.exam_status = '1' AND dsp.finance_pass IS NULL THEN 1 -- 优先级最高
|
|
|
|
|
|
WHEN dsp.exam_status = '9' THEN 2
|
|
|
|
|
|
WHEN dsp.status = '1' THEN 2
|
|
|
|
|
|
ELSE 4
|
|
|
|
|
|
END),
|
|
|
|
|
|
dsp.update_time DESC; -- 再按创建时间降序
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2025-05-10 16:35:42 +08:00
|
|
|
|
<select id="getProcessList" resultType="cn.iocoder.yudao.module.course.entity.Process">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
*
|
|
|
|
|
|
FROM
|
|
|
|
|
|
drive_school_process
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
user_id = #{userId}
|
|
|
|
|
|
AND deleted = 0
|
|
|
|
|
|
<if test="courseId!= null and courseId!= '' ">
|
|
|
|
|
|
AND course_id = #{courseId}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getProcessAndBatch" resultType="cn.iocoder.yudao.module.course.vo.ProcessAndExamBatchVO">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
dseb.start_time AS startTime,
|
|
|
|
|
|
dseb.end_time AS endTime,
|
|
|
|
|
|
dseb.addr_id AS addrId,
|
|
|
|
|
|
dseb.addr AS addr,
|
|
|
|
|
|
dseb.trans_way AS transWay,
|
|
|
|
|
|
dseb.creator AS creator,
|
|
|
|
|
|
dseb.id AS batchId,
|
|
|
|
|
|
dseb.updater AS updater,
|
|
|
|
|
|
dsebi.id AS batchItemId
|
|
|
|
|
|
from drive_school_exam_batch dseb
|
|
|
|
|
|
left join drive_school_exam_batch_item dsebi ON dseb.id = dsebi.batch_id
|
|
|
|
|
|
WHERE dseb.course_id = #{courseId}
|
|
|
|
|
|
AND dseb.coach_id = #{coachId}
|
|
|
|
|
|
AND dseb.subject = #{subject}
|
|
|
|
|
|
AND dsebi.fraction = #{fraction}
|
|
|
|
|
|
AND dsebi.user_id = #{userId}
|
|
|
|
|
|
ORDER BY dseb.update_time DESC LIMIT 1
|
2025-02-17 17:31:46 +08:00
|
|
|
|
</select>
|
2025-01-15 18:09:45 +08:00
|
|
|
|
</mapper>
|