Browse Source

故障数据查询修改

全业务考评 1 năm trước cách đây
mục cha
commit
362563aec8

+ 9 - 0
power-fitting-JN/src/main/java/com.gyee.power.fitting/mapper/AlarmTsXmlMapper.java

@@ -18,4 +18,13 @@ public interface AlarmTsXmlMapper extends BaseMapper<AlarmTsXml> {
 
     List<AlarmVo> findTagsByDeviceidInDate(@Param("superTableName") String superTableName, @Param("deviceid")  List<String> deviceid, @Param("date")List<Long> date);
 
+
+    List<AlarmVo> findTagsByDeviceidByDate(@Param("superTableName") String superTableName,
+                                           @Param("deviceid")  List<String> deviceid,
+                                           @Param("begin")Long begin,
+                                           @Param("end")Long end);
+
+
+
+
 }

+ 10 - 1
power-fitting-JN/src/main/java/com.gyee.power.fitting/service/custom/curve/DataFittingService.java

@@ -405,7 +405,16 @@ public class DataFittingService {
             times.add(time);
         });
 
-        List<AlarmVo> list = alarmTsXmlMapper.findTagsByDeviceidInDate(table,uniqueWtIds, times);
+        // 最小值
+        long begin = times.stream().mapToLong(Long::longValue).min().getAsLong();
+        System.out.println("min:" + begin);
+        // 最大值
+        long end = times.stream().mapToLong(Long::longValue).max().getAsLong();
+        System.out.println("max:" + end);
+
+
+
+        List<AlarmVo> list = alarmTsXmlMapper.findTagsByDeviceidByDate(table,uniqueWtIds, begin,end);
 
         return list;
     }

+ 22 - 0
power-fitting-JN/src/main/resources/mapper/AlarmTsXmlMapper.xml

@@ -21,4 +21,26 @@
         </where>
 
     </select>
+    <select id="findTagsByDeviceidByDate" resultType="com.gyee.power.fitting.model.vo.AlarmVo">
+
+        select * from ${superTableName}
+        <where>
+
+            <if test="begin !=null and begin != ''">
+                AND ts >= ${begin}
+
+            </if>
+
+            <if test="end !=null and end != ''">
+                AND ts &lt;= ${end}
+
+            </if>
+
+            <if test="deviceid !=null">
+                AND deviceid in
+                <foreach item="item" collection="deviceid" separator="," open="(" close=")" index="">'${item}'</foreach>
+            </if>
+
+        </where>
+    </select>
 </mapper>