From 25db770e621f1259b8d5b7fd514207f7481c2d0f Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期三, 30 十月 2024 11:25:37 +0800
Subject: [PATCH] blade_cps路径改为smis

---
 smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml |  131 +++++++++++++++++++++++--------------------
 1 files changed, 70 insertions(+), 61 deletions(-)

diff --git a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml
index a3c33fe..8756650 100644
--- a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml
+++ b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAlarmMapper.xml
@@ -44,55 +44,9 @@
     </select>
 
 
-    <select id="selectListAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
-        select *
-        from iot_data.super_alarm
-        where workstation_id = #{vo.workstationId}
-        /*鎸夌収鐝鏌ヨ*/
-        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
-            and shift_index = #{vo.shiftIndex}
-            and factory_date = #{queryTime}
-        </if>
-        /*鎸夌収鏃ユ煡璇�*/
-        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
-            and factory_date = #{queryTime}
-        </if>
-        /*鎸夌収鏈堟煡璇�*/
-        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
-            and factory_year = #{vo.year}
-            and factory_month = #{vo.month}
-        </if>
-        /*鎸夌収鍛ㄨ*/
-        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
-            and factory_year = #{vo.year}
-            and factory_week = #{vo.week}
-        </if>
-    </select>
+    
 
-    <select id="queryAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
-        select *
-        from iot_data.super_alarm
-        where workstation_id = #{vo.workstationId}
-        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
-            and shift_index = #{vo.shiftIndex}
-            and factory_date = #{queryTime}
-        </if>
-        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
-            and factory_date = #{queryTime}
-        </if>
-        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
-            and factory_year = #{vo.year}
-            and factory_month = #{vo.month}
-        </if>
-        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
-            and factory_year = #{vo.year}
-            and factory_week = #{vo.week}
-        </if>
-        order by ts desc
-        <if test="query != null">
-            limit ${(query.current - 1) * query.size}, ${query.size}
-        </if>
-    </select>
+    
 
     <select id="selectAllAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
         select *
@@ -122,13 +76,7 @@
         order by ts desc
     </select>
 
-    <select id="selectListAlarmByShift" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
-        select *
-        from iot_data.super_alarm
-        where workstation_id = #{workstationId}
-          and factory_date <![CDATA[>=]]> #{startDate}
-          and factory_date <![CDATA[<=]]> #{endDate}
-    </select>
+    
 
     <select id="alarmReportByTime" resultType="com.qianwen.smartman.modules.report.vo.WorkstaionAlarmByTimeReportVO">
         select
@@ -262,20 +210,81 @@
 	
 	<!-- 鍘熷limit limit #{start}, #{end} 锛屽疄闄呬笂end搴旇鏄痯ageSize-->
     <select id="alarmByWorkstation" resultType="com.qianwen.smartman.modules.mdc.vo.AlarmAnalysisWorkstationVO">
-        select code    as alarmCode,
+        select code as alarmCode,
                message as alarmMsg
-        from root.f2.alarm_*
-        where workstation_id = #{workstationId}
-        order by time desc
+        from root.f2.alarm_${workstationId} order by time desc
             limit #{end} offset #{start}
           align by device
     </select>
     
     <select id="alarmByWorkstationTotal" resultType="java.lang.Integer">
-        select count(workstation_id)
+        select count(workstation_id) from root.f2.alarm_${workstationId}
+    </select>
+    
+    <!-- , -->
+    <sql id="alarmColumns">
+        code,message,level,workstation_id as workstationId,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
+    </sql>
+    
+        
+    <select id="selectListAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
+        select <include refid="alarmColumns"/>
+        from root.f2.alarm_*
+        where workstation_id = #{vo.workstationId}
+        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
+            and shift_index = #{vo.shiftIndex}
+            and factory_date = #{factoryDate}
+        </if>
+        
+        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
+            and factory_date = #{factoryDate}
+        </if>
+        
+        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
+            and factory_year = #{vo.year}
+            and factory_month = #{vo.month}
+        </if>
+        
+        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
+            and factory_year = #{vo.year}
+            and factory_week = #{vo.week}
+        </if>
+         align by device
+    </select>
+    
+    <select id="queryAlarm" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
+        select <include refid="alarmColumns"/>
+        from root.f2.alarm_*
+        where workstation_id = #{vo.workstationId}
+        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@SHIFT == vo.enums">
+            and shift_index = #{vo.shiftIndex}
+            and factory_date = #{factoryDate}
+        </if>
+        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@DAY == vo.enums">
+            and factory_date = #{factoryDate}
+        </if>
+        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@MONTH == vo.enums">
+            and factory_year = #{vo.year}
+            and factory_month = #{vo.month}
+        </if>
+        <if test="@com.qianwen.smartman.modules.mdc.enums.StatisticalMethodEnum@WEEK == vo.enums">
+            and factory_year = #{vo.year}
+            and factory_week = #{vo.week}
+        </if>
+        order by time desc
+        <if test="query != null">
+            limit ${query.size} offset ${(query.current - 1) * query.size}
+        </if>
+         align by device
+    </select>
+    
+    <select id="selectListAlarmByShift" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAlarm">
+        select <include refid="alarmColumns"/>
         from root.f2.alarm_*
         where workstation_id = #{workstationId}
-        
+          and factory_date <![CDATA[>=]]> #{startFactoryDate}
+          and factory_date <![CDATA[<=]]> #{endFactoryDate}
+          align by device
     </select>
 </mapper>
 

--
Gitblit v1.9.3