From 0d7d874912d0147376826b55667a1deb6547ed91 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期四, 21 五月 2026 15:25:27 +0800
Subject: [PATCH] Merge branch 'dev_New_pro' into dev_宁夏_英泽防锈
---
src/main/resources/mapper/stock/StockOutRecordMapper.xml | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/src/main/resources/mapper/stock/StockOutRecordMapper.xml b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
index a441de9..202de6b 100644
--- a/src/main/resources/mapper/stock/StockOutRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
@@ -18,6 +18,17 @@
</resultMap>
<select id="listPage" resultType="com.ruoyi.stock.dto.StockOutRecordDto">
+ WITH RECURSIVE product_tree AS (
+ SELECT id
+ FROM product
+ WHERE id = #{params.topParentProductId}
+
+ UNION ALL
+
+ SELECT p.id
+ FROM product p
+ INNER JOIN product_tree pt ON p.parent_id = pt.id
+ )
SELECT
sor.*,
p.product_name as productName,
@@ -35,11 +46,20 @@
<if test="params.productName != null and params.productName != ''">
and p.product_name like concat('%',#{params.productName},'%')
</if>
+ <if test="params.model != null and params.model != ''">
+ and pm.model like concat('%',#{params.model},'%')
+ </if>
+ <if test="params.batchNo != null and params.batchNo != ''">
+ and sor.batch_no like concat('%',#{params.batchNo},'%')
+ </if>
<if test="params.type != null and params.type != ''">
and sor.type = #{params.type}
</if>
<if test="params.recordType != null and params.recordType != ''">
and sor.record_type = #{params.recordType}
+ </if>
+ <if test="params.topParentProductId != null and params.topParentProductId > 0">
+ and p.id in (select id from product_tree)
</if>
</where>
order by sor.id desc
@@ -72,4 +92,33 @@
order by sor.id desc
</select>
+ <select id="listPageAccountSales" resultType="com.ruoyi.account.bean.vo.sales.SalesOutboundVo">
+ SELECT
+ sor.id,
+ sor.outbound_batches,
+ sl.customer_name,
+ sor.create_time as shippingDate,
+ p.product_name,
+ pm.model as specification_model,
+ sor.stock_out_num * slp.tax_inclusive_unit_price as outboundAmount,
+ s.shipping_no,
+ sl.sales_contract_no
+ FROM stock_out_record sor
+ left join shipping_info s on sor.record_id = s.id
+ LEFT JOIN sales_ledger sl ON s.sales_ledger_id = sl.id
+ LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = slp.id and slp.type = 1
+ left join product_model pm on slp.product_model_id = pm.id
+ left join product p on pm.product_id = p.id
+ WHERE sor.record_type='13' and sor.approval_status=1
+ <if test="req.outboundBatches != null and req.outboundBatches != ''">
+ AND sor.outbound_batches LIKE CONCAT('%',#{req.outboundBatches},'%')
+ </if>
+ <if test="req.customerName != null and req.customerName != ''">
+ AND sl.customer_name LIKE CONCAT('%',#{req.customerName},'%')
+ </if>
+ <if test="req.startDate != null and req.endDate != null">
+ AND s.shipping_date BETWEEN #{req.startDate} AND #{req.endDate}
+ </if>
+ order by sor.id DESC
+ </select>
</mapper>
--
Gitblit v1.9.3