From 8e944cfabb253fc2556588e308e282586043f7b0 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期二, 18 十一月 2025 22:09:56 +0800
Subject: [PATCH] 即时消息时间出现负数的问题修改

---
 smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.xml |   58 +++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.xml b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.xml
index 1e9fa8e..60144c5 100644
--- a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.xml
+++ b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateStateMapper.xml
@@ -6,24 +6,7 @@
         insert into iot_data.aggregate_state_${workstationId}
         values ${sql}
     </insert>
-
-    <insert id="saveState">
-        insert into iot_data.aggregate_state_${workstationId} USING iot_data.super_aggregate_state
-        TAGS(${workstationId}) values
-        <foreach separator="," collection="list" item="item" index="index">
-            (#{item.startTime}, #{item.endTime}, #{item.durationCollect}, #{item.valueCollect}, #{item.calendarCode},
-            #{item.factoryYear}, #{item.factoryMonth}, #{item.factoryWeek}, #{item.factoryDate},
-            #{item.shiftIndex}, #{item.shiftTimeType}, #{item.wcs}, #{item.rps}, #{item.isDeleted},#{item.isPlan})
-        </foreach>
-    </insert>
-
-    <update id="createTable">
-        create table if not exists iot_data.aggregate_state_${workstationId} using super_aggregate_state tags
-        (
-            #{workstationId}
-        )
-    </update>
-
+	
     <select id="countStatsShiftEndTimeNotNull" resultType="com.qianwen.smartman.modules.mdc.dto.CountResult">
         select sum(duration_collect) as nums, value_collect status
         from iot_data.super_aggregate_state
@@ -422,7 +405,7 @@
             #{week}
         </foreach>
     </select>
-
+	<!-- 
     <select id="getDataByMonth" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
         select ts as startTime,
         end_time as endTime,
@@ -452,7 +435,40 @@
             #{month}
         </foreach>
     </select>
-
+     -->
+	
+	<select id="getDataByMonth" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
+        select 
+        end_time as endTime,
+        duration_collect,
+        value_collect,
+        calendar_code as calendarCode,
+        factory_year as factoryYear,
+        factory_month as factoryMonth,
+        factory_week as factoryWeek,
+        factory_date as factoryDate,
+        shift_index as shiftIndex,
+        shift_time_type as shiftTimeType,
+        wcs,
+        rps,
+        is_deleted as isDeleted,
+        workstation_id as workstationId
+        from root.f2.aggregate_state_*
+        where is_deleted=false
+        and wcs > 0
+        and factory_year = #{year}
+        and workstation_id IN
+        <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        and factory_month IN
+        <foreach collection="monthList" item="month" open="(" separator="," close=")">
+            #{month}
+        </foreach>
+         align by device
+    </select>
+    
+    <!-- 杩欎釜鏈夌敤鍚� -->
     <select id="listCrossDay" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateState">
         select ts              as startTime,
                end_time        as endTime,
@@ -1008,7 +1024,7 @@
         where factory_date = #{factoryDate}
         and wcs > 0
         and shift_index = #{shiftIndex}
-        and calendar_code = '${calendarCode}'
+        and calendar_code = "#{calendarCode}"
         and is_deleted = false
         <if test="ids != null and ids.size() > 0">
             AND workstation_id IN

--
Gitblit v1.9.3