From 5bf42aa9950058f391805e6fb8d7376f4378924b Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 23 十二月 2024 16:16:55 +0800
Subject: [PATCH] cumulateHandle.getCurrent

---
 iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml |  126 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 123 insertions(+), 3 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml b/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml
index c1b5099..4b08398 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml
+++ b/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml
@@ -26,9 +26,13 @@
       t3.source_name,
       t2.tag_no,
       t2.dimension,
-      t2.value_type
+      t2.value_type,
+      t6.collect_value,
+      t6.collect_quality,
+      t6.collect_time
       from t_da_point t1
       left join t_da_measure_point t2 on t2.point_id = t1.id
+      left join t_da_point_collect_status t6 on t6.point_no = t1.point_no
       left join (
         select id source_id,server_name source_name
         from t_channel_opcua_device
@@ -64,8 +68,83 @@
             <if test="params.isEnable != null ">
                 and t1.is_enable = #{params.isEnable}
             </if>
+            <if test="params.collectQuality != null and params.collectQuality != ''">
+                and t6.collect_quality = #{params.collectQuality}
+            </if>
         </where>
-        order by t1.create_time desc
+        order by t1.create_time desc, t1.point_no desc
+    </select>
+
+    <select id="getList" resultType="com.iailab.module.data.point.dto.DaPointDTO">
+        select
+        t1.id,
+        t1.point_no,
+        t1.point_name,
+        t1.point_type ,
+        t1.data_type,
+        t1.unit,
+        t1.unittransfactor,
+        t1.default_value,
+        t1.max_value,
+        t1.min_value,
+        t1.minfreqid,
+        t1.remark,
+        t1.is_enable,
+        t1.creator,
+        t1.create_time,
+        t1.updater,
+        t1.update_time,
+        t2.source_type,
+        t3.source_name,
+        t2.tag_no,
+        t2.dimension,
+        t2.value_type,
+        t6.collect_value,
+        t6.collect_quality,
+        t6.collect_time
+        from t_da_point t1
+        left join t_da_measure_point t2 on t2.point_id = t1.id
+        left join t_da_point_collect_status t6 on t6.point_no = t1.point_no
+        left join (
+        select id source_id,server_name source_name
+        from t_channel_opcua_device
+        union
+        select id source_id, name source_name
+        from t_channel_modbus_device
+        union
+        select id source_id, code source_name
+        from t_http_api
+        union
+        select id source_id, instance_name source_name
+        from t_channel_kio_device
+        ) t3 on t3.source_id = t2.source_id
+        <where>
+            <if test="pointNo != null and pointNo != ''">
+                and t1.point_no like concat('%', #{pointNo}, '%')
+            </if>
+            <if test="pointName != null and pointName != ''">
+                and t1.point_name like concat('%', #{pointName}, '%')
+            </if>
+            <if test="pointType != null and pointType != ''">
+                and t1.point_type = #{pointType}
+            </if>
+            <if test="dataType != null and dataType != ''">
+                and t1.data_type = #{dataType}
+            </if>
+            <if test="sourceName != null and sourceName != ''">
+                and t3.source_name like concat('%', #{sourceName}, '%')
+            </if>
+            <if test="tagNo != null and tagNo != ''">
+                and t2.tag_no like concat('%', #{tagNo}, '%')
+            </if>
+            <if test="isEnable != null ">
+                and t1.is_enable = #{isEnable}
+            </if>
+            <if test="collectQuality != null and collectQuality != ''">
+                and t6.collect_quality = #{collectQuality}
+            </if>
+        </where>
+        order by t1.create_time desc, t1.point_no desc
     </select>
 
     <select id="getConstantPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
@@ -75,7 +154,8 @@
         t1.default_value,
         t1.point_type,
         t1.store_type,
-        t1.data_type
+        t1.data_type,
+        t1.minfreqid
         FROM t_da_point t1
         <where>
             t1.point_type =  #{pointType}
@@ -105,6 +185,7 @@
         t1.unittransfactor,
         t1.max_value,
         t1.min_value,
+        t1.minfreqid,
         t2.source_type,
         t2.source_id,
         t3.source_name,
@@ -145,6 +226,7 @@
             </if>
         </where>
     </select>
+
     <select id="getMathPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
         SELECT
         t1.point_no,
@@ -153,6 +235,7 @@
         t1.point_type,
         t1.data_type,
         t1.store_type,
+        t1.minfreqid,
         t2.expression
         FROM t_da_point t1
         LEFT JOIN t_da_math_point t2 ON t2.point_id = t1.id
@@ -164,6 +247,43 @@
             <if test="minfreqid != null and minfreqid != ''">
                 AND t1.minfreqid = #{minfreqid}
             </if>
+            <if test="pointNos != null">
+                AND t1.point_no in
+                <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <select id="getCumulatePoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
+        SELECT
+        t1.point_no,
+        t1.point_name,
+        t1.default_value,
+        t1.point_type,
+        t1.data_type,
+        t1.store_type,
+        t1.minfreqid,
+        t2.moment_point,
+        t2.length,
+        t2.divisor
+        FROM t_da_point t1
+        LEFT JOIN t_da_cumulate_point t2 ON t2.point_id = t1.id
+        <where>
+            t1.point_type =  #{pointType}
+            <if test="isEnable != null">
+                AND t1.is_enable = #{isEnable}
+            </if>
+            <if test="minfreqid != null and minfreqid != ''">
+                AND t1.minfreqid = #{minfreqid}
+            </if>
+            <if test="pointNos != null">
+                AND t1.point_no in
+                <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
+                    #{item}
+                </foreach>
+            </if>
         </where>
     </select>
 

--
Gitblit v1.9.3