7 天以前 1ab9810f6d12393ad042f620e298eea943f7ee4a
feat(stock): 更新库存查询以包含创建时间和排序

- 在 getByModelId 查询中添加 create_time 字段
- 为库存记录按创建时间升序排列
- 优化库存查询结果的数据结构
已修改1个文件
3 ■■■■ 文件已修改
src/main/resources/mapper/stock/StockInventoryMapper.xml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -514,7 +514,7 @@
    </select>
    <select id="getByModelId" resultType="com.ruoyi.stock.dto.StockInventoryDto">
        select si.id, si.batch_no, si.locked_quantity, (si.qualitity - IFNULL(sd.qualitity, 0)) as qualitity,
               p.product_name, pm.model, pm.unit
               p.product_name, pm.model, pm.unit,si.create_time
        from stock_inventory si
                 left join (
                    select spd.stock_inventory_id, sum(spd.quantity) as qualitity
@@ -535,6 +535,7 @@
                 left join product p on pm.product_id = p.id
        where si.product_model_id = #{productModelId}
        and si.qualitity > IFNULL(sd.qualitity, 0)
        order by si.create_time asc
    </select>
    <select id="getBatchNoQty" resultType="com.ruoyi.stock.dto.StockInventoryDto">