liyong
11 小时以前 1ca5584d7e3200a9af65a099bd26d3593e2ba702
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>