From 07a08efc3bd17142a81c2128be99abb34c498577 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期三, 04 二月 2026 10:02:11 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml |   81 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 79 insertions(+), 2 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml
index b44e7fb..b5231c7 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TErpProcurementMapper.xml
@@ -109,7 +109,9 @@
         select t1.id,
                t1.procurement_code,
                t2.clinic_name,
-               t2.clinic_address,
+               t2.person_charge_name,
+               t2.phone,
+               CONCAT(IFNULL(t2.province_name,''), IFNULL(t2.city_name,''), IFNULL(t2.district_name,''), IFNULL(t2.clinic_address,'')) AS clinic_address,
                t1.logistics_number as logisticsNo,
                 t1.send_time,
                t1.clinic_id,
@@ -261,7 +263,7 @@
     </select>
     <select id="clinicProcurementReport" resultType="com.ruoyi.system.vo.ClinicProcurementReportVO">
         select tep.id, tep.procurement_code, tep.pay_money, tep.status,tep.pay_time,tep.clinic_id, tep.supplier_id,
-               tep.money,tep.supplier_money,
+               tep.money,tep.supplier_money,tep.create_by,
                tcs.supplier_name as supplierName, tcc.clinic_name as clinicName,tcc.person_charge_name,tcc.phone
         from t_erp_procurement tep
         left join t_crm_supplier tcs on tep.supplier_id = tcs.id
@@ -662,4 +664,79 @@
         order by tep.pay_time desc
     </select>
 
+    <!-- 诊所采购报表详情列表(商品维度) -->
+    <select id="clinicProcurementReportDetail" resultType="com.ruoyi.system.vo.ClinicProcurementReportDetailVO">
+        SELECT
+            tep.procurement_code,
+            tep.create_by,
+            tep.status,
+            tep.logistics_number,
+            tep.create_time,
+            tep.send_time,
+            tep.warehousing_time,
+            su.nick_name AS warehousingUserName,
+            tepg.goods_id,
+            tepg.goods_name,
+            tepg.supplier_name,
+            tepg.purchase_count,
+            tepg.unit_name,
+            tepg.quasi_number,
+            tepg.purchase_price,
+            tepg.total_price,
+            tepg.platform_commission_price,
+            tcc.clinic_name,
+            tcc.person_charge_name,
+            tcc.phone,
+            CONCAT(IFNULL(tcc.province_name,''), IFNULL(tcc.city_name,''), IFNULL(tcc.district_name,''), IFNULL(tcc.clinic_address,'')) AS address
+        FROM t_erp_procurement_goods tepg
+        LEFT JOIN t_erp_procurement tep ON tepg.procurement_id = tep.id
+        LEFT JOIN t_crm_clinic tcc ON tep.clinic_id = tcc.id
+        LEFT JOIN sys_user su ON tep.warehousing_user_id = su.user_id
+        <where>
+            <if test="id != null and id != ''">
+                AND tepg.procurement_id = #{id}
+            </if>
+        </where>
+        ORDER BY tepg.id ASC
+    </select>
+
+    <!-- 诊所采购报表详情导出(商品维度,支持多选) -->
+    <select id="exportProcurementReportDetail" resultType="com.ruoyi.system.export.ProcurementReportDetailExport">
+        SELECT
+            tep.procurement_code,
+            tep.create_by,
+            tep.status,
+            tep.logistics_number,
+            tep.create_time,
+            tep.send_time,
+            tep.warehousing_time,
+            tep.clinic_id,
+            su.nick_name AS warehousingUserName,
+            tepg.goods_name,
+            tepg.supplier_name,
+            tepg.purchase_count,
+            tepg.unit_name,
+            tepg.quasi_number,
+            tepg.purchase_price,
+            tepg.total_price,
+            tepg.platform_commission_price,
+            tcc.clinic_name,
+            tcc.person_charge_name,
+            tcc.phone,
+            CONCAT(IFNULL(tcc.province_name,''), IFNULL(tcc.city_name,''), IFNULL(tcc.district_name,''), IFNULL(tcc.clinic_address,'')) AS address
+        FROM t_erp_procurement_goods tepg
+        LEFT JOIN t_erp_procurement tep ON tepg.procurement_id = tep.id
+        LEFT JOIN t_crm_clinic tcc ON tep.clinic_id = tcc.id
+        LEFT JOIN sys_user su ON tep.warehousing_user_id = su.user_id
+        <where>
+            <if test="procurementIds != null and procurementIds.size() > 0">
+                AND tepg.procurement_id IN
+                <foreach item="item" collection="procurementIds" separator="," open="(" close=")" index="">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        ORDER BY tep.pay_time DESC, tepg.id ASC
+    </select>
+
 </mapper>

--
Gitblit v1.7.1