This commit is contained in:
xyc 2025-06-04 14:23:49 +08:00
parent bb1bfee430
commit a749fea2f3
2 changed files with 84 additions and 61 deletions

View File

@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Schema(description = "驾校人员-手机APP查询专用接口")
@Data
@ -55,4 +56,12 @@ public class DlDriveSchoolStaffVO {
private String endTime;
/**是否合格*/
private String examStatus;
/**查询时间范围*/
private List<String> rangeTime;
/**地址*/
private String address;
/**年龄*/
private List<String> age;
/**拿证天数*/
private Integer passDays;
}

View File

@ -49,68 +49,82 @@
ORDER BY
dss.create_time DESC
</select>
<select id="pageStaffStudent" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO">
SELECT
main.id AS id,
main.NAME AS NAME,
main.type AS type,
main.avatar AS avatar,
main.phone AS phone,
main.user_id AS userId,
dsco.course_type,
dsp.`subject`
FROM
drive_school_student main
LEFT JOIN drive_school_course_order dsco ON main.user_id = dsco.user_id
AND dsco.deleted = 0
AND dsco.payment_status IN ( '2', '3', '4', '5' )
AND dsco.if_end = 0
<select id="pageStaffStudent" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO">
SELECT
main.id AS id,
main.NAME AS NAME,
main.type AS type,
main.avatar AS avatar,
main.phone AS phone,
main.user_id AS userId,
dsco.course_type,
dsp.`subject`
FROM
drive_school_student main
LEFT JOIN drive_school_course_order dsco ON main.user_id = dsco.user_id
AND dsco.deleted = 0
AND dsco.payment_status IN ( '2', '3', '4', '5' )
AND dsco.if_end = 0
LEFT JOIN drive_school_process dsp ON main.user_id = dsp.user_id
AND dsco.course_id = dsp.course_id
AND dsp.`status` = '1'
WHERE
main.deleted = 0 AND dsco.is_sign = 1
<if test="entity.coachId != null and entity.coachId != ''">
AND dsp.coach_id = #{entity.coachId}
</if>
<if test="entity.sourceCoachId != null and entity.sourceCoachId != ''">
AND main.source_user_id = #{entity.sourceCoachId}
</if>
<if test="entity.name!=null and entity.name!=''">
AND main.name LIKE CONCAT('%',#{entity.name},'%')
</if>
<if test="entity.courseType != null and entity.courseType != ''">
AND dsco.course_type = #{entity.courseType}
</if>
<if test="entity.subject != null and entity.subject != ''">
AND dsp.subject = #{entity.subject}
</if>
<if test="entity.startTime!=null and entity.startTime!=''">
AND dsco.create_time &gt;= #{entity.startTime}
</if>
<if test="entity.endTime!=null and entity.endTime!=''">
AND dsco.create_time &lt;= #{entity.endTime}
</if>
<if test="entity.source!=null and entity.source!=''">
AND main.source = #{entity.source}
</if>
<if test="entity.examStatus!=null and entity.examStatus!=''">
AND dsp.exam_status = #{entity.examStatus}
</if>
GROUP BY
main.id
<choose>
<when test="entity.sort=='asc'">
ORDER BY
dsco.create_time ASC
</when>
<otherwise>
ORDER BY
dsco.create_time DESC
</otherwise>
</choose>
</select>
LEFT JOIN drive_school_process dsp ON main.user_id = dsp.user_id
AND dsco.course_id = dsp.course_id
AND dsp.`status` = '1'
WHERE
main.deleted = 0 AND dsco.is_sign = 1
<if test="entity.coachId != null and entity.coachId != ''">
AND dsp.coach_id = #{entity.coachId}
</if>
<if test="entity.sourceCoachId != null and entity.sourceCoachId != ''">
AND main.source_user_id = #{entity.sourceCoachId}
</if>
<if test="entity.name!=null and entity.name!=''">
AND main.name LIKE CONCAT('%',#{entity.name},'%')
</if>
<if test="entity.courseType != null and entity.courseType != ''">
AND dsco.course_type = #{entity.courseType}
</if>
<if test="entity.subject != null and entity.subject != ''">
AND dsp.subject = #{entity.subject}
</if>
<if test="entity.startTime!=null and entity.startTime!=''">
AND dsco.create_time &gt;= #{entity.startTime}
</if>
<if test="entity.endTime!=null and entity.endTime!=''">
AND dsco.create_time &lt;= #{entity.endTime}
</if>
<if test="entity.source!=null and entity.source!=''">
AND main.source = #{entity.source}
</if>
<if test="entity.examStatus!=null and entity.examStatus!=''">
AND dsp.exam_status = #{entity.examStatus}
</if>
<if test="entity.rangeTime!=null">
AND dsco.create_time BETWEEN #{entity.rangeTime[0]} AND #{entity.rangeTime[1]}
</if>
<if test="entity.address!=null and entity.address!=''">
AND main.address LIKE CONCAT('%',#{entity.address},'%')
</if>
<if test="entity.age!=null and entity.age!=''">
AND main.id_card IS NOT NULL
AND TIMESTAMPDIFF(YEAR, STR_TO_DATE(SUBSTRING(main.id_card, 7, 8), '%Y%m%d'), CURDATE()) BETWEEN #{entity.age[0]} AND #{entity.age[1]}
</if>
<if test="entity.passDays!=null and entity.passDays!=''">
AND dsco.pass_time IS NOT NULL
AND TIMESTAMPDIFF(DAY, dsco.create_time, dsco.pass_time) = #{entity.passDays}
</if>
GROUP BY
main.id
<choose>
<when test="entity.sort=='asc'">
ORDER BY
dsco.create_time ASC
</when>
<otherwise>
ORDER BY
dsco.create_time DESC
</otherwise>
</choose>
</select>
<select id="selectByCoachId" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStudentVO">
SELECT
temp.*