From d603739c0320f355cfc3152865918729fea790de Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期一, 04 十一月 2024 09:45:43 +0800
Subject: [PATCH] license

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml |   76 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml
index 27b64c4..0703ef0 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentWorklineMapper.xml
@@ -25,4 +25,80 @@
     <select id="getDataList" resultType="java.util.Map">
         select top 1 [${tableName}].* from [${tableName}] order by CollectTime  desc
     </select>
+
+    <select id="getMinDate" resultType="java.util.Date">
+        SELECT TOP 1 CollectTime from [${tableName}] ORDER BY CollectTime ASC
+    </select>
+
+    <select id="getMaxElectric" resultType="org.jeecg.modules.mdc.dto.CurrentElectricDto">
+        SELECT TOP 1
+        <if test="axisType != null and axisType != '' and axisType == 1">
+            ABS( actualCurrentX ) currentValue,
+            EquipmentID,
+            CollectTime
+        </if>
+        <if test="axisType != null and axisType != '' and axisType == 2">
+            ABS( actualCurrentY ) currentValue,
+            EquipmentID,
+            CollectTime
+        </if>
+        <if test="axisType != null and axisType != '' and axisType == 3">
+            ABS( actualCurrentZ ) currentValue,
+            EquipmentID,
+            CollectTime
+        </if>
+        <if test="axisType != null and axisType != '' and axisType == 4">
+            ABS( actualCurrentA ) currentValue,
+            EquipmentID,
+            CollectTime
+        </if>
+        <if test="axisType != null and axisType != '' and axisType == 5">
+            ABS( actualCurrentB ) currentValue,
+            EquipmentID,
+            CollectTime
+        </if>
+        FROM
+            [${tableName}]
+        WHERE
+        <if test="axisType != null and axisType != '' and axisType == 1">
+            ABS( actualCurrentX ) = ( SELECT MAX ( ABS( actualCurrentX ) ) currentValue FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
+        </if>
+        <if test="axisType != null and axisType != '' and axisType == 2">
+            ABS( actualCurrentY ) = ( SELECT MAX ( ABS( actualCurrentY ) ) currentValue FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
+        </if>
+        <if test="axisType != null and axisType != '' and axisType == 3">
+            ABS( actualCurrentZ ) = ( SELECT MAX ( ABS( actualCurrentZ ) ) currentValue FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
+        </if>
+        <if test="axisType != null and axisType != '' and axisType == 4">
+            ABS( actualCurrentA ) = ( SELECT MAX ( ABS( actualCurrentA ) ) currentValue FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
+        </if>
+        <if test="axisType != null and axisType != '' and axisType == 5">
+            ABS( actualCurrentB ) = ( SELECT MAX ( ABS( actualCurrentB ) ) currentValue FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
+        </if>
+    </select>
+
+    <select id="getNearTimeSpindleLoad" resultType="org.jeecg.modules.mdc.dto.EquipmentMachiningHistoryDto">
+        SELECT TOP 1
+            CollectTime collectTime,
+            spindleload,
+            spindlespeed
+        FROM
+            [${tableName}]
+        WHERE
+            CollectTime BETWEEN #{startDate} AND #{endDate}
+        ORDER BY
+            ABS( DATEDIFF( SECOND, CollectTime, #{nearDate} ) )
+    </select>
+
+    <select id="getMaxSpindleLoad" resultType="org.jeecg.modules.mdc.dto.EquipmentMachiningHistoryDto">
+        SELECT TOP 1
+            CollectTime collectTime,
+            EquipmentID equipmentID,
+            spindleload spindleLoad,
+            spindlespeed spindleSpeed
+        FROM
+            [${tableName}]
+        WHERE
+            ABS( spindleload ) = ( SELECT MAX ( ABS( spindleload ) ) spindleload FROM [${tableName}] WHERE CollectTime BETWEEN #{startDate} AND #{endDate} )
+    </select>
 </mapper>

--
Gitblit v1.9.3