From a683718557e1e706ffcd12ecf326397714ac9475 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期四, 16 三月 2023 21:58:35 +0800
Subject: [PATCH] 驾驶舱接口

---
 ycl-platform/src/main/resources/mapper/equipment/OrgGridMapper.xml |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/ycl-platform/src/main/resources/mapper/equipment/OrgGridMapper.xml b/ycl-platform/src/main/resources/mapper/equipment/OrgGridMapper.xml
index 2b20916..871491d 100644
--- a/ycl-platform/src/main/resources/mapper/equipment/OrgGridMapper.xml
+++ b/ycl-platform/src/main/resources/mapper/equipment/OrgGridMapper.xml
@@ -15,5 +15,29 @@
     <sql id="Base_Column_List">
         id, worker, contact, area, region
     </sql>
+    <select id="statisticsGridMap" resultType="com.ycl.vo.cockpit.statisticsEvents.GridMapVO">
+        SELECT
+            *
+        FROM
+            (
+                SELECT
+                    og.id,
+                    og.`name`,
+                    COUNT( DISTINCT v.id ) eventCount ,
+                    sum(case WHEN v.video_point_id is not null then 1 else 0 END ) aiCount
+                FROM
+                    ums_org_grid og
+                        LEFT JOIN ums_base_case bc ON og.id = bc.grid_id
+                        LEFT JOIN ums_violations v ON v.id = bc.id
+
+                    <if test="beginTime!=null">
+                      and  bc.alarm_time BETWEEN #{beginTime} and #{endTime}
+                    </if>
+                GROUP BY
+                    og.id,
+                    og.`name`
+            ) v_case
+                LEFT JOIN ( SELECT grid_id, COUNT( id ) videoCount FROM ums_video_point GROUP BY grid_id ) AS v_video ON v_case.id = v_video.grid_id
+    </select>
 
 </mapper>

--
Gitblit v1.8.0