From 608f0d2c05d86510d546a362e44c10feb601b3f1 Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期二, 08 四月 2025 08:19:10 +0800
Subject: [PATCH] 优化项优化

---
 platformx-device-biz/src/main/resources/mapper/ReceivingNoteItemMapper.xml |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/platformx-device-biz/src/main/resources/mapper/ReceivingNoteItemMapper.xml b/platformx-device-biz/src/main/resources/mapper/ReceivingNoteItemMapper.xml
index 4ff3176..b4908b6 100644
--- a/platformx-device-biz/src/main/resources/mapper/ReceivingNoteItemMapper.xml
+++ b/platformx-device-biz/src/main/resources/mapper/ReceivingNoteItemMapper.xml
@@ -39,4 +39,20 @@
 			and rni.note_id = #{queryDTO.noteId}
 		</if>
 	</select>
+    <select id="selectDeviceNumByContractId" resultType="java.lang.Integer">
+		select
+			ifnull(sum(rni.num),0)
+		from
+			receiving_note_item rni
+		where
+			rni.device_id = #{deviceId}
+		  and exists (
+				select
+					*
+				from
+					receiving_note rn
+				where
+					rn.contract_id = #{contractId}
+				  and rn.id = rni.note_id)
+	</select>
 </mapper>

--
Gitblit v1.9.1