From b19637f4579b91085e46712931275f4bacde8a6e Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期三, 27 五月 2026 17:28:47 +0800
Subject: [PATCH] 验收应急用

---
 src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml b/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml
index 6da8a75..2a1425c 100644
--- a/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml
+++ b/src/main/resources/mapper/purchase/InvoicePurchaseMapper.xml
@@ -115,10 +115,11 @@
         <!--                and a.month = #{month}-->
         <!--            </if>-->
         <!--        </where>-->
+        select * from (
         SELECT
         month,
-        SUM(sales_tax_amount) AS sales_tax_amount,
-        SUM(purchase_tax_amount) AS purchase_tax_amount
+        SUM(sales_tax_amount) AS j_tax_amount,
+        SUM(purchase_tax_amount) AS x_tax_amount
         FROM (
         SELECT
         DATE_FORMAT(entry_date, '%Y-%m') AS month,
@@ -135,17 +136,18 @@
         0 AS sales_tax_amount,
         ROUND(SUM(contract_amount * 0.26), 2) AS purchase_tax_amount
         FROM purchase_ledger
-        <where>
-
-            a.month is not null
-            <if test="month != null">
-                and a.month = #{month}
-            </if>
-        </where>
+        WHERE entry_date IS NOT NULL
         GROUP BY DATE_FORMAT(entry_date, '%Y-%m')
         ) t
         GROUP BY month
-        ORDER BY month;
+        ORDER BY month
+        ) a
+        <where>
+            a.month is not null
+            <if test="month != null and month != ''">
+                and a.month = #{month}
+            </if>
+        </where>
 
     </select>
     <select id="listVat1" resultType="com.ruoyi.purchase.dto.VatDto">

--
Gitblit v1.9.3