2026-06-04 feb86efc4e8a8d2da00e4832bcd81825726617bf
src/main/resources/mapper/stock/StockUninventoryMapper.xml
@@ -25,7 +25,15 @@
            </if>
            update_time = now()
        </set>
        where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity}
        where
        product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity}
        <if test="ew.batchNo == null">
            and batch_no is null
        </if>
        <if test="ew.batchNo != null">
            and batch_no = #{ew.batchNo}
        </if>
    </update>
    <update id="updateAddStockUnInventory">
        update stock_uninventory
@@ -33,15 +41,27 @@
            <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,
            </if>
            <if test="ew.remark != null and ew.remark !=''">
                remark = #{ew.remark},
            </if>
            <if test="ew.warehouse != null and ew.warehouse !=''">
                warehouse = #{ew.warehouse},
            </if>
            update_time = now()
        </set>
        where product_model_id = #{ew.productModelId}
        <if test="ew.batchNo == null">
            and batch_no is null
        </if>
        <if test="ew.batchNo != null">
            and batch_no = #{ew.batchNo}
        </if>
    </update>
    <select id="pageStockUninventory" resultType="com.ruoyi.stock.dto.StockUninventoryDto">
        select su.id,
@@ -64,7 +84,7 @@
            and p.product_name like concat('%',#{ew.productName},'%')
        </if>
    </select>
    <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockInventoryExportData">
    <select id="listStockInventoryExportData" resultType="com.ruoyi.stock.execl.StockUnInventoryExportData">
        select su.*,
        pm.model,
        pm.unit,
@@ -78,4 +98,13 @@
        </if>
    </select>
    <select id="selectPendingOutQuantity" resultType="java.math.BigDecimal">
        SELECT IFNULL(SUM(sor.stock_out_num), 0)
        FROM stock_out_record sor
        WHERE sor.product_model_id = #{productModelId}
          AND (sor.batch_no = #{batchNo} OR (#{batchNo} IS NULL AND sor.batch_no IS NULL))
          AND sor.type = #{type}
          AND sor.approval_status = 0
    </select>
</mapper>