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/SuperAggregateOutputMapper.xml |  107 +++++++++++++++++++++++++----------------------------
 1 files changed, 51 insertions(+), 56 deletions(-)

diff --git a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.xml b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.xml
index a69da78..c41084b 100644
--- a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.xml
+++ b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperAggregateOutputMapper.xml
@@ -2,62 +2,9 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qianwen.smartman.modules.mdc.mapper.SuperAggregateOutputMapper">
 
-    <select id="getOutputDataByNaturalDate" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
-        select ts as startTime,
-        pre_ts as endTime,
-        output,
-        cur_output as curOutput,
-        pre_output as preOutput,
-        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,
-        program,
-        product_code as productCode,
-        product_name as productName,
-        workstation_id as workstationId
-        from iot_data.super_aggregate_output
-        where ts <![CDATA[>=]]> #{startDate} and ts <![CDATA[<]]> #{endDate}
-            AND output <![CDATA[>=]]> 0
-        <if test="workstationIds != null and workstationIds.size() > 0">
-            AND workstation_id IN
-            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
-                #{id}
-            </foreach>
-        </if>
-    </select>
+    
 
-    <select id="getOutputDataByFactoryDate"
-            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
-        select ts as startTime,
-        pre_ts as endTime,
-        output,
-        cur_output as curOutput,
-        pre_output as preOutput,
-        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,
-        program,
-        product_code as productCode,
-        product_name as productName,
-        workstation_id as workstationId
-        from iot_data.super_aggregate_output
-        where output <![CDATA[>=]]> 0
-        and factory_date <![CDATA[>=]]> #{startDate} and factory_date <![CDATA[<=]]> #{endDate}
-        <if test="workstationIds != null and workstationIds.size() > 0">
-            AND workstation_id IN
-            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
-                #{id}
-            </foreach>
-        </if>
-    </select>
+    
 
     <select id="getOutputDataByWorkstationAndFactoryDate"
             resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
@@ -400,6 +347,54 @@
         and output > 0
         and factory_month = #{month}
     </select>
-
+    
+    <!-- sql淇敼寮�濮� -->
+    <!-- 鍒楀悕涓紝program鍜屽凡涓嬬殑瀹為檯涓婇兘娌℃湁 -->
+    <sql id="aggregateOutputColumns">
+        pre_time as preTime,
+        output as output,
+        cur_output as curOutput,
+        pre_output as preOutput,
+        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,
+        program,
+        product_code as productCode,
+        product_name as productName,
+        workstation_id as workstationId
+    </sql>
+    
+	<select id="getOutputDataByFactoryDate"
+            resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
+        select <include refid="aggregateOutputColumns"/>
+        from root.f2.aggregate_output_*
+        where output <![CDATA[>=]]> 0
+        and factory_date <![CDATA[>=]]> #{startFatoryDate} and factory_date <![CDATA[<=]]> #{endFatoryDate}
+        <if test="workstationIds != null and workstationIds.size() > 0">
+            AND workstation_id IN
+            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
+         align by device
+    </select>
+    
+    <select id="getOutputDataByNaturalDate" resultType="com.qianwen.smartman.modules.mdc.entity.SuperAggregateOutput">
+        select <include refid="aggregateOutputColumns"/>
+        from root.f2.aggregate_output_*
+        where time <![CDATA[>=]]> #{startDate} and time <![CDATA[<]]> #{endDate}
+            AND output <![CDATA[>=]]> 0
+        <if test="workstationIds != null and workstationIds.size() > 0">
+            AND workstation_id IN
+            <foreach collection="workstationIds" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </if>
+         align by device
+    </select>
 </mapper>
 

--
Gitblit v1.9.3