From 034f720f0bbc7f253c15613c28d994d7abf401eb Mon Sep 17 00:00:00 2001
From: tuqin <tuqin@tuqin.cn>
Date: 星期四, 24 九月 2026 10:53:33 +0800
Subject: [PATCH] feat: 现场需求后端改动
---
src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml | 42 ++++++++++++++++++++++++++++++++++++------
1 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
index fc680d0..17acdf8 100644
--- a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
+++ b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
@@ -15,14 +15,20 @@
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,
create_time,
update_user,
update_time,
- tenant_id
+ tenant_id,
+ unit,
+ dept_id,
+ instation_location,
+ cycle
FROM
measuring_instrument_ledger
<where>
@@ -36,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>
@@ -50,6 +62,24 @@
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
+
+ <select id="selectExistingCodes" resultType="java.lang.String">
+ SELECT code
+ FROM measuring_instrument_ledger
+ WHERE tenant_id = #{tenantId}
+ AND code IN
+ <foreach collection="codes" item="code" open="(" separator="," close=")">
+ #{code}
+ </foreach>
+ </select>
+
+ <!-- 涓嬫媺閫夋嫨锛氬綋鍓嶇鎴峰叏閮ㄨ閲忓櫒鍏枫�係QL 甯� /*data_scope*/ 鏍囪锛屼粎姝ゆ煡璇㈣眮鍏嶆暟鎹寖鍥磋繃婊� -->
+ <select id="listOptions" resultType="com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger">
+ SELECT /*data_scope*/ id, code, name, model, unit, most_date, valid, record_date
+ FROM measuring_instrument_ledger
+ WHERE tenant_id = #{tenantId}
+ ORDER BY create_time DESC
+ </select>
+</mapper>
--
Gitblit v1.9.3