From c7e1f7e86d3bdde9021011109189003a88e48e8a Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期三, 27 五月 2026 09:54:08 +0800
Subject: [PATCH] 修改排序
---
src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
index 505011f..7de15bd 100644
--- a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
+++ b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
@@ -15,7 +15,9 @@
next_date,
record_date,
CASE
- WHEN next_date >= DATE_FORMAT(now(),'%Y-%m-%d') THEN 1
+ WHEN most_date IS NOT NULL
+ AND valid IS NOT NULL
+ AND DATE_ADD(most_date, INTERVAL valid DAY) >= CURDATE() THEN 1
ELSE 2
END AS status,
create_user,
@@ -40,10 +42,16 @@
<if test="req.status != null">
<choose>
<when test="req.status == 1">
- AND next_date >= DATE_FORMAT(now(),'%Y-%m-%d')
+ AND most_date IS NOT NULL
+ AND valid IS NOT NULL
+ AND DATE_ADD(most_date, INTERVAL valid DAY) >= CURDATE()
</when>
<when test="req.status == 2">
- AND next_date < DATE_FORMAT(now(),'%Y-%m-%d')
+ AND (
+ most_date IS NULL
+ OR valid IS NULL
+ OR DATE_ADD(most_date, INTERVAL valid DAY) < CURDATE()
+ )
</when>
</choose>
</if>
@@ -54,6 +62,6 @@
AND record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
</if>
</where>
- ORDER BY update_time DESC
+ ORDER BY create_time DESC
</select>
-</mapper>
\ No newline at end of file
+</mapper>
--
Gitblit v1.9.3