| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- <?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.xjrsoft.module.student.mapper.StudentReportRecordMapper">
- <select id="getClassStatistics" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto"
- resultType="com.xjrsoft.module.student.vo.StudentReportRecordStatisticsVo">
- SELECT t1.name AS class_name,t2.name AS teacher_name,
- (
- SELECT COUNT(*) FROM xjr_user a1
- INNER JOIN base_student_school_roll a2 ON a1.id = a2.user_id
- WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
- AND a2.class_id = t1.id AND a2.archives_status = 'FB2901'
- ) AS all_count,
- (
- SELECT COUNT(*) FROM xjr_user a1
- INNER JOIN base_student_school_roll a2 ON a1.id = a2.user_id
- WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
- AND a1.gender = 'SB10001' AND a2.class_id = t1.id
- AND a2.archives_status = 'FB2901'
- ) AS male_count,
- (
- SELECT COUNT(*) FROM xjr_user a1
- INNER JOIN base_student_school_roll a2 ON a1.id = a2.user_id
- WHERE a1.delete_mark = 0 AND a2.delete_mark = 0
- AND a1.gender = 'SB10002' AND a2.class_id = t1.id
- AND a2.archives_status = 'FB2901'
- ) AS female_count,
- (
- SELECT COUNT(distinct(a1.id)) FROM xjr_user a1
- INNER JOIN base_student_school_roll a2 ON a1.id = a2.user_id
- INNER JOIN student_report_record a3 ON a1.id = a3.user_id
- WHERE a1.delete_mark = 0 AND a2.delete_mark = 0 and a3.delete_mark = 0
- AND a2.class_id = t1.id AND a3.base_semester_id = #{dto.baseSemesterId} AND a3.report_time IS NOT NULL
- <if test="dto.studentReportPlanId != null">
- and a3.student_report_plan_id = #{dto.studentReportPlanId}
- </if>
- ) AS arrived_count
- FROM base_class t1
- INNER JOIN xjr_user t2 ON t1.teacher_id = t2.id
- WHERE t1.delete_mark = 0
- <if test="dto.teacherId != null">
- AND t1.teacher_id = #{dto.teacherId}
- </if>
- <if test="dto.gradeId != null">
- and t1.grade_id = #{dto.gradeId}
- </if>
- <if test="dto.classId != null">
- AND t1.id = #{dto.classId}
- </if>
- </select>
- <select id="getMobilePage" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto"
- resultType="com.xjrsoft.module.student.vo.StudentReportRecordPageVo">
- SELECT t1.id as user_id,t1.name,t1.credential_number,t1.mobile,t4.name AS stduy_status_cn,t5.telephone AS parent_mobile,t2.graduated_university,
- (select count(*) from student_report_record where user_id = t1.id and base_semester_id = #{dto.baseSemesterId} and delete_mark = 0) as is_report FROM xjr_user t1
- INNER JOIN base_student_school_roll t2 ON t1.id = t2.user_id
- INNER JOIN base_class t3 ON t2.class_id = t3.id
- LEFT JOIN xjr_dictionary_detail t4 ON t2.stduy_status = t4.code
- LEFT JOIN base_student_family t5 ON t5.user_id = t1.id
- WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
- AND t3.teacher_id = #{dto.teacherId} and t2.grade_id = #{dto.gradeId}
- <if test="dto.keyword != null and dto.keyword != ''">
- and t1.name like concat('%', #{dto.keyword},'%')
- </if>
- <if test="dto.classId != null">
- and t3.id = #{dto.classId}
- </if>
- ORDER BY t1.create_date DESC, t2.create_date DESC,t3.create_date DESC,t1.id
- </select>
- <select id="getPlanPage" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
- SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
- t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
- t9.name AS stduy_status_cn,t10.name AS archives_status_cn,
- t1.report_time,IF(t1.report_time IS NULL, 0, 1) as is_report,
- (SELECT telephone FROM base_student_family WHERE delete_mark = 0 AND user_id = t1.user_id ORDER BY create_date ASC LIMIT 0,1) as parent_mobile
- FROM student_report_record t1
- INNER JOIN base_student_school_roll t2 ON t1.user_id = t2.user_id
- INNER JOIN xjr_user t3 ON t3.id = t1.user_id
- LEFT JOIN base_grade t4 ON t2.grade_id = t4.id
- LEFT JOIN base_class t5 ON t2.class_id = t5.id
- LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
- LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
- LEFT JOIN xjr_dictionary_detail t8 ON t2.student_type = t8.code
- LEFT JOIN xjr_dictionary_detail t9 ON t2.stduy_status = t9.code
- LEFT JOIN xjr_dictionary_detail t10 ON t2.archives_status = t10.code
- WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
- and t1.student_report_plan_id = #{dto.studentReportPlanId}
- <if test="dto.keyword != null and dto.keyword != ''">
- and t1.name like concat('%', #{dto.keyword},'%')
- </if>
- <if test="dto.classId != null">
- and t5.id = #{dto.classId}
- </if>
- <if test="dto.gradeId != null">
- and t4.id = #{dto.gradeId}
- </if>
- <if test="dto.name != null and dto.name != ''">
- and t3.name like concat('%', #{dto.name}, '%')
- </if>
- <if test="dto.className != null and dto.className != ''">
- and t5.name like concat('%', #{dto.className}, '%')
- </if>
- <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
- and t3.credential_number like concat('%', #{dto.credentialNumber}, '%')
- </if>
- <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
- and t2.archives_status = #{dto.archivesStatus}
- </if>
- <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
- and t2.stduy_status = #{dto.stduyStatus}
- </if>
- <if test="dto.studentType != null and dto.studentType != ''">
- and t2.student_type = #{dto.studentType}
- </if>
- <if test="dto.isReport != null">
- <if test="dto.isReport == 1">
- and t1.report_time is not null
- </if>
- <if test="dto.isReport == 0">
- and t1.report_time is null
- </if>
- </if>
- <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
- and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
- </if>
- ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name
- </select>
- <select id="getPlanPageList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
- SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
- t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
- t9.name AS stduy_status_cn,t10.name AS archives_status_cn,
- t1.report_time,IF(t1.report_time IS NULL, 0, 1) as is_report,
- (SELECT telephone FROM base_student_family WHERE delete_mark = 0 AND user_id = t1.user_id ORDER BY create_date ASC LIMIT 0,1) as parent_mobile
- FROM student_report_record t1
- INNER JOIN base_student_school_roll t2 ON t1.user_id = t2.user_id
- INNER JOIN xjr_user t3 ON t3.id = t1.user_id
- LEFT JOIN base_grade t4 ON t2.grade_id = t4.id
- LEFT JOIN base_class t5 ON t2.class_id = t5.id
- LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
- LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code
- LEFT JOIN xjr_dictionary_detail t8 ON t2.student_type = t8.code
- LEFT JOIN xjr_dictionary_detail t9 ON t2.stduy_status = t9.code
- LEFT JOIN xjr_dictionary_detail t10 ON t2.archives_status = t10.code
- WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
- and t1.student_report_plan_id = #{dto.studentReportPlanId}
- <if test="dto.keyword != null and dto.keyword != ''">
- and t1.name like concat('%', #{dto.keyword},'%')
- </if>
- <if test="dto.classId != null">
- and t5.id = #{dto.classId}
- </if>
- <if test="dto.gradeId != null">
- and t4.id = #{dto.gradeId}
- </if>
- <if test="dto.name != null and dto.name != ''">
- and t3.name like concat('%', #{dto.name}, '%')
- </if>
- <if test="dto.className != null and dto.className != ''">
- and t5.name like concat('%', #{dto.className}, '%')
- </if>
- <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
- and t3.credential_number like concat('%', #{dto.credentialNumber}, '%')
- </if>
- <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
- and t2.archives_status = #{dto.archivesStatus}
- </if>
- <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
- and t2.stduy_status = #{dto.stduyStatus}
- </if>
- <if test="dto.studentType != null and dto.studentType != ''">
- and t2.student_type = #{dto.studentType}
- </if>
- <if test="dto.isReport != null">
- <if test="dto.isReport == 1">
- and t1.report_time is not null
- </if>
- <if test="dto.isReport == 0">
- and t1.report_time is null
- </if>
- </if>
- <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
- and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
- </if>
- ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name
- </select>
- <select id="getStatisticsDataList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto"
- resultType="com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo">
- SELECT t1.name,t1.credential_number,t2.gender,t4.graduated_university,t4.stduy_status,t5.report_time ,
- t6.name AS class_name,t8.name as class_type,t7.name AS major_name,t9.name as dept_name FROM base_new_student t1
- INNER JOIN xjr_user t2 ON t1.credential_number = t2.credential_number
- INNER JOIN enrollment_plan t3 ON t3.id = t1.enrollment_plan_id
- INNER JOIN base_student_school_roll t4 ON t4.user_id = t2.id
- LEFT JOIN student_report_record t5 ON t2.id = t5.user_id AND t5.delete_mark = 0
- INNER JOIN base_class t6 ON t6.id = t4.class_id
- INNER JOIN base_major_set t7 ON t7.id = t6.major_set_id
- left join xjr_dictionary_detail t8 on t6.class_type = t8.code and t8.item_id = 2023000000000000039
- INNER JOIN xjr_department t9 ON t9.id = t6.org_id
- WHERE t1.delete_mark = 0 AND t2.delete_mark = 0
- AND t3.grade_id = #{dto.gradeId} AND t3.enroll_type = #{dto.enrollType}
- AND (t1.delete_reason IS NULL OR t1.delete_reason = '')
- AND t2.delete_mark = 0
- </select>
- <select id="getStatisticsPlanDataList" parameterType="com.xjrsoft.module.student.dto.StudentReportRecordStatisticsDto"
- resultType="com.xjrsoft.module.student.vo.StudentReportRecordStatisticsListVo">
- SELECT t1.name,t1.credential_number,t1.gender,t4.graduated_university,t4.stduy_status,t5.report_time ,
- t6.name AS class_name,t8.name AS class_type,t7.name AS major_name,t9.name AS dept_name FROM xjr_user t1
- INNER JOIN base_student_school_roll t4 ON t4.user_id = t1.id
- INNER JOIN student_report_record t5 ON t1.id = t5.user_id AND t5.delete_mark = 0
- INNER JOIN base_class t6 ON t6.id = t4.class_id
- INNER JOIN base_major_set t7 ON t7.id = t6.major_set_id
- LEFT JOIN xjr_dictionary_detail t8 ON t6.class_type = t8.code AND t8.item_id = 2023000000000000039
- INNER JOIN xjr_department t9 ON t9.id = t6.org_id
- inner join student_report_plan t10 on t5.student_report_plan_id = t10.id
- WHERE t1.delete_mark = 0 and t10.delete_mark = 0
- <if test="dto.gradeId != null">
- and t4.grade_id = #{dto.gradeId}
- </if>
- AND t10.semester_id = #{dto.baseSemesterId}
- </select>
- <select id="getTryReadingPage" parameterType="com.xjrsoft.module.student.dto.StudentTryReadingReportPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
- SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
- t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
- t9.name AS stduy_status_cn,t3.gender,t13.name as major_name,t14.name as class_type,
- t1.report_time,IF(t1.report_time IS NULL, 0, 1) AS is_report,
- t3.family_mobile AS parent_mobile,t15.name as dept_name
- FROM student_report_record t1
- INNER JOIN base_new_student t3 ON t3.id = t1.user_id
- LEFT JOIN banding_task_class_student t2 ON t1.user_id = t2.new_student_id and t2.delete_mark = 0
- LEFT JOIN banding_task_class t5 ON t2.banding_task_class_id = t5.id
- LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
- LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code and t7.delete_mark = 0
- LEFT JOIN xjr_dictionary_detail t8 ON t3.source = t8.code and t8.delete_mark = 0
- LEFT JOIN xjr_dictionary_detail t9 ON t3.stduy_status = t9.code and t9.delete_mark = 0
- LEFT JOIN banding_task t10 ON t5.banding_task_id = t10.id
- LEFT JOIN enrollment_plan t11 ON t11.id = t3.enrollment_plan_id
- LEFT JOIN base_grade t4 ON t11.grade_id = t4.id
- LEFT JOIN student_report_plan t12 ON t12.id = t1.student_report_plan_id
- LEFT JOIN base_major_set t13 ON t13.id = t5.major_set_id
- LEFT JOIN xjr_dictionary_detail t14 ON t5.class_type = t14.code and t14.delete_mark = 0
- LEFT JOIN xjr_department t15 ON t15.id = t13.department_id
- WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
- and t12.status = 1
- and t3.enrollment_plan_id = #{dto.enrollmentPlanId}
- <if test="dto.keyword != null and dto.keyword != ''">
- and t1.name like concat('%', #{dto.keyword},'%')
- </if>
- <if test="dto.classId != null">
- <if test="dto.classId != 0">
- and t5.id = #{dto.classId}
- </if>
- <if test="dto.classId == 0">
- and t5.id is null
- </if>
- </if>
- <if test="dto.teacherId != null">
- and (t5.teacher_id = #{dto.teacherId} or t5.id is null)
- </if>
- <if test="dto.gradeId != null">
- and t4.id = #{dto.gradeId}
- </if>
- <if test="dto.name != null and dto.name != ''">
- and t3.name like concat('%', #{dto.name}, '%')
- </if>
- <if test="dto.className != null and dto.className != ''">
- and t5.name like concat('%', #{dto.className}, '%')
- </if>
- <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
- and t3.credential_number like concat('%', #{dto.credentialNumber}, '%')
- </if>
- <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
- and t3.archives_status = #{dto.archivesStatus}
- </if>
- <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
- and t3.stduy_status = #{dto.stduyStatus}
- </if>
- <if test="dto.studentType != null and dto.studentType != ''">
- and t3.source = #{dto.studentType}
- </if>
- <if test="dto.isReport != null">
- <if test="dto.isReport == 1">
- and t1.report_time is not null
- </if>
- <if test="dto.isReport == 0">
- and t1.report_time is null
- </if>
- </if>
- <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
- and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
- </if>
- ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name is null desc,t5.name
- </select>
- <select id="getTryReadingList" parameterType="com.xjrsoft.module.student.dto.StudentTryReadingReportPageDto" resultType="com.xjrsoft.module.student.vo.StudentReportRecordPlanPageVo">
- SELECT t1.id, t1.user_id, t4.name AS grade_name,t5.name AS class_name,t6.name AS teacher_name,
- t3.name,t7.name AS gender,t3.credential_number,t3.mobile,t8.name AS student_type_cn,
- t9.name AS stduy_status_cn,t3.gender,t13.name as major_name,t14.name as class_type,
- t1.report_time,IF(t1.report_time IS NULL, 0, 1) AS is_report,
- t3.family_mobile AS parent_mobile,t15.name as dept_name
- FROM student_report_record t1
- INNER JOIN base_new_student t3 ON t3.id = t1.user_id
- LEFT JOIN banding_task_class_student t2 ON t1.user_id = t2.new_student_id and t2.delete_mark = 0
- LEFT JOIN banding_task_class t5 ON t2.banding_task_class_id = t5.id
- LEFT JOIN xjr_user t6 ON t5.teacher_id = t6.id
- LEFT JOIN xjr_dictionary_detail t7 ON t3.gender = t7.code and t7.delete_mark = 0
- LEFT JOIN xjr_dictionary_detail t8 ON t3.source = t8.code and t8.delete_mark = 0
- LEFT JOIN xjr_dictionary_detail t9 ON t3.stduy_status = t9.code and t9.delete_mark = 0
- LEFT JOIN banding_task t10 ON t5.banding_task_id = t10.id
- LEFT JOIN enrollment_plan t11 ON t11.id = t3.enrollment_plan_id
- LEFT JOIN base_grade t4 ON t11.grade_id = t4.id
- LEFT JOIN student_report_plan t12 ON t12.id = t1.student_report_plan_id
- LEFT JOIN base_major_set t13 ON t13.id = t5.major_set_id
- LEFT JOIN xjr_dictionary_detail t14 ON t5.class_type = t14.code and t14.delete_mark = 0
- LEFT JOIN xjr_department t15 ON t15.id = t13.department_id
- WHERE t1.delete_mark = 0 AND t1.enabled_mark = 1
- and t12.status = 1
- and t3.enrollment_plan_id = #{dto.enrollmentPlanId}
- <if test="dto.keyword != null and dto.keyword != ''">
- and t1.name like concat('%', #{dto.keyword},'%')
- </if>
- <if test="dto.classId != null">
- <if test="dto.classId != 0">
- and t5.id = #{dto.classId}
- </if>
- <if test="dto.classId == 0">
- and t5.id is null
- </if>
- </if>
- <if test="dto.teacherId != null">
- and (t5.teacher_id = #{dto.teacherId} or t5.id is null)
- </if>
- <if test="dto.gradeId != null">
- and t4.id = #{dto.gradeId}
- </if>
- <if test="dto.name != null and dto.name != ''">
- and t3.name like concat('%', #{dto.name}, '%')
- </if>
- <if test="dto.className != null and dto.className != ''">
- and t5.name like concat('%', #{dto.className}, '%')
- </if>
- <if test="dto.credentialNumber != null and dto.credentialNumber != ''">
- and t3.credential_number like concat('%', #{dto.credentialNumber}, '%')
- </if>
- <if test="dto.archivesStatus != null and dto.archivesStatus != ''">
- and t3.archives_status = #{dto.archivesStatus}
- </if>
- <if test="dto.stduyStatus != null and dto.stduyStatus != ''">
- and t3.stduy_status = #{dto.stduyStatus}
- </if>
- <if test="dto.studentType != null and dto.studentType != ''">
- and t3.source = #{dto.studentType}
- </if>
- <if test="dto.isReport != null">
- <if test="dto.isReport == 1">
- and t1.report_time is not null
- </if>
- <if test="dto.isReport == 0">
- and t1.report_time is null
- </if>
- </if>
- <if test="dto.reportTimeStart != null and dto.reportTimeEnd != null">
- and t1.report_time between #{dto.reportTimeStart} and #{dto.reportTimeEnd}
- </if>
- ORDER BY t1.report_time IS NULL DESC, t1.report_time DESC,t5.name is null desc,t5.name
- </select>
- </mapper>
|