From 0ae2d7e2cd0e0c3edde430c5cba8441a437e2d84 Mon Sep 17 00:00:00 2001
From: buhuazhen <hua100783@gmail.com>
Date: 星期三, 01 四月 2026 15:06:30 +0800
Subject: [PATCH] feat(production): 添加bomName字段及相关mapper映射
---
src/main/resources/mapper/stock/StockOutRecordMapper.xml | 80 +++++++++++++++++++++++++++++++++++++++
1 files changed, 79 insertions(+), 1 deletions(-)
diff --git a/src/main/resources/mapper/stock/StockOutRecordMapper.xml b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
index 182665c..3ccb4ab 100644
--- a/src/main/resources/mapper/stock/StockOutRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
@@ -15,7 +15,85 @@
<result column="update_time" property="updateTime" />
<result column="create_user" property="createUser" />
<result column="update_user" property="updateUser" />
- <result column="tenant_id" property="tenantId" />
</resultMap>
+ <select id="listPage" resultType="com.ruoyi.stock.dto.StockOutRecordDto">
+ WITH RECURSIVE cte AS (
+ SELECT id, product_name, parent_id, id AS current_id
+ FROM product
+
+ UNION ALL
+
+ SELECT c.id, c.product_name, p.parent_id, p.id
+ FROM cte c
+ JOIN product p ON c.parent_id = p.id
+ ),
+ root_map AS (
+ SELECT
+ c.id,
+ p.id AS root_id,
+ p.product_name AS root_name
+ FROM cte c
+ JOIN product p ON c.current_id = p.id
+ WHERE p.parent_id IS NULL
+ )
+ SELECT
+ sor.*,
+ p.product_name as productName,
+ pm.model,
+ pm.unit,
+ rm.root_name as rootName,
+ u.nick_name as createBy
+ FROM stock_out_record as sor
+ LEFT JOIN product_model as pm on sor.product_model_id = pm.id
+ LEFT JOIN product as p on pm.product_id = p.id
+ LEFT JOIN root_map rm ON pm.product_id = rm.id
+ LEFT JOIN sys_user as u on sor.create_user = u.user_id
+ <where>
+ <if test="params.timeStr != null and params.timeStr != ''">
+ and sor.create_time like concat('%',#{params.timeStr},'%')
+ </if>
+ <if test="params.productName != null and params.productName != ''">
+ and p.product_name like concat('%',#{params.productName},'%')
+ </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.rootName != null and params.rootName != ''">
+ and rm.root_name = #{params.rootName}
+ </if>
+ </where>
+ order by sor.id desc
+ </select>
+ <select id="listStockOutRecordExportData" resultType="com.ruoyi.stock.execl.StockOutRecordExportData">
+ SELECT
+ sor.*,
+ p.product_name as productName,
+ pm.model,
+ pm.unit,
+ u.nick_name as createBy
+ FROM stock_out_record as sor
+ LEFT JOIN product_model as pm on sor.product_model_id = pm.id
+ LEFT JOIN product as p on pm.product_id = p.id
+ LEFT JOIN sys_user as u on sor.create_user = u.user_id
+ <where>
+ <if test="params.timeStr != null and params.timeStr != ''">
+ and sor.create_time like concat('%',#{params.timeStr},'%')
+ </if>
+ <if test="params.productName != null and params.productName != ''">
+ and p.product_name like concat('%',#{params.productName},'%')
+ </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>
+ </where>
+ order by sor.id desc
+ </select>
+
</mapper>
--
Gitblit v1.9.3