From d5b43ef0da42eaf50a08ce17e5fd3351eeb26a5e Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Sat, 20 Mar 2021 14:10:19 +0800
Subject: [PATCH] 违禁品筛选条件去除,警情统计接口修改

---
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/healthcode/mapper/healthcodeMapper.xml |   76 ++++++++++++++++++++++++++++++++++----
 1 files changed, 68 insertions(+), 8 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 ea4369d..e9983f2 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
@@ -3,7 +3,7 @@
 <mapper namespace="org.springblade.jfpt.healthcode.mapper.healthcodeMapper">
 
     <!-- 通用查询映射结果 -->
-    <resultMap id="healthcodeResultMap" type="org.springblade.jfpt.healthcode.entity.healthcode">
+    <resultMap id="healthcodeResultMap" type="org.springblade.jfpt.healthcode.entity.Healthcode">
         <id column="id" property="id"/>
         <result column="type" property="type"/>
         <result column="sex" property="sex"/>
@@ -60,14 +60,25 @@
     <insert id="insert">
         insert into healthcode(<include refid="key"/>) values(<include refid="value"/>)
     </insert>
+
+<!--    <select id="selectCountr" resultType="java.util.HashMap">-->
+<!--         SELECT COUNT( * ) AS num,type-->
+<!--            FROM-->
+<!--         healthcode-->
+<!--            WHERE-->
+<!--         DATE_FORMAT(dtime,'%Y-%m-%d')=#{time} GROUP BY type-->
+<!--    </select>-->
+
+    <!--查询当天的健康码统计数据  2021-03-13 arsn修改-->
     <select id="selectCountr" resultType="java.util.HashMap">
-     SELECT
-	COUNT( * ) AS num,
-	type
-FROM
-	healthcode
-WHERE
-DATE_FORMAT(dtime,'%Y-%m-%d')=#{time} GROUP BY type
+        SELECT COUNT( * ) AS num,1 as type FROM healthcode WHERE
+             TO_DAYS(dtime)=TO_DAYS(NOW()) and type=1
+                     union all
+        SELECT COUNT( * ) AS num,2 as type FROM healthcode WHERE
+             TO_DAYS(dtime)=TO_DAYS(NOW()) and type=2
+               union all
+        SELECT COUNT( * ) AS num,3 as type FROM healthcode WHERE
+             TO_DAYS(dtime)=TO_DAYS(NOW()) and type=3
     </select>
 
     <select id="selectCountz" resultType="java.util.HashMap">
@@ -80,4 +91,53 @@
         DATE_FORMAT(dtime,'%Y-%m-%d')&gt;=#{beginTime} and DATE_FORMAT(dtime,'%Y-%m-%d')&lt;=#{endTime} GROUP BY type
     </select>
 
+
+    <!--统计7天内每天红色健康码人数数量数据-->
+    <select id="selectRedCodeDataStatis" resultType="java.lang.Integer">
+        select ifnull(b.count,0) as count from
+        (
+        SELECT DATE_FORMAT(date_sub(curdate(), interval 6 day),'%Y-%m-%d') as click_date
+            union all
+        SELECT DATE_FORMAT(date_sub(curdate(), interval 5 day),'%Y-%m-%d') as click_date
+            union all
+        SELECT DATE_FORMAT(date_sub(curdate(), interval 4 day),'%Y-%m-%d') as click_date
+            union all
+        SELECT DATE_FORMAT(date_sub(curdate(), interval 3 day),'%Y-%m-%d') as click_date
+            union all
+        SELECT DATE_FORMAT(date_sub(curdate(), interval 2 day),'%Y-%m-%d') as click_date
+            union all
+        SELECT DATE_FORMAT(date_sub(curdate(), interval 1 day),'%Y-%m-%d') as click_date
+            union all
+        SELECT DATE_FORMAT(curdate(),'%Y-%m-%d')  as click_date
+        ) 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.click_date = b.datetime
+    </select>
+
+
+    <!--自定义健康码分页/健康码统计图表点击事件-->
+    <select id="selectHealthcodeListPage" resultType="org.springblade.jfpt.healthcode.entity.Healthcode">
+        SELECT * FROM healthcode
+        where 1=1
+        <if test="healthcodeVO.status==0">
+            and to_days(dtime)=to_days(now())
+        </if>
+        <if test="healthcodeVO.status==1">
+            and YEARWEEK(date_format(dtime,'%Y-%m-%d'),1) = YEARWEEK(now(),1)
+        </if>
+        <if test="healthcodeVO.status==2">
+            and date_format(dtime,'%Y%m') = date_format(now(),'%Y%m')
+        </if>
+        <if test="healthcodeVO.type!=null">
+            and type=#{healthcodeVO.type}
+        </if>
+        ORDER BY dtime desc
+    </select>
+
 </mapper>

--
Gitblit v1.9.3