From bf2f5e224a3c8df7886581cf06ca65129a89ce90 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期一, 25 五月 2026 09:46:02 +0800
Subject: [PATCH] fix: 报表管理的质检合格率取消四舍五入

---
 src/main/resources/mapper/basic/SupplierManageMapper.xml |   88 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 85 insertions(+), 3 deletions(-)

diff --git a/src/main/resources/mapper/basic/SupplierManageMapper.xml b/src/main/resources/mapper/basic/SupplierManageMapper.xml
index 248b940..b318be2 100644
--- a/src/main/resources/mapper/basic/SupplierManageMapper.xml
+++ b/src/main/resources/mapper/basic/SupplierManageMapper.xml
@@ -21,14 +21,96 @@
         T1.create_user,
         T1.update_time,
         T1.update_user,
-        T1.tenant_id
+        T1.tenant_id,
+        T1.is_white,
+        T2.nick_name AS maintainUserName,
+        T1.supplier_type
         FROM supplier_manage T1
         LEFT JOIN sys_user T2 ON T1.maintain_user_id = T2.user_id
         <where>
             <if test="supplierManageDto.supplierName != null and supplierManageDto.supplierName != '' ">
-                AND supplier_name = #{supplierManageDto.supplierName}
+                AND T1.supplier_name LIKE CONCAT('%',#{supplierManageDto.supplierName},'%')
+            </if>
+            <if test="supplierManageDto.isWhite != null">
+                AND T1.is_white = #{supplierManageDto.isWhite}
             </if>
         </where>
     </select>
 
-</mapper>
\ No newline at end of file
+    <select id="supplierExportList" resultType="com.ruoyi.basic.excel.SupplierManageExcelDto">
+        SELECT
+        T1.id,
+        T1.supplier_name,
+        T1.taxpayer_identification_num,
+        T1.company_address,
+        T1.company_phone,
+        T1.bank_account_name,
+        T1.bank_account_num,
+        T1.contact_user_name,
+        T1.contact_user_phone,
+        T1.maintain_user_id,
+        T1.maintain_time,
+        T1.create_time,
+        T1.create_user,
+        T1.update_time,
+        T1.update_user,
+        T1.tenant_id,
+        T1.is_white,
+        T2.nick_name AS maintainUserName
+        FROM supplier_manage T1
+        LEFT JOIN sys_user T2 ON T1.maintain_user_id = T2.user_id
+        <where>
+            <if test="supplierManageDto.supplierName != null and supplierManageDto.supplierName != '' ">
+                AND T1.supplier_name LIKE CONCAT('%',#{supplierManageDto.supplierName},'%')
+            </if>
+            <if test="supplierManageDto.isWhite != null">
+                AND T1.is_white = #{supplierManageDto.isWhite}
+            </if>
+        </where>
+    </select>
+    
+    <select id="supplierTransactions" resultType="com.ruoyi.purchase.vo.SupplierTransactionsVo">
+        SELECT T1.supplier_id,
+               sm.supplier_name,
+               T1.contractAmounts,
+               IFNULL(T3.InboundAmount, 0) AS shippedAmount,
+               T1.contractAmounts - IFNULL(T3.InboundAmount, 0) AS unshippedAmount
+        FROM (SELECT supplier_id, SUM(contract_amount) AS contractAmounts FROM purchase_ledger GROUP BY supplier_id) T1
+        LEFT JOIN (
+            SELECT pl.supplier_id,
+                   SUM(IFNULL(qi.quantity, 0) * slp.tax_inclusive_unit_price) AS InboundAmount
+            FROM quality_inspect qi
+            INNER JOIN purchase_ledger pl ON pl.id = qi.purchase_ledger_id
+            INNER JOIN sales_ledger_product slp ON slp.sales_ledger_id = pl.id AND slp.product_model_id = qi.product_model_id
+            WHERE qi.inspect_state = 1 AND slp.type = 2
+            GROUP BY pl.supplier_id
+        ) T3 ON T3.supplier_id = T1.supplier_id
+        LEFT JOIN supplier_manage sm ON T1.supplier_id = sm.id
+        <where>
+            <if test="supplierName!=null and supplierName!=''">
+                AND sm.supplier_name LIKE CONCAT('%',#{supplierName},'%')
+            </if>
+        </where>
+    </select>
+
+    <select id="supplierTransactionsDetails"
+            resultType="com.ruoyi.purchase.vo.SupplierTransactionsDetailsVo">
+       SELECT pl.id purchaseLedgerId,
+              pl.purchase_contract_number,
+              pl.execution_date,
+              pl.contract_amount,
+              IFNULL(T2.InboundAmount, 0) AS shippedAmount,
+              pl.contract_amount - IFNULL(T2.InboundAmount, 0) AS unshippedAmount
+       FROM purchase_ledger pl
+       LEFT JOIN (
+           SELECT slp.sales_ledger_id,
+                  SUM(IFNULL(qi.quantity, 0) * slp.tax_inclusive_unit_price) AS InboundAmount
+           FROM quality_inspect qi
+           INNER JOIN sales_ledger_product slp ON slp.sales_ledger_id = qi.purchase_ledger_id AND slp.product_model_id = qi.product_model_id
+           WHERE qi.inspect_state = 1 AND slp.type = 2
+           GROUP BY slp.sales_ledger_id
+       ) T2 ON T2.sales_ledger_id = pl.id
+       WHERE pl.supplier_id = #{supplierId}
+    </select>
+
+</mapper>

--
Gitblit v1.9.3