From 55d694aaae4e421b5e55cd941500e08f85cb5d4d Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 27 八月 2026 18:21:33 +0800
Subject: [PATCH] feat(sales): 添加框架合同订单功能并优化销售台账管理
---
src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml | 34 ++++++++++++++++++++++++++++------
1 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml b/src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
index fc680d0..88db470 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,16 @@
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>
+</mapper>
--
Gitblit v1.9.3