src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml
@@ -110,6 +110,8 @@
    <select id="listConsumablesInventoryExportData" resultType="com.ruoyi.consumables.execl.ConsumablesInventoryExportData">
        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,
@@ -120,6 +122,21 @@
        from consumables_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 Consumables_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 Consumables_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},'%')