From 6f28997aa8d9f62e0c54838490a473041f709742 Mon Sep 17 00:00:00 2001 From: zmc <zmc_li@foxmail.com> Date: 星期四, 02 十一月 2023 11:42:32 +0800 Subject: [PATCH] 修改了数据排名清单sql查询语句 --- src/main/java/com/flightfeather/monitor/domain/ds1/repository/DustExceptionDataRep.kt | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/flightfeather/monitor/domain/ds1/repository/DustExceptionDataRep.kt b/src/main/java/com/flightfeather/monitor/domain/ds1/repository/DustExceptionDataRep.kt index 2876b18..3bf25c9 100644 --- a/src/main/java/com/flightfeather/monitor/domain/ds1/repository/DustExceptionDataRep.kt +++ b/src/main/java/com/flightfeather/monitor/domain/ds1/repository/DustExceptionDataRep.kt @@ -2,6 +2,7 @@ import com.flightfeather.monitor.domain.ds1.entity.DustExceptionData import com.flightfeather.monitor.domain.ds1.mapper.DustExceptionDataMapper +import com.github.pagehelper.PageHelper import org.springframework.stereotype.Repository import tk.mybatis.mapper.entity.Example import java.time.LocalDate @@ -13,9 +14,15 @@ * 鑾峰彇鏈�鏂颁竴鏉¤褰� */ fun findLatestData(): DustExceptionData? { - return dustExceptionDataMapper.selectOneByExample(Example(DustExceptionData::class.java).apply { + val p = PageHelper.startPage<DustExceptionData>(1, 1) + dustExceptionDataMapper.selectByExample(Example(DustExceptionData::class.java).apply { orderBy("endTime").desc() }) + return if (p.isNotEmpty()) { + p[0] + } else { + null + } } /** -- Gitblit v1.9.3