src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -102,6 +102,8 @@
    <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
        select si.qualitity,
        -- 当前净重 = 入库净重 - 出库净重
        (COALESCE(sir.total_net_weight, 0) - COALESCE(sor.total_net_weight, 0)) AS net_weight,-
        pm.model,
        pm.unit,
        p.product_name,
@@ -112,6 +114,16 @@
        from stock_inventory si
        left join product_model pm on si.product_model_id = pm.id
        left join product p on pm.product_id = p.id
        LEFT JOIN (
        SELECT product_model_id, SUM(net_weight) AS total_net_weight
        FROM stock_in_record
        GROUP BY product_model_id
        ) sir ON si.product_model_id = sir.product_model_id
        LEFT JOIN (
        SELECT product_model_id, SUM(net_weight) AS total_net_weight
        FROM stock_out_record
        GROUP BY product_model_id
        ) sor ON si.product_model_id = sor.product_model_id
        where 1 = 1
        <if test="ew.productName != null and ew.productName !=''">
            and p.product_name like concat('%',#{ew.productName},'%')