From 9d66bfbfcda297f628e6a857e343f98422f4534a Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期五, 22 五月 2026 09:32:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'refs/remotes/origin/dev_New_pro' into dev_New_pro_OA

---
 src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml |   74 ++++++++++++++++++++++++++++++++++++
 1 files changed, 73 insertions(+), 1 deletions(-)

diff --git a/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml b/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
index f007228..ecdd1f3 100644
--- a/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
+++ b/src/main/resources/mapper/purchase/PurchaseLedgerMapper.xml
@@ -9,4 +9,76 @@
         SET contract_amount = #{totalTaxInclusiveAmount}
         WHERE id = #{id}
     </update>
-</mapper>
\ No newline at end of file
+    <select id="selectPurchaseStats" resultType="com.ruoyi.home.dto.IncomeExpenseAnalysisDto">
+        SELECT DATE_FORMAT(entry_date, #{dateFormat}) as dateStr, IFNULL(SUM(contract_amount), 0) as amount
+        FROM purchase_ledger
+        WHERE entry_date BETWEEN #{startDate} AND #{endDate}
+        GROUP BY dateStr
+    </select>
+
+    <select id="selectPurchaseLedgerListPage" resultType="com.ruoyi.purchase.dto.PurchaseLedgerDto">
+        SELECT
+        pl.id,
+        pl.purchase_contract_number,
+        pl.sales_contract_no,
+        pl.supplier_id,
+        pl.supplier_name,
+        pl.project_name,
+        pl.contract_amount,
+        pl.entry_date,
+        pl.execution_date,
+        pl.recorder_id,
+        pl.recorder_name,
+        pl.template_name,
+        pl.approve_user_ids,
+        sm.is_white,
+        pl.approval_status,
+        pl.payment_method,
+        pl.remarks
+        FROM purchase_ledger pl
+        LEFT JOIN supplier_manage sm ON pl.supplier_id = sm.id
+        <where>
+            <if test="c.purchaseContractNumber != null and c.purchaseContractNumber != ''">
+                AND pl.purchase_contract_number LIKE CONCAT('%', #{c.purchaseContractNumber}, '%')
+            </if>
+            <if test="c.approvalStatus != null and c.approvalStatus != ''">
+                AND pl.approval_status = #{c.approvalStatus}
+            </if>
+            <if test="c.supplierName != null and c.supplierName != ''">
+                AND pl.supplier_name LIKE CONCAT('%', #{c.supplierName}, '%')
+            </if>
+            <if test="c.salesContractNo != null and c.salesContractNo != ''">
+                AND pl.sales_contract_no LIKE CONCAT('%', #{c.salesContractNo}, '%')
+            </if>
+            <if test="c.projectName != null and c.projectName != ''">
+                AND pl.project_name LIKE CONCAT('%', #{c.projectName}, '%')
+            </if>
+            <if test="c.entryDateStart != null and c.entryDateStart != ''">
+                AND pl.entry_date &gt;= #{c.entryDateStart}
+            </if>
+            <if test="c.entryDateEnd != null and c.entryDateEnd != ''">
+                AND pl.entry_date &lt;= #{c.entryDateEnd}
+            </if>
+            <if test="c.supplierId != null">
+                AND pl.supplier_id = #{c.supplierId}
+            </if>
+            <if test="c.approvalStatus != null">
+                AND pl.approval_status = #{c.approvalStatus}
+            </if>
+        </where>
+        ORDER BY pl.entry_date DESC
+    </select>
+
+    <select id="selectTotalPurchaseAmount" resultType="java.math.BigDecimal">
+        SELECT IFNULL(SUM(contract_amount), 0)
+        FROM purchase_ledger
+        <where>
+            <if test="startDate != null and startDate != ''">
+                AND entry_date &gt;= #{startDate}
+            </if>
+            <if test="endDate != null and endDate != ''">
+                AND entry_date &lt;= #{endDate}
+            </if>
+        </where>
+    </select>
+</mapper>

--
Gitblit v1.9.3