From f112d1263921940234671e5788f6cf2655dbc353 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期五, 25 十月 2024 10:47:58 +0800
Subject: [PATCH] 过程参数,图形展示修改为使用数据点的paramChartType属性来判断

---
 smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml |   82 +++++++++++++++++++++++++++++++++--------
 1 files changed, 66 insertions(+), 16 deletions(-)

diff --git a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml
index 4ac9340..86b829b 100644
--- a/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml
+++ b/smart-man-boot/src/main/resources/com/qianwen/smartman/modules/mdc/mapper/SuperProcessParameterMapper.xml
@@ -3,11 +3,15 @@
 <mapper namespace="com.qianwen.smartman.modules.mdc.mapper.SuperProcessParameterMapper">
 
     <resultMap id="BaseResultMap" type="com.qianwen.smartman.modules.mdc.entity.WorkstationCollectData">
-        <id column="ts" jdbcType="TIMESTAMP" property="ts"/>
-        <result column="n" jdbcType="NVARCHAR" property="n"/>
-        <result column="v" jdbcType="NVARCHAR" property="v"/>
+    	
+    	
+        <id column="ts" jdbcType="BIGINT" property="ts"/>
+        
+        <result column="n" jdbcType="VARCHAR" property="n"/>
+        <result column="v" jdbcType="VARCHAR" property="v"/>
+        <result column="workstation_id" jdbcType="BIGINT" property="workstationId"/>
     </resultMap>
-	 
+	<!-- 
     <select id="queryLastParameter" resultType="com.qianwen.smartman.modules.mdc.entity.WorkstationCollectData">
         select last(ts),  n, last(v),workstation_id from super_collect_data
         <where>
@@ -15,7 +19,7 @@
         </where>
         group by workstation_id,n
     </select>
- 
+  -->
  	
     
     <select id="queryProcessParameter" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
@@ -35,7 +39,7 @@
         </where>
         order by ts asc
     </select>
-
+	<!-- 
     <select id="pageProcessParameter" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
         select ts as time,
         ts as realTime,
@@ -51,7 +55,18 @@
         order by ts asc
         limit #{current}, #{size}
     </select>
-
+     -->
+     <select id="pageProcessParameter" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
+        select 
+        n as collectItem,
+        v as value_collect
+        from root.f2.process_param_${workstationId}_${item}
+        where time &gt;= #{startTime}
+            and time &lt;= #{endTime}
+        order by time asc
+        limit #{size} offset #{current}
+    </select>
+	<!-- 
     <select id="countProcessParameter" resultType="java.lang.Long">
         select count(*)
         from iot_data.super_collect_data
@@ -62,7 +77,15 @@
             and workstation_id = #{workstationId}
         </where>
     </select>
-
+ -->
+   <select id="countProcessParameter" resultType="java.lang.Long">
+        select count(*)
+        from root.f2.process_param_${workstationId}_${item}
+        <where>
+            and time &gt;= #{startTime}
+            and time &lt;= #{endTime}
+        </where>
+    </select>
     <select id="getOneDate" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
         select ts as time,
         ts as realTime,
@@ -137,37 +160,64 @@
      -->
     
     <!-- sql淇敼寮�濮� -->
+    <!--  queryLastParameter 杩欎釜鏄牴鎹師濮媠ql鏀圭殑锛宮p鏈夐棶棰橈紝鏀瑰湪service涓疄鐜颁簡
+    <select id="queryLastParameter" resultMap="BaseResultMap">
+        select max_time(n) as ts,last_value(n) as n,last_value(v) as v,last_value(workstation_id) as workstationId from root.f2.process_param_${workstationId}_*  align by device
+    </select>
+    -->
+    <!-- 
     <select id="getLastParameters" resultType="com.qianwen.smartman.modules.mdc.entity.LastProcessParam">
         select workstation_id as workstationId,update_time as updateTime, param_json as paramJson from root.f2.last_process_param where workstation_id = #{workstationId}
     </select>
-    
+     -->
     
   
      <!-- 鏍规嵁oldFirstStatue 鏀归�犵殑-->
+     <!--
     <select id="lastParameterLessThanTime" resultType="com.qianwen.smartman.modules.mdc.entity.LastProcessParam">
         select workstation_id as workstationId,update_time as updateTime, param_json as paramJson 
         from root.f2.last_process_param
         where n = #{item} 
           and time &lt; #{startTime}
           and workstation_id = #{workstationId}
-    </select>
+    </select> -->
     <!-- 鏍规嵁oldLastStatue鏀圭殑 -->
+    <!-- 
     <select id="lastParameterGreaterThanTime" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
         select workstation_id as workstationId,update_time as updateTime, param_json as paramJson 
         from root.f2.last_process_param
         where n = #{item}
           and ts &gt; #{endTime}
           and workstation_id = #{workstationId}
-    </select>
+    </select> -->
     <select id="oldOneCollectList" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
-        select n as collectItem,v  as valueCollect
-        from root.f2.process_param_*
-        where n = #{item}
-          and time &gt;= #{startTime}
+        select n as collectItem,v as valueCollect
+        from root.f2.process_param_${workstationId}_${item}
+        where time &gt;= #{startTime}
           and time &lt;= #{endTime}
-          and workstation_id = #{workstationId}
         order by time
         align by device
     </select>
+    
+    <select id="lastParameterNotEqValue" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
+        select n as collectItem,v as valueCollect
+        from root.f2.process_param_${workstationId}_${item}
+        where v&lt;&gt;"#{value}"
+        order by time desc limit 1
+    </select>
+    
+    <select id="firstParameterEqValueGtTime" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
+        select n as collectItem,v as valueCollect
+        from root.f2.process_param_${workstationId}_${item}
+        where v="#{value}" and time &gt; #{time}
+        order by time limit 1
+    </select>
+    
+    <select id="firstParameterEqValue" resultType="com.qianwen.smartman.modules.mdc.dto.ProcessParameterVO">
+        select n as collectItem,v as valueCollect
+        from root.f2.process_param_${workstationId}_${item}
+        where v="#{value}"
+        order by time limit 1
+    </select>
 </mapper>
 

--
Gitblit v1.9.3