<?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.xhkjedu.sapi.mapper.region.RAppAnalyzeMapper">
    <!--登录次数-->
    <select id="getLoginNum" resultType="java.lang.Integer">
        select count(ul.ulid)
        from t_school s right join t_user_log ul on s.schoolid=ul.schoolid
        where s.schoollevel=#{level} and s.schoolstate=1
        and ul.logtime between #{begintime} and #{endtime}
    </select>
    <!--学校应用时长、次数统计-->
    <select id="listApp" resultType="com.xhkjedu.sapi.vo.region.RAppVo">
        select m.schoolid,s.schoolname,s.shortname,m.modulecode,count(m.amid)dknum,sum(m.costtime)costtime
        ,(select m2.modulename from t_moduledefault m2 where m2.mabbrevname=m.modulecode limit 1)modulename
        from t_school s right join t_app_monitor m on m.schoolid=s.schoolid
        where s.schoollevel=#{level} and s.schoolstate=1
        and m.createtime between #{begintime} and #{endtime}
        group by m.schoolid,m.modulecode
    </select>
</mapper>
