school-file-api/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/StatisticMapper.xml

48 lines
1.7 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="org.dromara.system.mapper.StatisticMapper">
<select id="selectGradeNum" resultType="int">
select count(*)
from sys_dept
where tenant_id = #{tenantId}
and parent_id = 100
</select>
<select id="selectCalssNum" resultType="int">
select count(*)
from sys_dept d
left join sys_dept p on d.parent_id = p.dept_id
where d.tenant_id = #{tenantId}
and p.parent_id = 100
</select>
<select id="selectTeacherNum" resultType="int">
select count(*)
from sys_teacher
where tenant_id = #{tenantId}
</select>
<select id="selectOssNum" resultType="int">
select t.tNum + r.rNum
from (select count(*) as tNum from sys_oss_textbook where tenant_id = #{tenantId}) as t,
(select count(*) as rNum from sys_oss_resource where tenant_id = #{tenantId}) as r
</select>
<select id="selectOssUse" resultType="org.dromara.system.domain.vo.StatisticNumVo">
select *
from (select download_num as value,
CONCAT(file_path, '/', file_name) as name
from sys_oss_resource
where tenant_id = #{tenantId}
union all
select download_num as value,
CONCAT(file_path, '/', file_name) as name
from sys_oss_textbook
where tenant_id = #{tenantId}) t
order by t.value desc
limit 10
</select>
</mapper>