totus-nline/eladmin/eladmin-system/src/main/resources/mapper/system/DashboardMapper.xml
2025-05-19 15:30:40 +08:00

60 lines
4.8 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="me.zhengjie.modules.system.mapper.DashboardMapper">
<select id="getPieChatData" resultType="me.zhengjie.modules.system.domain.dto.DashboardDataVo">
select t.text, t.value from (
select case_type text, count(*) value from bus_law_enforcement GROUP BY case_type ORDER BY value desc
) t limit 10
</select>
<select id="getCardData" resultType="me.zhengjie.modules.system.domain.dto.DashboardDataVo">
select 'user' text, count(*) value from sys_user
UNION ALL
select 'dept' text, count(*) value from sys_dept
UNION ALL
select 'role' text, count(*) value from sys_role
UNION ALL
select 'law' text, count(*) value from bus_user
</select>
<select id="getLineChartData" resultType="me.zhengjie.modules.system.domain.dto.DashboardDataVo">
<if test="type == 'user'">
select '前一天' text, count(1) value from sys_user where DATE(create_time) = CURDATE() - INTERVAL 1 DAY UNION ALL
select '前两天' text, count(1) value from sys_user where DATE(create_time) = CURDATE() - INTERVAL 2 DAY UNION ALL
select '前三天' text, count(1) value from sys_user where DATE(create_time) = CURDATE() - INTERVAL 3 DAY UNION ALL
select '前四天' text, count(1) value from sys_user where DATE(create_time) = CURDATE() - INTERVAL 4 DAY UNION ALL
select '前五天' text, count(1) value from sys_user where DATE(create_time) = CURDATE() - INTERVAL 5 DAY UNION ALL
select '前六天' text, count(1) value from sys_user where DATE(create_time) = CURDATE() - INTERVAL 6 DAY UNION ALL
select '前七天' text, count(1) value from sys_user where DATE(create_time) = CURDATE() - INTERVAL 7 DAY
</if>
<if test="type == 'dept'">
select '前一天' text, count(1) value from sys_dict where DATE(create_time) = CURDATE() - INTERVAL 1 DAY UNION ALL
select '前两天' text, count(1) value from sys_dict where DATE(create_time) = CURDATE() - INTERVAL 2 DAY UNION ALL
select '前三天' text, count(1) value from sys_dict where DATE(create_time) = CURDATE() - INTERVAL 3 DAY UNION ALL
select '前四天' text, count(1) value from sys_dict where DATE(create_time) = CURDATE() - INTERVAL 4 DAY UNION ALL
select '前五天' text, count(1) value from sys_dict where DATE(create_time) = CURDATE() - INTERVAL 5 DAY UNION ALL
select '前六天' text, count(1) value from sys_dict where DATE(create_time) = CURDATE() - INTERVAL 6 DAY UNION ALL
select '前七天' text, count(1) value from sys_dict where DATE(create_time) = CURDATE() - INTERVAL 7 DAY
</if>
<if test="type == 'role'">
select '前一天' text, count(1) value from sys_role where DATE(create_time) = CURDATE() - INTERVAL 1 DAY UNION ALL
select '前两天' text, count(1) value from sys_role where DATE(create_time) = CURDATE() - INTERVAL 2 DAY UNION ALL
select '前三天' text, count(1) value from sys_role where DATE(create_time) = CURDATE() - INTERVAL 3 DAY UNION ALL
select '前四天' text, count(1) value from sys_role where DATE(create_time) = CURDATE() - INTERVAL 4 DAY UNION ALL
select '前五天' text, count(1) value from sys_role where DATE(create_time) = CURDATE() - INTERVAL 5 DAY UNION ALL
select '前六天' text, count(1) value from sys_role where DATE(create_time) = CURDATE() - INTERVAL 6 DAY UNION ALL
select '前七天' text, count(1) value from sys_role where DATE(create_time) = CURDATE() - INTERVAL 7 DAY
</if>
<if test="type == 'law'">
select '前一天' text, count(1) value from bus_law_enforcement where DATE(create_time) = CURDATE() - INTERVAL 1 DAY UNION ALL
select '前两天' text, count(1) value from bus_law_enforcement where DATE(create_time) = CURDATE() - INTERVAL 2 DAY UNION ALL
select '前三天' text, count(1) value from bus_law_enforcement where DATE(create_time) = CURDATE() - INTERVAL 3 DAY UNION ALL
select '前四天' text, count(1) value from bus_law_enforcement where DATE(create_time) = CURDATE() - INTERVAL 4 DAY UNION ALL
select '前五天' text, count(1) value from bus_law_enforcement where DATE(create_time) = CURDATE() - INTERVAL 5 DAY UNION ALL
select '前六天' text, count(1) value from bus_law_enforcement where DATE(create_time) = CURDATE() - INTERVAL 6 DAY UNION ALL
select '前七天' text, count(1) value from bus_law_enforcement where DATE(create_time) = CURDATE() - INTERVAL 7 DAY
</if>
</select>
</mapper>