gongchunyi
2026-06-29 743b74dfa59b05cb4bafe8678d8a6223a283ad03
src/main/resources/mapper/stock/StockInRecordMapper.xml
@@ -34,6 +34,16 @@
            <if test="params.productName != null and params.productName != ''">
                and p.product_name like concat('%',#{params.productName},'%')
            </if>
            <if test="params.topParentProductId != null and params.topParentProductId > 0">
                and p.id in (
                    WITH RECURSIVE product_tree AS (
                        SELECT id FROM product WHERE id = #{params.topParentProductId}
                        UNION ALL
                        SELECT p2.id FROM product p2 INNER JOIN product_tree pt ON p2.parent_id = pt.id
                    )
                    SELECT id FROM product_tree
                )
            </if>
            <if test="params.salesContractNo != null and params.salesContractNo != ''">
                and (
                    (sir.record_type IN ('6', '7', '18', '19', '20') and pl.purchase_contract_number like concat('%',#{params.salesContractNo},'%'))
@@ -48,7 +58,7 @@
                and sir.record_type = #{params.recordType}
            </if>
        </where>
        order by sir.id desc
        order by sir.inbound_batches desc
    </select>
    <select id="listStockInRecordExportData" resultType="com.ruoyi.stock.execl.StockInRecordExportData">
        SELECT
@@ -82,6 +92,16 @@
            <if test="params.productName != null and params.productName != ''">
                and p.product_name like concat('%',#{params.productName},'%')
            </if>
            <if test="params.topParentProductId != null and params.topParentProductId > 0">
                and p.id in (
                    WITH RECURSIVE product_tree AS (
                        SELECT id FROM product WHERE id = #{params.topParentProductId}
                        UNION ALL
                        SELECT p2.id FROM product p2 INNER JOIN product_tree pt ON p2.parent_id = pt.id
                    )
                    SELECT id FROM product_tree
                )
            </if>
            <if test="params.salesContractNo != null and params.salesContractNo != ''">
                and (
                    (sir.record_type IN ('6', '7', '18', '19', '20') and pl.purchase_contract_number like concat('%',#{params.salesContractNo},'%'))