2 天以前 5f73eb1fb9d04040fe6ba377d5ae582024429f2f
src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -122,6 +122,13 @@
        product_id,
        'combined' as stockType,
        (
        select sir.tank_no
        from stock_in_record sir
        where sir.product_model_id = combined.product_model_id
        order by sir.id desc
        limit 1
        ) as tank_no,
        (
        select sir.oil_product
        from stock_in_record sir
        where sir.product_model_id = combined.product_model_id
@@ -336,7 +343,15 @@
            unit,
            product_name,
            product_id,
            'combined' as stockType
            'combined' as stockType,
            (
            select sir.tank_no
            from stock_in_record sir
            where sir.product_model_id = combined.product_model_id
            and (sir.batch_no = combined.batch_no or (combined.batch_no is null and sir.batch_no is null))
            order by sir.id desc
            limit 1
            ) as tank_no
        from (
            select
            si.batch_no,
@@ -1126,7 +1141,7 @@
        product_name,
        product_id
        order by
        batch_no
        MAX(update_time) desc
    </select>
</mapper>