28 lines
2.3 KiB
XML
28 lines
2.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="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 >=now() - interval '1 day' ),
|
|
temp2 as ( select count(*) from univstudent where status = 1 and lastsignin >= now() - interval '1 week' and schoolid = #{schoolId}) ,
|
|
temp3 as (select count(*) from univstudent where status = 1 and lastsignin >= 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 <=now()) UNION all
|
|
( select count(*) ,now() - interval '1 day' as times from univstudent where status = 1 and schoolid =#{schoolId} and lastsignin >=now() - interval '2 day' and lastsignin < now() - interval '1 day') UNION all
|
|
|
|
( select count(*),now() - interval '2 day' as times from univstudent where status = 1 and schoolid = #{schoolId} and lastsignin >=now() - interval '3 day'and lastsignin < now() - interval '2 day') UNION all
|
|
( select count(*),now() - interval '3 day' as times from univstudent where status = 1 and schoolid = #{schoolId} and lastsignin >=now() - interval '4 day'and lastsignin < now() - interval '3 day') UNION all
|
|
( select count(*),now() - interval '4 day' as times from univstudent where status = 1 and schoolid = #{schoolId} and lastsignin >=now() - interval '5 day'and lastsignin <= 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> |