Files
education/backend/roomroot-jwgl/target/classes/com/roomroot/jwgl/mapper/OperationAnalysisMapper.xml
T
2026-08-21 14:39:03 +08:00

165 lines
5.3 KiB
XML

<?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.roomroot.jwgl.mapper.OperationAnalysisMapper">
<select id="selectCourseCompletionByDept" resultType="com.roomroot.jwgl.vo.courserunning.CourseCompletionByDeptVO">
SELECT
t.JXXBH as jxxbh,
t.JXXMC as jxxmc,
COUNT(c.BH) as completedCount,
SUM(c.KCS) as totalCount,
CASE WHEN SUM(c.KCS) > 0 THEN ROUND(COUNT(c.BH) * 100.0 / SUM(c.KCS), 2) ELSE 0 END as completionRate
FROM SSKC c
LEFT JOIN SSKCB b ON c.SSKCBBH = b.BH
LEFT JOIN JXX t ON b.JXXBH = t.BH
WHERE c.SCZTF = 0
<if test="nd != null and nd != ''">
AND c.ND = #{nd}
</if>
<if test="xqd != null and xqd != ''">
AND c.XQD = #{xqd}
</if>
GROUP BY t.JXXBH, t.JXXMC
ORDER BY completionRate DESC
</select>
<select id="selectVenueUsageRate" resultType="com.roomroot.jwgl.vo.courserunning.VenueUsageRateVO">
SELECT
c.CDLYBH as cdlybh,
c.CDLYMC as cdlymc,
COUNT(b.BH) as usageCount,
COUNT(DISTINCT b.CDBH) as totalCount,
CASE WHEN COUNT(DISTINCT b.CDBH) > 0 THEN ROUND(COUNT(b.BH) * 100.0 / COUNT(DISTINCT b.CDBH), 2) ELSE 0 END as usageRate
FROM SSKC c
LEFT JOIN SSKCB b ON c.SSKCBBH = b.BH
LEFT JOIN CDLY cdl ON b.CDLYBH = cdl.BH
WHERE c.SCZTF = 0
<if test="nd != null and nd != ''">
AND c.ND = #{nd}
</if>
<if test="xqd != null and xqd != ''">
AND c.XQD = #{xqd}
</if>
GROUP BY c.CDLYBH, c.CDLYMC
ORDER BY usageRate DESC
</select>
<select id="selectScheduleAdjustTrend" resultType="com.roomroot.jwgl.vo.courserunning.ScheduleAdjustTrendVO">
SELECT
TO_CHAR(a.CJSJ, 'IW') as period,
'第' || TO_CHAR(a.CJSJ, 'IW') || '周' as periodName,
COUNT(a.BH) as adjustCount
FROM SSDKSQ a
WHERE a.SCZTF = 0
<if test="nd != null and nd != ''">
AND a.ND = #{nd}
</if>
<if test="xqd != null and xqd != ''">
AND a.XQD = #{xqd}
</if>
GROUP BY TO_CHAR(a.CJSJ, 'IW')
ORDER BY period
</select>
<select id="selectOverallCourseCompletionRate" resultType="java.lang.Double">
SELECT
CASE WHEN SUM(c.KCS) > 0 THEN ROUND(COUNT(c.BH) * 100.0 / SUM(c.KCS), 2) ELSE 0 END
FROM SSKC c
WHERE c.SCZTF = 0
<if test="nd != null and nd != ''">
AND c.ND = #{nd}
</if>
<if test="xqd != null and xqd != ''">
AND c.XQD = #{xqd}
</if>
</select>
<select id="selectStudentAbsenceRate" resultType="java.lang.Double">
SELECT 0.0
</select>
<select id="selectVenueAvgUsageRate" resultType="java.lang.Double">
SELECT AVG(v.usageRate)
FROM (
SELECT
CASE WHEN COUNT(DISTINCT b.CDBH) > 0 THEN ROUND(COUNT(b.BH) * 100.0 / COUNT(DISTINCT b.CDBH), 2) ELSE 0 END as usageRate
FROM SSKC c
LEFT JOIN SSKCB b ON c.SSKCBBH = b.BH
WHERE c.SCZTF = 0
<if test="nd != null and nd != ''">
AND c.ND = #{nd}
</if>
<if test="xqd != null and xqd != ''">
AND c.XQD = #{xqd}
</if>
GROUP BY b.CDBH
) v
</select>
<select id="selectAvgWeeklyHoursPerTeacher" resultType="java.lang.Double">
SELECT 0.0
</select>
<select id="selectTotalScheduleAdjustCount" resultType="java.lang.Integer">
SELECT COUNT(BH)
FROM SSDKSQ
WHERE SCZTF = 0
<if test="nd != null and nd != ''">
AND ND = #{nd}
</if>
<if test="xqd != null and xqd != ''">
AND XQD = #{xqd}
</if>
</select>
<select id="selectTotalSupportPlanCount" resultType="java.lang.Integer">
SELECT COUNT(BH)
FROM KCBBZMX
WHERE SCZTF = 0
<if test="nd != null and nd != ''">
AND ND = #{nd}
</if>
<if test="xqd != null and xqd != ''">
AND XQD = #{xqd}
</if>
</select>
<select id="selectTotalLeaveCount" resultType="java.lang.Integer">
SELECT COUNT(BH)
FROM XYJXQJB
WHERE SCZTF = 0
<if test="nd != null and nd != ''">
AND ND = #{nd}
</if>
<if test="xqd != null and xqd != ''">
AND XQD = #{xqd}
</if>
</select>
<select id="selectPendingAdjustCount" resultType="java.lang.Integer">
SELECT COUNT(BH)
FROM SSDKSQ
WHERE SCZTF = 0
AND JYSPZZT = 0
<if test="nd != null and nd != ''">
AND ND = #{nd}
</if>
<if test="xqd != null and xqd != ''">
AND XQD = #{xqd}
</if>
</select>
<select id="selectPendingLeaveCount" resultType="java.lang.Integer">
SELECT COUNT(BH)
FROM XYJXQJB
WHERE SCZTF = 0
AND ZT = '0'
<if test="nd != null and nd != ''">
AND ND = #{nd}
</if>
<if test="xqd != null and xqd != ''">
AND XQD = #{xqd}
</if>
</select>
</mapper>