From e2392116cd6f875cdc2f46bc04b04d5305f21b56 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 23 十一月 2023 13:25:04 +0800 Subject: [PATCH] 1. 修改日统计值的排序查询逻辑 --- src/main/java/com/flightfeather/monitor/domain/ds1/repository/DustExceptionDataRep.kt | 19 ++++++++++++++++++- 1 files changed, 18 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..a6d60c0 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 + } } /** @@ -36,4 +43,14 @@ fun insert(list: List<DustExceptionData>): Int { return dustExceptionDataMapper.insertList(list) } + + fun select(mnCode: String, date: LocalDate): List<DustExceptionData?> { + val s = date.atStartOfDay() + val e = s.plusDays(1).minusSeconds(1) + return dustExceptionDataMapper.selectByExample(Example(DustExceptionData::class.java).apply { + createCriteria().andBetween("beginTime", s, e) + .andEqualTo("mnCode", mnCode) + orderBy("beginTime") + }) + } } \ No newline at end of file -- Gitblit v1.9.3