gongchunyi
10 小时以前 8352c314f8a15a5caf6dfa2837562f839eeef6c3
src/main/resources/mapper/stock/StockUninventoryMapper.xml
@@ -25,13 +25,17 @@
            </if>
            update_time = now()
        </set>
        where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity}
        where product_model_id = #{ew.productModelId}
          and (qualitity - COALESCE(locked_quantity, 0)) >= #{ew.qualitity}
    </update>
    <update id="updateAddStockUnInventory">
        update stock_uninventory
        <set>
            <if test="ew.qualitity != null">
                qualitity = qualitity + #{ew.qualitity},
            </if>
            <if test="ew.lockedQuantity != null">
                locked_quantity = locked_quantity + #{ew.lockedQuantity},
            </if>
            <if test="ew.version != null">
                version = version + 1,
@@ -55,6 +59,7 @@
        (su.qualitity - COALESCE(su.locked_quantity, 0)) as un_locked_quantity,
        pm.model,
        pm.unit,
        pm.thickness,
        p.product_name
        from stock_uninventory su
        left join product_model pm on su.product_model_id = pm.id