From 8e52d3e600ff49869cc612fd9bf1cc64ac304f50 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期六, 30 五月 2026 17:20:48 +0800
Subject: [PATCH] feat(sales): 添加销售报价单ID查询条件支持

---
 src/main/resources/mapper/device/DeviceLedgerMapper.xml |   42 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/mapper/device/DeviceLedgerMapper.xml b/src/main/resources/mapper/device/DeviceLedgerMapper.xml
index 9cee459..efae5cc 100644
--- a/src/main/resources/mapper/device/DeviceLedgerMapper.xml
+++ b/src/main/resources/mapper/device/DeviceLedgerMapper.xml
@@ -11,6 +11,8 @@
         dl.device_name,
         dl.device_model,
         dl.supplier_name,
+        dl.device_brand,
+        dl.storage_location,
         dl.unit,
         dl.number,
         dl.status,
@@ -24,11 +26,19 @@
         dl.un_tax_including_price_total,
         dl.create_time,
         dl.update_time ,
-        su.user_name AS createUser,
+        su.nick_name AS createUser,
         dl.update_user,
-        dl.tenant_id
+        dl.tenant_id,
+        dl.is_depr,
+        dl.annual_depreciation_amount,
+        dl.type,
+        dl.area_id,
+        dl.is_iot_device,
+        dl.external_code,
+        da.area_name AS areaName
         FROM device_ledger dl
         left join sys_user su on dl.create_user = su.user_id
+        left join device_area da on dl.area_id = da.id
         <where>
             <!-- 璁惧鍚嶇О -->
             <if test="deviceLedger.deviceName != null and deviceLedger.deviceName != ''">
@@ -71,6 +81,21 @@
             <if test="deviceLedger.tenantId != null">
                 AND tenant_id = #{deviceLedger.tenantId}
             </if>
+
+            <!-- 璁惧鍖哄煙 -->
+            <if test="deviceLedger.areaId != null">
+                AND dl.area_id = #{deviceLedger.areaId}
+            </if>
+
+            <!-- 鏄惁鐗╄仈璁惧 -->
+            <if test="deviceLedger.isIotDevice != null">
+                AND dl.is_iot_device = #{deviceLedger.isIotDevice}
+            </if>
+
+            <!-- 澶栭儴缂栫爜 -->
+            <if test="deviceLedger.externalCode != null and deviceLedger.externalCode != ''">
+                AND dl.external_code LIKE CONCAT('%', #{deviceLedger.externalCode}, '%')
+            </if>
         </where>
         ORDER BY create_time DESC
     </select>
@@ -82,5 +107,18 @@
         from device_ledger
         where id = #{id}
     </select>
+    <select id="getDeviceTypeDistributionByYear"
+            resultType="com.ruoyi.account.bean.dto.DeviceTypeDetail"
+            parameterType="java.lang.Integer">
+        SELECT
+            `type`,
+            SUM(`number`) AS `count`,
+            SUM(tax_including_price_unit) AS amount
+        FROM device_ledger
+        WHERE YEAR(create_time) = #{year}
+          AND type IS NOT NULL
+        GROUP BY type
+    </select>
+
 
 </mapper>

--
Gitblit v1.9.3