liyong
10 小时以前 1ca5584d7e3200a9af65a099bd26d3593e2ba702
src/main/resources/mapper/stock/StockInRecordMapper.xml
@@ -3,6 +3,17 @@
<mapper namespace="com.ruoyi.stock.mapper.StockInRecordMapper">
    <select id="listPage" resultType="com.ruoyi.stock.dto.StockInRecordDto">
        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
        sir.*,
        p.product_name as product_name,
@@ -25,6 +36,9 @@
            </if>
            <if test="params.recordType != null and params.recordType != ''">
                and sir.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 sir.id desc
@@ -56,4 +70,4 @@
        </where>
        order by sir.id desc
    </select>
</mapper>
</mapper>