From 5e859a25ddf7d61753e5849b3c6ef36cb0cbf68c Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期五, 02 八月 2024 16:48:33 +0800
Subject: [PATCH] feat:首页统计图

---
 ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
index 687d7f7..38b6aad 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/TMonitorMapper.xml
@@ -243,4 +243,23 @@
         ]]>
     </select>
 
+    <select id="home" resultType="java.util.Map">
+        SELECT
+            u.unit_name AS name,
+            CONCAT(MONTH(w.create_time), '鏈�') AS months,
+            COUNT(w.id) AS num1,
+            COUNT(m.id) - COUNT(w.id) AS num2
+        FROM
+            t_monitor m
+                LEFT JOIN t_yw_point p ON m.serial_number = p.serial_number
+                LEFT JOIN t_yw_unit u ON p.unit_id = u.id
+                LEFT JOIN t_work_order w ON p.id = w.point_id
+        WHERE u.id = #{unitId} AND MONTH(w.create_time) IS NOT NULL
+          <if test="dateRange != null and dateRange.size > 0">
+            AND DATE_FORMAT(w.create_time, '%Y-%m') BETWEEN #{dateRange[0]} AND #{dateRange[1]}
+          </if>
+        GROUP BY months
+        ORDER BY months
+    </select>
+
 </mapper>

--
Gitblit v1.8.0