liujie
2026-09-21 20051550f01227ecebbe0bf064e188dd242f58f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?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.ruoyi.system.mapper.SysDashboardMapper">
 
    <select id="selectRegisterSummary" resultType="SysDashboardRegisterSummaryVO">
        select count(1) as registerCount,
               sum(case when plate_no is not null and plate_no != '' then 1 else 0 end) as vehicleCount
        from t_visitor_record
        where del_flag = '0'
          and register_type = #{registerType}
          and register_time is not null
          and register_time &gt;= #{beginTime}
          and register_time &lt; #{endTime}
    </select>
 
    <select id="selectStatusSummary" resultType="SysDashboardStatusSummaryVO">
        select sum(case when status = 'VISITING' then 1 else 0 end) as visitingCount,
               sum(case when status in ('SIGNED_OUT', 'OVERDUE_AUTO_SIGNED_OUT')
                             and sign_time is not null
                             and sign_time &gt;= #{param1}
                             and sign_time &lt; #{param2}
                        then 1 else 0 end) as signedOutCount,
               sum(case when status = 'PENDING_CONFIRM' then 1 else 0 end) as overdueCount
        from t_visitor_record
        where del_flag = '0'
    </select>
 
    <select id="selectTrendDaily" resultType="SysDashboardTrendDailyVO">
        select date_format(register_time, '%Y-%m-%d') as trendDate,
               date_format(register_time, '%m-%d') as label,
               sum(case when register_type = 'ONSITE' then 1 else 0 end) as onsiteCount,
               sum(case when register_type = 'APPOINTMENT' then 1 else 0 end) as appointmentCount,
               sum(case when plate_no is not null and plate_no != '' then 1 else 0 end) as vehicleCount
        from t_visitor_record
        where del_flag = '0'
          and register_time is not null
          and register_time &gt;= #{beginTime}
          and register_time &lt; #{endTime}
        group by date_format(register_time, '%Y-%m-%d'), date_format(register_time, '%m-%d')
        order by trendDate asc
    </select>
</mapper>