|
|
@@ -0,0 +1,504 @@
|
|
|
+<?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="org.dromara.xg.mapper.XgStudentStatisticsMapper">
|
|
|
+
|
|
|
+ <!-- 按学院维度统计图表数据 -->
|
|
|
+ <select id="getCollegeStatistics" resultType="org.dromara.xg.domain.vo.XgStudentStatisticsVo$StatisticsChartData">
|
|
|
+ SELECT
|
|
|
+ d.dept_name as name,
|
|
|
+ COALESCE(dorm_stats.dormDeductionCount, 0) as dormDeductionCount,
|
|
|
+ COALESCE(dorm_violation_stats.dormViolationCount, 0) as dormViolationCount,
|
|
|
+ COALESCE(dorm_violation_stats.dormViolationDeduction, 0) as dormViolationDeduction,
|
|
|
+ COALESCE(teaching_violation_stats.teachingViolationCount, 0) as teachingViolationCount,
|
|
|
+ COALESCE(teaching_violation_stats.teachingViolationDeduction, 0) as teachingViolationDeduction
|
|
|
+ FROM sys_dept d
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 宿舍卫生检查扣分统计
|
|
|
+ SELECT
|
|
|
+ c.college_id,
|
|
|
+ COUNT(h.id) as dormDeductionCount
|
|
|
+ FROM xg_dorm_hygiene_check h
|
|
|
+ INNER JOIN xg_class_msg c ON h.room_id IN (
|
|
|
+ SELECT DISTINCT bs.room_id
|
|
|
+ FROM xg_dorm_bed_student bs
|
|
|
+ INNER JOIN xg_student_msg s ON bs.student_id = s.id
|
|
|
+ WHERE s.class_id = c.id AND s.deleted = 0
|
|
|
+ )
|
|
|
+ WHERE h.deleted = 0
|
|
|
+ AND h.check_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ AND h.total_score > 0
|
|
|
+ GROUP BY c.college_id
|
|
|
+ ) dorm_stats ON d.dept_id = dorm_stats.college_id
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 宿舍区违纪记录统计
|
|
|
+ SELECT
|
|
|
+ dr.college_id,
|
|
|
+ COUNT(dr.id) as dormViolationCount,
|
|
|
+ COALESCE(SUM(dr.score_deduction), 0) as dormViolationDeduction
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ GROUP BY dr.college_id
|
|
|
+ ) dorm_violation_stats ON d.dept_id = dorm_violation_stats.college_id
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 教学区违纪记录统计
|
|
|
+ SELECT
|
|
|
+ dr.college_id,
|
|
|
+ COUNT(dr.id) as teachingViolationCount,
|
|
|
+ COALESCE(SUM(dr.score_deduction), 0) as teachingViolationDeduction
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ GROUP BY dr.college_id
|
|
|
+ ) teaching_violation_stats ON d.dept_id = teaching_violation_stats.college_id
|
|
|
+ WHERE d.parent_id = 101 AND d.del_flag = '0'
|
|
|
+ ORDER BY d.order_num ASC, d.dept_name ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 按学院维度统计明细数据 -->
|
|
|
+ <select id="getCollegeDetailStatistics" resultType="org.dromara.xg.domain.vo.XgStudentStatisticsVo$StatisticsDetailData">
|
|
|
+ SELECT
|
|
|
+ d.dept_id as id,
|
|
|
+ d.dept_name as name,
|
|
|
+ '' as parentName,
|
|
|
+ COALESCE(dorm_stats.dormDeductionCount, 0) as dormDeductionCount,
|
|
|
+ COALESCE(dorm_violation_stats.dormViolationCount, 0) as dormViolationCount,
|
|
|
+ COALESCE(dorm_violation_stats.dormViolationDeduction, 0) as dormViolationDeduction,
|
|
|
+ COALESCE(teaching_violation_stats.teachingViolationCount, 0) as teachingViolationCount,
|
|
|
+ COALESCE(teaching_violation_stats.teachingViolationDeduction, 0) as teachingViolationDeduction,
|
|
|
+ COALESCE(dorm_violation_stats.dormViolationDeduction, 0) + COALESCE(teaching_violation_stats.teachingViolationDeduction, 0) as totalDeduction
|
|
|
+ FROM sys_dept d
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 宿舍卫生检查扣分统计
|
|
|
+ SELECT
|
|
|
+ c.college_id,
|
|
|
+ COUNT(h.id) as dormDeductionCount
|
|
|
+ FROM xg_dorm_hygiene_check h
|
|
|
+ INNER JOIN xg_class_msg c ON h.room_id IN (
|
|
|
+ SELECT DISTINCT bs.room_id
|
|
|
+ FROM xg_dorm_bed_student bs
|
|
|
+ INNER JOIN xg_student_msg s ON bs.student_id = s.id
|
|
|
+ WHERE s.class_id = c.id AND s.deleted = 0
|
|
|
+ )
|
|
|
+ WHERE h.deleted = 0
|
|
|
+ AND h.check_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ AND h.total_score > 0
|
|
|
+ GROUP BY c.college_id
|
|
|
+ ) dorm_stats ON d.dept_id = dorm_stats.college_id
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 宿舍区违纪记录统计
|
|
|
+ SELECT
|
|
|
+ dr.college_id,
|
|
|
+ COUNT(dr.id) as dormViolationCount,
|
|
|
+ COALESCE(SUM(dr.score_deduction), 0) as dormViolationDeduction
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ GROUP BY dr.college_id
|
|
|
+ ) dorm_violation_stats ON d.dept_id = dorm_violation_stats.college_id
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 教学区违纪记录统计
|
|
|
+ SELECT
|
|
|
+ dr.college_id,
|
|
|
+ COUNT(dr.id) as teachingViolationCount,
|
|
|
+ COALESCE(SUM(dr.score_deduction), 0) as teachingViolationDeduction
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ GROUP BY dr.college_id
|
|
|
+ ) teaching_violation_stats ON d.dept_id = teaching_violation_stats.college_id
|
|
|
+ WHERE d.parent_id = 101 AND d.del_flag = '0'
|
|
|
+ ORDER BY d.order_num ASC, d.dept_name ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 按专业维度统计图表数据 -->
|
|
|
+ <select id="getMajorStatistics" resultType="org.dromara.xg.domain.vo.XgStudentStatisticsVo$StatisticsChartData">
|
|
|
+ SELECT
|
|
|
+ d.dept_name as name,
|
|
|
+ COALESCE(dorm_stats.dormDeductionCount, 0) as dormDeductionCount,
|
|
|
+ COALESCE(dorm_violation_stats.dormViolationCount, 0) as dormViolationCount,
|
|
|
+ COALESCE(dorm_violation_stats.dormViolationDeduction, 0) as dormViolationDeduction,
|
|
|
+ COALESCE(teaching_violation_stats.teachingViolationCount, 0) as teachingViolationCount,
|
|
|
+ COALESCE(teaching_violation_stats.teachingViolationDeduction, 0) as teachingViolationDeduction
|
|
|
+ FROM sys_dept d
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 宿舍卫生检查扣分统计
|
|
|
+ SELECT
|
|
|
+ c.major_id,
|
|
|
+ COUNT(h.id) as dormDeductionCount
|
|
|
+ FROM xg_dorm_hygiene_check h
|
|
|
+ INNER JOIN xg_class_msg c ON h.room_id IN (
|
|
|
+ SELECT DISTINCT bs.room_id
|
|
|
+ FROM xg_dorm_bed_student bs
|
|
|
+ INNER JOIN xg_student_msg s ON bs.student_id = s.id
|
|
|
+ WHERE s.class_id = c.id AND s.deleted = 0
|
|
|
+ )
|
|
|
+ WHERE h.deleted = 0
|
|
|
+ AND h.check_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ AND h.total_score > 0
|
|
|
+ AND c.college_id = #{bo.collegeId}
|
|
|
+ GROUP BY c.major_id
|
|
|
+ ) dorm_stats ON d.dept_id = dorm_stats.major_id
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 宿舍区违纪记录统计
|
|
|
+ SELECT
|
|
|
+ dr.major_id,
|
|
|
+ COUNT(dr.id) as dormViolationCount,
|
|
|
+ COALESCE(SUM(dr.score_deduction), 0) as dormViolationDeduction
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ GROUP BY dr.major_id
|
|
|
+ ) dorm_violation_stats ON d.dept_id = dorm_violation_stats.major_id
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 教学区违纪记录统计
|
|
|
+ SELECT
|
|
|
+ dr.major_id,
|
|
|
+ COUNT(dr.id) as teachingViolationCount,
|
|
|
+ COALESCE(SUM(dr.score_deduction), 0) as teachingViolationDeduction
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ GROUP BY dr.major_id
|
|
|
+ ) teaching_violation_stats ON d.dept_id = teaching_violation_stats.major_id
|
|
|
+ WHERE d.parent_id = #{bo.collegeId} AND d.dept_category LIKE 'zy-%' AND d.del_flag = '0'
|
|
|
+ ORDER BY d.order_num ASC, d.dept_name ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 按专业维度统计明细数据 -->
|
|
|
+ <select id="getMajorDetailStatistics" resultType="org.dromara.xg.domain.vo.XgStudentStatisticsVo$StatisticsDetailData">
|
|
|
+ SELECT
|
|
|
+ d.dept_id as id,
|
|
|
+ d.dept_name as name,
|
|
|
+ p.dept_name as parentName,
|
|
|
+ COALESCE(dorm_stats.dormDeductionCount, 0) as dormDeductionCount,
|
|
|
+ COALESCE(dorm_violation_stats.dormViolationCount, 0) as dormViolationCount,
|
|
|
+ COALESCE(dorm_violation_stats.dormViolationDeduction, 0) as dormViolationDeduction,
|
|
|
+ COALESCE(teaching_violation_stats.teachingViolationCount, 0) as teachingViolationCount,
|
|
|
+ COALESCE(teaching_violation_stats.teachingViolationDeduction, 0) as teachingViolationDeduction,
|
|
|
+ COALESCE(dorm_violation_stats.dormViolationDeduction, 0) + COALESCE(teaching_violation_stats.teachingViolationDeduction, 0) as totalDeduction
|
|
|
+ FROM sys_dept d
|
|
|
+ INNER JOIN sys_dept p ON d.parent_id = p.dept_id
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 宿舍卫生检查扣分统计
|
|
|
+ SELECT
|
|
|
+ c.major_id,
|
|
|
+ COUNT(h.id) as dormDeductionCount
|
|
|
+ FROM xg_dorm_hygiene_check h
|
|
|
+ INNER JOIN xg_class_msg c ON h.room_id IN (
|
|
|
+ SELECT DISTINCT bs.room_id
|
|
|
+ FROM xg_dorm_bed_student bs
|
|
|
+ INNER JOIN xg_student_msg s ON bs.student_id = s.id
|
|
|
+ WHERE s.class_id = c.id AND s.deleted = 0
|
|
|
+ )
|
|
|
+ WHERE h.deleted = 0
|
|
|
+ AND h.check_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ AND h.total_score > 0
|
|
|
+ AND c.college_id = #{bo.collegeId}
|
|
|
+ GROUP BY c.major_id
|
|
|
+ ) dorm_stats ON d.dept_id = dorm_stats.major_id
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 宿舍区违纪记录统计
|
|
|
+ SELECT
|
|
|
+ dr.major_id,
|
|
|
+ COUNT(dr.id) as dormViolationCount,
|
|
|
+ COALESCE(SUM(dr.score_deduction), 0) as dormViolationDeduction
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ GROUP BY dr.major_id
|
|
|
+ ) dorm_violation_stats ON d.dept_id = dorm_violation_stats.major_id
|
|
|
+ LEFT JOIN (
|
|
|
+ -- 教学区违纪记录统计
|
|
|
+ SELECT
|
|
|
+ dr.major_id,
|
|
|
+ COUNT(dr.id) as teachingViolationCount,
|
|
|
+ COALESCE(SUM(dr.score_deduction), 0) as teachingViolationDeduction
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ GROUP BY dr.major_id
|
|
|
+ ) teaching_violation_stats ON d.dept_id = teaching_violation_stats.major_id
|
|
|
+ WHERE d.parent_id = #{bo.collegeId} AND d.dept_category LIKE 'zy-%' AND d.del_flag = '0'
|
|
|
+ ORDER BY d.order_num ASC, d.dept_name ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 按班级维度统计图表数据 -->
|
|
|
+ <select id="getClassStatistics" resultType="org.dromara.xg.domain.vo.XgStudentStatisticsVo$StatisticsChartData">
|
|
|
+ SELECT
|
|
|
+ c.class_name as name,
|
|
|
+ (SELECT COUNT(h.id)
|
|
|
+ FROM xg_dorm_hygiene_check h
|
|
|
+ WHERE h.deleted = 0
|
|
|
+ AND h.check_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ AND h.total_score > 0
|
|
|
+ AND h.room_id IN (
|
|
|
+ SELECT DISTINCT bs.room_id
|
|
|
+ FROM xg_dorm_bed_student bs
|
|
|
+ INNER JOIN xg_student_msg s ON bs.student_id = s.id
|
|
|
+ WHERE s.class_id = c.id AND s.deleted = 0
|
|
|
+ )
|
|
|
+ ) as dormDeductionCount,
|
|
|
+ (SELECT COUNT(dr.id)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = c.id
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.major_id = #{bo.majorId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as dormViolationCount,
|
|
|
+ (SELECT COALESCE(SUM(dr.score_deduction), 0)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = c.id
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.major_id = #{bo.majorId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as dormViolationDeduction,
|
|
|
+ (SELECT COUNT(dr.id)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = c.id
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.major_id = #{bo.majorId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as teachingViolationCount,
|
|
|
+ (SELECT COALESCE(SUM(dr.score_deduction), 0)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = c.id
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.major_id = #{bo.majorId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as teachingViolationDeduction
|
|
|
+ FROM xg_class_msg c
|
|
|
+ WHERE c.college_id = #{bo.collegeId} AND c.major_id = #{bo.majorId} AND c.deleted = 0
|
|
|
+ ORDER BY c.class_name ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 按班级维度统计明细数据 -->
|
|
|
+ <select id="getClassDetailStatistics" resultType="org.dromara.xg.domain.vo.XgStudentStatisticsVo$StatisticsDetailData">
|
|
|
+ <choose>
|
|
|
+ <when test="bo.classId != null">
|
|
|
+ <!-- 班级详情统计 -->
|
|
|
+ SELECT
|
|
|
+ c.id as id,
|
|
|
+ c.class_name as name,
|
|
|
+ CONCAT(c.college_name, '-', c.major_name) as parentName,
|
|
|
+ (SELECT COUNT(h.id)
|
|
|
+ FROM xg_dorm_hygiene_check h
|
|
|
+ WHERE h.deleted = 0
|
|
|
+ AND h.check_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ AND h.total_score > 0
|
|
|
+ AND h.room_id IN (
|
|
|
+ SELECT DISTINCT bs.room_id
|
|
|
+ FROM xg_dorm_bed_student bs
|
|
|
+ INNER JOIN xg_student_msg s ON bs.student_id = s.id
|
|
|
+ WHERE s.class_id = c.id AND s.deleted = 0
|
|
|
+ )
|
|
|
+ ) as dormDeductionCount,
|
|
|
+ (SELECT COUNT(dr.id)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = #{bo.classId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as dormViolationCount,
|
|
|
+ (SELECT COALESCE(SUM(dr.score_deduction), 0)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = #{bo.classId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as dormViolationDeduction,
|
|
|
+ (SELECT COUNT(dr.id)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = #{bo.classId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as teachingViolationCount,
|
|
|
+ (SELECT COALESCE(SUM(dr.score_deduction), 0)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = #{bo.classId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as teachingViolationDeduction,
|
|
|
+ ((SELECT COALESCE(SUM(dr.score_deduction), 0)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = #{bo.classId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) +
|
|
|
+ (SELECT COALESCE(SUM(dr.score_deduction), 0)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = #{bo.classId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ )) as totalDeduction
|
|
|
+ FROM xg_class_msg c
|
|
|
+ WHERE c.id = #{bo.classId} AND c.deleted = 0
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ <!-- 班级列表统计 -->
|
|
|
+ SELECT
|
|
|
+ c.id as id,
|
|
|
+ c.class_name as name,
|
|
|
+ c.major_name as parentName,
|
|
|
+ (SELECT COUNT(h.id)
|
|
|
+ FROM xg_dorm_hygiene_check h
|
|
|
+ WHERE h.deleted = 0
|
|
|
+ AND h.check_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ AND h.total_score > 0
|
|
|
+ AND h.room_id IN (
|
|
|
+ SELECT DISTINCT bs.room_id
|
|
|
+ FROM xg_dorm_bed_student bs
|
|
|
+ INNER JOIN xg_student_msg s ON bs.student_id = s.id
|
|
|
+ WHERE s.class_id = c.id AND s.deleted = 0
|
|
|
+ )
|
|
|
+ ) as dormDeductionCount,
|
|
|
+ (SELECT COUNT(dr.id)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = c.id
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.major_id = #{bo.majorId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as dormViolationCount,
|
|
|
+ (SELECT COALESCE(SUM(dr.score_deduction), 0)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = c.id
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.major_id = #{bo.majorId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as dormViolationDeduction,
|
|
|
+ (SELECT COUNT(dr.id)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = c.id
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.major_id = #{bo.majorId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as teachingViolationCount,
|
|
|
+ (SELECT COALESCE(SUM(dr.score_deduction), 0)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = c.id
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.major_id = #{bo.majorId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) as teachingViolationDeduction,
|
|
|
+ ((SELECT COALESCE(SUM(dr.score_deduction), 0)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '1'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = c.id
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.major_id = #{bo.majorId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ ) +
|
|
|
+ (SELECT COALESCE(SUM(dr.score_deduction), 0)
|
|
|
+ FROM xskh_discipline_record dr
|
|
|
+ WHERE dr.deleted = 0
|
|
|
+ AND dr.violation_source = '2'
|
|
|
+ AND dr.status = '1'
|
|
|
+ AND dr.class_id = c.id
|
|
|
+ AND dr.college_id = #{bo.collegeId}
|
|
|
+ AND dr.major_id = #{bo.majorId}
|
|
|
+ AND dr.discipline_date BETWEEN #{bo.startTime} AND #{bo.endTime}
|
|
|
+ )) as totalDeduction
|
|
|
+ FROM xg_class_msg c
|
|
|
+ WHERE c.college_id = #{bo.collegeId} AND c.major_id = #{bo.majorId} AND c.deleted = 0
|
|
|
+ ORDER BY c.class_name ASC
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 获取二级学院列表 -->
|
|
|
+ <select id="getColleges" resultType="org.dromara.xg.domain.vo.XgCascadeOptionVo">
|
|
|
+ SELECT
|
|
|
+ dept_id as id,
|
|
|
+ dept_name as label,
|
|
|
+ CAST(dept_id AS CHAR) as value,
|
|
|
+ order_num as sort
|
|
|
+ FROM sys_dept
|
|
|
+ WHERE parent_id = 101 AND del_flag = '0'
|
|
|
+ ORDER BY order_num ASC, dept_name ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据学院ID获取专业列表 -->
|
|
|
+ <select id="getMajorsByCollegeId" resultType="org.dromara.xg.domain.vo.XgCascadeOptionVo">
|
|
|
+ SELECT
|
|
|
+ dept_id as id,
|
|
|
+ dept_name as label,
|
|
|
+ CAST(dept_id AS CHAR) as value,
|
|
|
+ order_num as sort
|
|
|
+ FROM sys_dept
|
|
|
+ WHERE parent_id = #{collegeId}
|
|
|
+ AND dept_category LIKE 'zy-%'
|
|
|
+ AND del_flag = '0'
|
|
|
+ ORDER BY order_num ASC, dept_name ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据专业ID获取班级列表 -->
|
|
|
+ <select id="getClassesByMajorId" resultType="org.dromara.xg.domain.vo.XgCascadeOptionVo">
|
|
|
+ SELECT
|
|
|
+ id,
|
|
|
+ class_name as label,
|
|
|
+ CAST(id AS CHAR) as value,
|
|
|
+ 0 as sort
|
|
|
+ FROM xg_class_msg
|
|
|
+ WHERE major_id = #{majorId} AND deleted = 0
|
|
|
+ ORDER BY class_name ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|