1.辅导员导出去向填写记录

2.学院查看 导出去向填写记录 导出返校情况 查看 导出预计离校情况 查看 导出学生到家情况
This commit is contained in:
zhy
2025-09-30 09:52:23 +08:00
parent 79ba38fc3f
commit fb522488a8
7 changed files with 602 additions and 164 deletions

View File

@@ -167,7 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="listView" parameterType="SurItinerary" resultType="SurItinerary">
select d.survey_name, a.*,b.class_name,b.teacher_name,c.employee_id,f.campus_name,f.park_name,f.building_name,f.room_no
select d.survey_name, a.*,b.class_name,b.teacher_name,c.employee_id,f.campus_name,f.park_name,f.building_name,f.room_no,b.dept_name
from sur_itinerary as a
left join view_stu_info as b on a.stu_no = b.stu_no
left join cph_teacher as c on b.teacher_id = c.teacher_id
@@ -205,57 +205,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by a.return_school_id desc
</select>
<select id="listReturnRes" parameterType="Long" resultType="ReturnRes">
<select id="listXwReturnRes" parameterType="SurItinerary" resultType="XwReturnRes">
select res1.*,( res1.yingfanxiao - res1.yifanxiao ) as weifanxiao,
(
select count(1) from sur_itinerary as a
left join view_stu_info as b on a.stu_no = b.stu_no
where a.absent_school_type = "路上" and a.survey_id = #{surveyId} and b.dept_name = res1.dept_name and b.grade_name = res1.grade_name
where a.absent_school_type = "路上" and a.survey_id = #{surveyId} and b.class_id = res1.class_id
) as lushang,
(
select count(1) from sur_itinerary as a
left join view_stu_info as b on a.stu_no = b.stu_no
where a.absent_school_type = "病假" and a.survey_id = #{surveyId} and b.dept_name = res1.dept_name and b.grade_name = res1.grade_name
where a.absent_school_type = "病假" and a.survey_id = #{surveyId} and b.class_id = res1.class_id
) as bingjia,
(
select count(1) from sur_itinerary as a
left join view_stu_info as b on a.stu_no = b.stu_no
where a.absent_school_type = "无票" and a.survey_id = #{surveyId} and b.dept_name = res1.dept_name and b.grade_name = res1.grade_name
where a.absent_school_type = "无票" and a.survey_id = #{surveyId} and b.class_id = res1.class_id
) as wupiao,
(
select count(1) from sur_itinerary as a
left join view_stu_info as b on a.stu_no = b.stu_no
where a.absent_school_type = "无课请事假延长" and a.survey_id = #{surveyId} and b.dept_name = res1.dept_name and b.grade_name = res1.grade_name
where a.absent_school_type = "无课请事假延长" and a.survey_id = #{surveyId} and b.class_id = res1.class_id
) as wuke,
(
select count(1) from sur_itinerary as a
left join view_stu_info as b on a.stu_no = b.stu_no
where a.absent_school_type = "事假" and a.survey_id = #{surveyId} and b.dept_name = res1.dept_name and b.grade_name = res1.grade_name
where a.absent_school_type = "事假" and a.survey_id = #{surveyId} and b.dept_name = b.class_id = res1.class_id
) as shijia,
(
select count(1) from sur_itinerary as a
left join view_stu_info as b on a.stu_no = b.stu_no
where a.absent_school_type = "红白事" and a.survey_id = #{surveyId} and b.dept_name = res1.dept_name and b.grade_name = res1.grade_name
where a.absent_school_type = "红白事" and a.survey_id = #{surveyId} and b.class_id = res1.class_id
) as hongbaishi,
(
select count(1) from sur_itinerary as a
left join view_stu_info as b on a.stu_no = b.stu_no
where a.absent_school_type = "考试" and a.survey_id = #{surveyId} and b.dept_name = res1.dept_name and b.grade_name = res1.grade_name
where a.absent_school_type = "考试" and a.survey_id = #{surveyId} and b.class_id = res1.class_id
) as kaoshi,
(
select count(1) from sur_itinerary as a
left join view_stu_info as b on a.stu_no = b.stu_no
where a.absent_school_type = "参赛" and a.survey_id = #{surveyId} and b.dept_name = res1.dept_name and b.grade_name = res1.grade_name
where a.absent_school_type = "参赛" and a.survey_id = #{surveyId} and b.class_id = res1.class_id
) as cansai,
(
select count(1) from sur_itinerary as a
left join view_stu_info as b on a.stu_no = b.stu_no
where a.absent_school_type = "兵检或役前训练" and a.survey_id = #{surveyId} and b.dept_name = res1.dept_name and b.grade_name = res1.grade_name
where a.absent_school_type = "兵检或役前训练" and a.survey_id = #{surveyId} and b.class_id = res1.class_id
) as bingjian,
(
select count(1) from sur_itinerary as a
left join view_stu_info as b on a.stu_no = b.stu_no
where a.absent_school_type = "退学或休学" and a.survey_id = #{surveyId} and b.dept_name = res1.dept_name and b.grade_name = res1.grade_name
where a.absent_school_type = "退学或休学" and a.survey_id = #{surveyId} and b.class_id = res1.class_id
) as tuixue
from
@@ -263,24 +263,109 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select r1.*,
(select count(1) from sur_itinerary as tt1
left join view_stu_info as tt2 on tt1.stu_no = tt2.stu_no
where tt1.`status` = "2" and tt1.reach_school_status = "是" and tt1.survey_id = #{surveyId} and tt2.dept_name = r1.dept_name and tt2.grade_name = r1.grade_name
) as yifanxiao
where tt1.`status` = "2" and tt1.reach_school_status = "是" and tt1.survey_id = #{surveyId} and tt2.class_id = r1.class_id) as yifanxiao
from
(
select a.dept_name,a.grade_name,count(1) as stu_num,
(select count(1) from view_stu_info as tt1 where tt1.`status` = "05" and tt1.dept_name = a.dept_name and tt1.grade_name = a.grade_name ) as shixi,
select a.class_id,a.class_name,count(1) as stu_num,
(select count(1) from view_stu_info as tt1 where tt1.`status` = "05" and tt1.class_id = a.class_id ) as shixi,
(select count(1) from srs_dormitory_student as tt1
left join view_stu_info as tt2 on tt1.stu_no = tt2.stu_no
where tt2.`status` = "01" and tt2.dept_name = a.dept_name and tt2.grade_name = a.grade_name ) as yingfanxiao
where tt2.`status` = "01" and tt2.class_id = a.class_id ) as yingfanxiao
from view_stu_info as a
left join srs_grade as b on a.grade_id = b.grade_id
where b.grade_status in (1,3) and a.dept_name is not null and a.`status` = "01"
GROUP BY a.dept_name,a.grade_name
order by a.dept_name,a.grade_name
where b.grade_status in (1,3) and a.dept_id = #{deptId} and a.`status` = "01"
GROUP BY a.class_id,a.class_name
order by a.class_name
) as r1
) as res1
</select>
<select id="listReturnRes" parameterType="Long" resultType="ReturnRes">
SELECT
res1.dept_name,
res1.grade_name,
res1.stu_num,
res1.shixi,
res1.yingfanxiao,
res1.yifanxiao,
(res1.yingfanxiao - res1.yifanxiao) AS weifanxiao,
COALESCE(agg.lushang, 0) AS lushang,
COALESCE(agg.bingjia, 0) AS bingjia,
COALESCE(agg.wupiao, 0) AS wupiao,
COALESCE(agg.wuke, 0) AS wuke,
COALESCE(agg.shijia, 0) AS shijia,
COALESCE(agg.hongbaishi, 0) AS hongbaishi,
COALESCE(agg.kaoshi, 0) AS kaoshi,
COALESCE(agg.cansai, 0) AS cansai,
COALESCE(agg.bingjian, 0) AS bingjian,
COALESCE(agg.tuixue, 0) AS tuixue
FROM (
SELECT
r1.dept_name,
r1.grade_name,
r1.stu_num,
r1.shixi,
r1.yingfanxiao,
COALESCE((SELECT COUNT(1)
FROM sur_itinerary AS tt1
LEFT JOIN view_stu_info AS tt2 ON tt1.stu_no = tt2.stu_no
WHERE tt1.`status` = "2"
AND tt1.reach_school_status = "是"
AND tt1.survey_id = #{surveyId}
AND tt2.dept_name = r1.dept_name
AND tt2.grade_name = r1.grade_name
), 0) AS yifanxiao
FROM (
SELECT
a.dept_name,
a.grade_name,
COUNT(1) AS stu_num,
COALESCE((SELECT COUNT(1)
FROM view_stu_info AS tt1
WHERE tt1.`status` = "05"
AND tt1.dept_name = a.dept_name
AND tt1.grade_name = a.grade_name
), 0) AS shixi,
COALESCE((SELECT COUNT(1)
FROM srs_dormitory_student AS tt1
LEFT JOIN view_stu_info AS tt2 ON tt1.stu_no = tt2.stu_no
WHERE tt2.`status` = "01"
AND tt2.dept_name = a.dept_name
AND tt2.grade_name = a.grade_name
), 0) AS yingfanxiao
FROM view_stu_info AS a
LEFT JOIN srs_grade AS b ON a.grade_id = b.grade_id
WHERE b.grade_status IN (1, 3)
AND a.dept_name IS NOT NULL
AND a.`status` = "01"
GROUP BY a.dept_name, a.grade_name
ORDER BY a.dept_name, a.grade_name
) AS r1
) AS res1
LEFT JOIN (
SELECT
b.dept_name,
b.grade_name,
COUNT(CASE WHEN a.absent_school_type = "路上" THEN 1 END) AS lushang,
COUNT(CASE WHEN a.absent_school_type = "病假" THEN 1 END) AS bingjia,
COUNT(CASE WHEN a.absent_school_type = "无票" THEN 1 END) AS wupiao,
COUNT(CASE WHEN a.absent_school_type = "无课请事假延长" THEN 1 END) AS wuke,
COUNT(CASE WHEN a.absent_school_type = "事假" THEN 1 END) AS shijia,
COUNT(CASE WHEN a.absent_school_type = "红白事" THEN 1 END) AS hongbaishi,
COUNT(CASE WHEN a.absent_school_type = "考试" THEN 1 END) AS kaoshi,
COUNT(CASE WHEN a.absent_school_type = "参赛" THEN 1 END) AS cansai,
COUNT(CASE WHEN a.absent_school_type = "兵检或役前训练" THEN 1 END) AS bingjian,
COUNT(CASE WHEN a.absent_school_type = "退学或休学" THEN 1 END) AS tuixue
FROM sur_itinerary AS a
LEFT JOIN view_stu_info AS b ON a.stu_no = b.stu_no
WHERE a.survey_id = #{surveyId}
GROUP BY b.dept_name, b.grade_name
) AS agg ON res1.dept_name = agg.dept_name
AND res1.grade_name = agg.grade_name
ORDER BY res1.dept_name, res1.grade_name;
</select>
<select id="listLeaveRes" parameterType="Long" resultType="LeaveRes">
select a.dept_name,count(1) as stu_num,
(select count(1)
@@ -304,6 +389,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
group by a.dept_name
</select>
<select id="listXwSubmitRes" resultType="map">
WITH base_class AS (
SELECT
f1.class_id
FROM view_stu_info AS f1
LEFT JOIN srs_grade AS f2 ON f1.grade_id = f2.grade_id
WHERE f1.status IN ('01','05','06') AND f2.grade_status IN (1,3) and f1.dept_id = #{deptId}
GROUP BY f1.class_id
),
stu_stat AS (
SELECT
a.class_id,
COUNT(*) AS stu_num
FROM view_stu_info a
LEFT JOIN srs_grade b ON a.grade_id = b.grade_id
WHERE b.grade_status IN (1,3) AND a.status IN ('01','05','06') and a.dept_id = #{deptId}
GROUP BY a.class_id
),
itinerary_stat AS (
SELECT
b.class_id,
COUNT(*) AS submit_num,
SUM(a.is_home = '是') AS home_num,
SUM(a.is_leave = 0) AS stay_num
FROM sur_itinerary a
left join view_stu_info as b on a.stu_no = b.stu_no
WHERE a.survey_id = #{surveyId} and b.dept_id = #{deptId}
GROUP BY b.class_id
)
SELECT
c.class_name,c.class_id,
COALESCE(its.submit_num, 0) AS submit_num,
COALESCE(its.home_num, 0) AS home_num,
COALESCE(its.stay_num, 0) AS stay_num,
COALESCE(ss.stu_num, 0) AS stu_num
FROM base_class bd
LEFT JOIN itinerary_stat its ON bd.class_id = its.class_id
LEFT JOIN stu_stat ss ON bd.class_id = ss.class_id
left join srs_class as c on bd.class_id = c.class_id;
</select>
<select id="listSubmitRes" parameterType="Long" resultType="map">
WITH base_dept AS (
SELECT
@@ -356,6 +482,70 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY more_dept_name
</select>
<select id="listXwReturnRes1" resultType="map">
WITH base_class AS (
SELECT
f1.class_id
FROM view_stu_info AS f1
LEFT JOIN srs_grade AS f2 ON f1.grade_id = f2.grade_id
WHERE f1.status IN ('01','05','06') AND f2.grade_status IN (1,3) and f1.dept_id = #{deptId}
GROUP BY f1.class_id
),
stu_stat AS (
SELECT
a.class_id,
COUNT(*) AS stu_num,
SUM(a.status = '05') AS shixi,
SUM(a.status in ('01','06')) AS yingfanxiao
FROM view_stu_info a
LEFT JOIN srs_grade b ON a.grade_id = b.grade_id
WHERE b.grade_status IN (1,3) AND a.status IN ('01','05','06') and a.dept_id = #{deptId}
GROUP BY a.class_id
),
itinerary_stat AS (
SELECT
b.class_id,
COUNT(*) AS submit_num,
SUM(a.status = '2' AND a.reach_school_status = '是') AS yifanxiao,
SUM(a.absent_school_type = '路上') AS lushang,
SUM(a.absent_school_type = '病假') AS bingjia,
SUM(a.absent_school_type = '无票') AS wupiao,
SUM(a.absent_school_type = '无课请事假延长') AS wuke,
SUM(a.absent_school_type = '事假') AS shijia,
SUM(a.absent_school_type = '红白事') AS hongbaishi,
SUM(a.absent_school_type = '考试') AS kaoshi,
SUM(a.absent_school_type = '参赛') AS cansai,
SUM(a.absent_school_type = '兵检或役前训练') AS bingjian,
SUM(a.absent_school_type = '退学或休学') AS tuixue
FROM sur_itinerary a
left join view_stu_info as b on a.stu_no = b.stu_no
WHERE a.survey_id = #{surveyId} and b.dept_id = #{deptId}
GROUP BY b.class_id
)
SELECT
bd.class_id,c.class_name,
COALESCE(its.submit_num, 0) AS submit_num,
COALESCE(ss.stu_num, 0) AS stu_num,
COALESCE(ss.shixi, 0) AS shixi,
COALESCE(ss.yingfanxiao, 0) AS yingfanxiao,
COALESCE(its.yifanxiao, 0) AS yifanxiao,
COALESCE(ss.yingfanxiao - its.yifanxiao, 0) AS weifanxiao,
COALESCE(its.lushang, 0) AS lushang,
COALESCE(its.bingjia, 0) AS bingjia,
COALESCE(its.wupiao, 0) AS wupiao,
COALESCE(its.wuke, 0) AS wuke,
COALESCE(its.shijia, 0) AS shijia,
COALESCE(its.hongbaishi, 0) AS hongbaishi,
COALESCE(its.kaoshi, 0) AS kaoshi,
COALESCE(its.cansai, 0) AS cansai,
COALESCE(its.bingjian, 0) AS bingjian,
COALESCE(its.tuixue, 0) AS tuixue
FROM base_class bd
LEFT JOIN stu_stat ss ON bd.class_id = ss.class_id
LEFT JOIN itinerary_stat its ON bd.class_id = its.class_id
left join srs_class as c on bd.class_id = c.class_id
</select>
<select id="listReturnRes1" parameterType="Long" resultType="map">
WITH base_dept AS (
@@ -429,4 +619,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
CALL test_survey_class_leave_statistics(#{surveyId}, #{fdyNo});
</select>
<select id="countXwWillLeave" statementType="CALLABLE" resultType="map">
CALL test_survey_xw_leave_statistics(#{surveyId}, #{deptId});
</select>
</mapper>