From 30a4a720cfdd57248514f50d141dfd51519aa75d Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期五, 16 一月 2026 08:58:57 +0800
Subject: [PATCH] yys 销售指标,采购报表

---
 src/main/resources/mapper/sales/SalesLedgerProductMapper.xml |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
index 626c5a2..2579a18 100644
--- a/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
+++ b/src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -11,7 +11,7 @@
         t3.shipping_date
         FROM
         sales_ledger_product T1
-        left join shipping_info t3 on T1.id = t3.sales_ledger_id
+        left join shipping_info t3 on T1.id = t3.sales_ledger_product_id
         <where>
             1=1
             <if test="salesLedgerProduct.salesLedgerId != null and salesLedgerProduct.salesLedgerId != '' ">
@@ -68,6 +68,7 @@
         select slp.*,
         sl.project_name,
         sl.supplier_name,
+        sl.supplier_id,
         sl.sales_contract_no,
         sl.purchase_contract_number
         from sales_ledger_product slp
@@ -95,4 +96,34 @@
         </where>
         order by slp.register_date desc
     </select>
+    <select id="procurementBusinessSummaryListPage"
+            resultType="com.ruoyi.purchase.dto.ProcurementBusinessSummaryDto">
+        SELECT
+        slp.product_category AS productCategory,
+        slp.specification_model AS specificationModel,
+        sl.supplier_name AS supplierName,
+        SUM(slp.quantity) AS purchaseNum,
+        SUM(slp.tax_inclusive_total_price) AS purchaseAmount,
+        COUNT(DISTINCT slp.sales_ledger_id) AS purchaseTimes,
+        <!-- 骞冲潎鍗曚环 = 鎬婚噰璐噾棰�/鎬婚噰璐暟閲忥紝淇濈暀2浣嶅皬鏁帮紝閬垮厤闄�0 -->
+        ROUND(IF(SUM(slp.quantity) = 0, 0, SUM(slp.tax_inclusive_total_price) / SUM(slp.quantity)), 2) AS averagePrice,
+        <!-- 璇ヤ骇鍝佸ぇ绫讳笅鏈�鍚庝竴涓綍鍏ユ棩鏈燂紙鍙栧彴璐︿富琛ㄧ殑entry_date锛� -->
+        MAX(sl.entry_date) AS entryDate
+        FROM sales_ledger_product slp
+        <!-- 鍏宠仈鍙拌处涓昏〃锛氳幏鍙栧綍鍏ユ棩鏈焑ntry_date -->
+        LEFT JOIN purchase_ledger sl ON slp.sales_ledger_id = sl.id
+        WHERE slp.type = 2 <!-- 鍥哄畾绛涢�夛細閲囪喘鍙拌处锛坱ype=2锛� -->
+        <!-- 閲囪喘鏃ユ湡绛涢�夛細鍙�夋潯浠� -->
+        <if test="req.entryDateStart != null and req.entryDateEnd != null">
+            AND sl.entry_date BETWEEN #{req.entryDateStart} AND #{req.entryDateEnd} <!-- 鏃堕棿鑼冨洿锛氶潪绌烘湁鏁� -->
+        </if>
+        <!-- 浜у搧澶х被绛涢�夛細鍙�夋潯浠� -->
+        <if test="req.productCategory != null and req.productCategory != ''">
+            AND slp.product_category = #{req.productCategory}
+        </if>
+        <!-- 鎸変骇鍝佸ぇ绫诲垎缁勮仛鍚� -->
+        GROUP BY slp.product_category
+        <!-- 鎸変骇鍝佸ぇ绫绘帓搴� -->
+        ORDER BY slp.product_category
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3