From 6992aaf0587c09f7c511c1afd12e1519d91363d3 Mon Sep 17 00:00:00 2001
From: cjl <276999030@qq.com>
Date: Thu, 14 Dec 2023 15:38:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/cjl' into qa

---
 screen-api/src/main/resources/mapper/HistorySecondCruiserMapper.xml |   43 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/screen-api/src/main/resources/mapper/HistorySecondCruiserMapper.xml b/screen-api/src/main/resources/mapper/HistorySecondCruiserMapper.xml
index 2d3d74c..d44f659 100644
--- a/screen-api/src/main/resources/mapper/HistorySecondCruiserMapper.xml
+++ b/screen-api/src/main/resources/mapper/HistorySecondCruiserMapper.xml
@@ -31,6 +31,24 @@
         AND organization_id = #{orgId}
     </select>
 
+    <select id="getCruiserDataNewAvg" resultType="com.moral.api.pojo.dto.historySecondCruiser.HistorySecondCruiserListDTO">
+        select  DATE_FORMAT(`time`, #{dateFormat}) AS time,value ->>'$.flylat' as flyLat,value ->>'$.flylon' as flyLon ,
+           value ->> #{type} as num
+        from history_second_cruiser
+        WHERE mac = #{mac}
+          AND `time` <![CDATA[>=]]> #{time1}
+          AND `time` <![CDATA[<=]]> #{time2}
+        <if test="orgId !=null and orgId != 0">
+            AND organization_id = #{orgId}
+        </if>
+        <if test="orgIds != null and orgIds.size !=0">
+            and organization_id in
+            <foreach collection="orgIds" item="id" index="index" open="(" close=")" separator=",">
+                #{id}
+            </foreach>
+        </if>
+        order by time
+    </select>
 
     <select id="getDaily" resultType="java.lang.String">
         select AVG(JSON_EXTRACT(value,'$.dustld'))
@@ -40,11 +58,32 @@
           AND `time` <![CDATA[<=]]> #{time2}
     </select>
 
-    <select id="getDust" resultType="java.lang.Double">
-        select JSON_EXTRACT(value,'$.dustld')
+    <select id="getDust" resultType="java.lang.String">
+        select value ->>'$.dustld'
         from `history_second_cruiser`
         WHERE mac = #{mac}
           AND `time` <![CDATA[>=]]> #{start}
           AND `time` <![CDATA[<=]]> #{end}
     </select>
+
+
+    <select id="getAllCruiserData" resultType="java.util.Map">
+        SELECT
+        `value`
+        FROM `history_second_cruiser`
+        WHERE mac = #{mac}
+        AND `time` <![CDATA[>=]]> #{time1}
+        AND `time` <![CDATA[<=]]> #{time2}
+    </select>
+
+
+    <select id="getDusts" resultType="java.util.Map">
+        SELECT
+            value ->>'$.flylat' as flyLat,value ->>'$.flylon' as flyLon,value ->>'$.dustld' as dustld,
+            `time`
+        FROM `history_second_cruiser`
+        WHERE mac = #{mac}
+          AND `time` <![CDATA[>=]]> #{startTime}
+          AND `time` <![CDATA[<=]]> #{endTime}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0