From 8f7542559760324c4dd6a2f9795d4c4df21df7af Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 31 十月 2023 14:38:57 +0800
Subject: [PATCH] 1. 修改了数据超标分析模块的类型为数据超标类型

---
 src/main/java/com/flightfeather/monitor/domain/ds1/repository/DustStatisticsValueRep.kt |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/flightfeather/monitor/domain/ds1/repository/DustStatisticsValueRep.kt b/src/main/java/com/flightfeather/monitor/domain/ds1/repository/DustStatisticsValueRep.kt
index 2dfcdf3..6af586e 100644
--- a/src/main/java/com/flightfeather/monitor/domain/ds1/repository/DustStatisticsValueRep.kt
+++ b/src/main/java/com/flightfeather/monitor/domain/ds1/repository/DustStatisticsValueRep.kt
@@ -1,9 +1,8 @@
 package com.flightfeather.monitor.domain.ds1.repository
 
-import com.flightfeather.monitor.domain.ds1.entity.DustExceptionData
-import com.flightfeather.monitor.domain.ds1.entity.DustSiteData
 import com.flightfeather.monitor.domain.ds1.entity.DustStatisticsValue
 import com.flightfeather.monitor.domain.ds1.mapper.DustStatisticsValueMapper
+import com.github.pagehelper.PageHelper
 import org.springframework.stereotype.Repository
 import tk.mybatis.mapper.entity.Example
 import java.time.Duration
@@ -13,10 +12,16 @@
 class DustStatisticsValueRep(private val dustStatisticsValueMapper: DustStatisticsValueMapper) {
 
     fun findLatestData(type: String): DustStatisticsValue? {
-        return dustStatisticsValueMapper.selectOneByExample(Example(DustStatisticsValue::class.java).apply {
+        val p = PageHelper.startPage<DustStatisticsValue>(1, 1)
+        dustStatisticsValueMapper.selectByExample(Example(DustStatisticsValue::class.java).apply {
             createCriteria().andEqualTo("type", type)
             orderBy("lst").desc()
         })
+        return if (p.isNotEmpty()) {
+            p[0]
+        } else {
+            null
+        }
     }
 
 

--
Gitblit v1.9.3