huminmin
2026-06-22 bdaeaa452c0a17c045467578502867e6fa245dd4
src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -12,6 +12,9 @@
        <result column="version" property="version"/>
        <result column="locked_quantity" property="lockedQuantity"/>
        <result column="warn_num" property="warnNum"/>
        <result column="manufacturer_id" property="manufacturerId"/>
        <result column="source" property="source"/>
        <result column="supplier_id" property="supplierId"/>
    </resultMap>
    <update id="updateAddStockInventory">
        update stock_inventory
@@ -30,6 +33,15 @@
            </if>
            <if test="ew.lockedQuantity != null and ew.lockedQuantity !=''">
                locked_quantity = locked_quantity + #{ew.lockedQuantity},
            </if>
            <if test="ew.source != null and ew.source != ''">
                source = #{ew.source},
            </if>
            <if test="ew.manufacturerId != null">
                manufacturer_id = #{ew.manufacturerId},
            </if>
            <if test="ew.supplierId != null">
                supplier_id = #{ew.supplierId},
            </if>
            update_time = now()
        </set>
@@ -72,6 +84,9 @@
        si.update_time,
        COALESCE(si.warn_num, 0) as warn_num,
        si.version,
        si.source,
        si.manufacturer_id,
        si.supplier_id,
        (si.qualitity - COALESCE(si.locked_quantity, 0)) as un_locked_quantity,
        pm.model,
        si.remark,
@@ -115,6 +130,7 @@
        MAX(update_time) as update_time,
        MAX(warn_num) as warn_num,
        MAX(version) as version,
        MAX(supplier_id) as supplier_id,
        model,
        MAX(remark) as remark,
        unit,
@@ -136,6 +152,7 @@
        si.update_time,
        COALESCE(si.warn_num, 0) as warn_num,
        si.version,
        si.supplier_id,
        (si.qualitity - COALESCE(si.locked_quantity, 0)) as un_locked_quantity,
        pm.model,
        si.remark,
@@ -174,6 +191,7 @@
        su.update_time,
        0 as warn_num,
        su.version,
        null as supplier_id,
        (su.qualitity - COALESCE(su.locked_quantity, 0)) as un_locked_quantity,
        pm.model,
        su.remark,
@@ -195,6 +213,7 @@
        from stock_uninventory su
        left join product_model pm on su.product_model_id = pm.id
        left join product p on pm.product_id = p.id
        where COALESCE(su.type, 'unqualified') != 'waste'
        ) as combined
        <where>
            <if test="ew.productName != null and ew.productName !=''">
@@ -222,7 +241,7 @@
        unit,
        product_name,
        product_id
        order by combined.id desc
        order by MAX(create_time) desc
    </select>
    <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
@@ -328,6 +347,7 @@
            from stock_uninventory su
            left join product_model pm on su.product_model_id = pm.id
            left join product p on pm.product_id = p.id
            where COALESCE(su.type, 'unqualified') != 'waste'
        ) as combined
        <where>
            <if test="ew.productName != null and ew.productName !=''">
@@ -562,6 +582,12 @@
        unit,
        product_name,
        product_id,
        MAX(manufacturer_id) as manufacturer_id,
        MAX(supplier_id) as supplier_id,
        MAX(manufacturer_name) as manufacturerName,
        MAX(supplier_name) as supplierName,
        MAX(qualifiedSource) as qualifiedSource,
        MAX(unQualifiedSource) as unQualifiedSource,
        MAX(create_time) as create_time,
        MAX(update_time) as update_time,
@@ -587,6 +613,12 @@
        pm.unit,
        p.product_name,
        p.id as product_id,
        si.manufacturer_id,
        si.supplier_id,
        m.name as manufacturer_name,
        sm.supplier_name as supplier_name,
        si.source as qualifiedSource,
        null as unQualifiedSource,
        si.create_time,
        si.update_time,
@@ -610,6 +642,8 @@
        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 manufacturer m on si.manufacturer_id = m.id
        left join supplier_manage sm on si.supplier_id = sm.id
        union all
@@ -629,6 +663,12 @@
        pm.unit,
        p.product_name,
        p.id as product_id,
        null as manufacturer_id,
        null as supplier_id,
        null as manufacturer_name,
        null as supplier_name,
        null as qualifiedSource,
        su.source as unQualifiedSource,
        su.create_time,
        su.update_time,
@@ -668,7 +708,11 @@
        model,
        unit,
        product_name,
        product_id
        product_id,
        manufacturer_id,
        supplier_id,
        manufacturer_name,
        supplier_name
        order by
        batch_no
    </select>