spokenServer/out/production/pcserver/sqlmap/UnivSchoolAccount.xml

28 lines
2.3 KiB
XML
Raw Normal View History

2026-03-10 14:30:24 +08:00
<?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="AccountCount">
<select id="getTotalUnivStudents" parameterType="java.util.Map" resultType="java.util.Map">
with temp as( select count(*) from univstudent where status = 1 and schoolid = #{schoolId}) ,
temp1 as (select count(*) from univstudent where status = 1 and schoolid = #{schoolId} and lastsignin &gt;=now() - interval '1 day' ),
temp2 as ( select count(*) from univstudent where status = 1 and lastsignin &gt;= now() - interval '1 week' and schoolid = #{schoolId}) ,
temp3 as (select count(*) from univstudent where status = 1 and lastsignin &gt;= now() - interval '1 month'and schoolid = #{schoolId})
select temp.count as total,temp1.count as dayTotal,temp2.count as weekTotal,temp3.count as monthTotal from temp1 ,temp2,temp3,temp
</select>
<select id="getDayUnivstudentDetail" parameterType="java.util.List" resultType="java.util.HashMap">
( select count(*),now() as times from univstudent where status = 1 and schoolid = #{schoolId} and lastsignin >now() - interval '1 day'and
lastsignin &lt;=now()) UNION all
( select count(*) ,now() - interval '1 day' as times from univstudent where status = 1 and schoolid =#{schoolId} and lastsignin &gt;=now() - interval '2 day' and lastsignin &lt; now() - interval '1 day') UNION all
( select count(*),now() - interval '2 day' as times from univstudent where status = 1 and schoolid = #{schoolId} and lastsignin &gt;=now() - interval '3 day'and lastsignin &lt; now() - interval '2 day') UNION all
( select count(*),now() - interval '3 day' as times from univstudent where status = 1 and schoolid = #{schoolId} and lastsignin &gt;=now() - interval '4 day'and lastsignin &lt; now() - interval '3 day') UNION all
( select count(*),now() - interval '4 day' as times from univstudent where status = 1 and schoolid = #{schoolId} and lastsignin &gt;=now() - interval '5 day'and lastsignin &lt;= now() - interval '4 day')
</select>
<select id="getAllUnivStudentAccountData" parameterType="java.util.Map" resultType="java.util.HashMap">
select * from univtermstat where schoolid = #{schoolId} and term =#{term} ;
</select>
</mapper>