From 2c2b1ab406d3049a0e69fff01e3daade5cbe90ea Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 08 Apr 2021 19:59:26 +0800
Subject: [PATCH] 预警数量统计接口修改,新增按时间条件查询条件,违禁品统计接口修改

---
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml
index d7a271d..fa65340 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml
@@ -161,4 +161,31 @@
             and dtime between #{conditionVo.startTime} and #{conditionVo.endTime}
         </if>
     </select>
+
+    <!--查询当前时间段区间时间红色健康码个数-->
+    <select id="selRedCodeTimeData" resultType="org.springblade.jfpt.healthcode.entity.Healthcode">
+        SELECT type,dtime FROM healthcode
+            where type =3
+        and dtime between #{conditionVo.startTime} and #{conditionVo.endTime}
+    </select>
+
+    <!--统计时间段内红色健康码人数数量数据-->
+    <select id="selectHealthcodeTimeData" resultType="java.lang.Integer">
+        select ifnull(count,0) count from
+        (
+            SELECT @date := DATE_ADD( @date, INTERVAL + 1 DAY ) days FROM
+            (
+                SELECT @date := DATE_ADD( #{conditionVo.startTime}, INTERVAL - 1 DAY ) FROM sys_date
+            ) time
+            WHERE to_days( @date ) &lt; to_days( #{conditionVo.endTime} )
+        ) a
+        left join
+        (
+            select DATE_FORMAT(dtime,'%Y-%m-%d') as datetime, count(*) as count from healthcode
+            where type=3
+            group by DATE_FORMAT(dtime,'%Y-%m-%d')
+        ) b
+        on
+        a.days = b.datetime
+    </select>
 </mapper>

--
Gitblit v1.9.3