liding
2026-04-24 47cbc59169b787e8a5f9c6969e2a0259c06249ca
src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -84,7 +84,7 @@
        p.product_name,
        si.batch_no,
        si.customer,
        rp.product_name AS root_product_name,
        rp.product_type AS productScope,
        si.production_date
        FROM
        stock_inventory si
@@ -108,11 +108,15 @@
            <if test="ew.productScope != null and ew.productScope != ''">
                <choose>
                    <when test="ew.productScope == '成品'">
                        AND rp.product_name = '成品'
                        AND rp.product_type = '成品'
                    </when>
                    <otherwise>
                        AND rp.product_name != '成品'
                    </otherwise>
                    <when test="ew.productScope == '半成品'">
                        AND rp.product_type = '半成品'
                    </when>
                    <when test="ew.productScope == '原材料'">
                        AND (rp.product_type IS NULL
                        OR (rp.product_type != '成品' AND rp.product_type != '半成品'))
                    </when>
                </choose>
            </if>
        </where>