chenhj
2026-04-24 b5f260b2364fad1e74a7eb1f5985268056e3a9e7
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,
@@ -41,6 +52,9 @@
            <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
    </select>