| | |
| | | package com.ruoyi.user.mapper; |
| | | |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import com.ruoyi.user.domain.AccountWarehouse; |
| | | |
| | | /** |
| | |
| | | public List<AccountWarehouse> selectWarehouseByUserId(Long userId); |
| | | |
| | | /** |
| | | * 按主键查询云仓库存(仅未删除行) |
| | | * |
| | | * 供进货前校验归属使用:取回行的 userId 与当前会员比对,防范水平越权。 |
| | | * |
| | | * @param id 云仓行主键 |
| | | * @return 云仓库存(不存在或已删除返回 null) |
| | | */ |
| | | public AccountWarehouse selectWarehouseById(@Param("id") Long id); |
| | | |
| | | /** |
| | | * 库存原子自增(进货入库) |
| | | * |
| | | * 用 SQL 内 `stock_qty = stock_qty + #{qty}` 自增,避免"读-改-写"竞态导致并发丢更新。 |
| | | * |
| | | * @param id 云仓行主键 |
| | | * @param qty 增加数量(正数) |
| | | * @return 影响行数 |
| | | */ |
| | | public int increaseStockQty(@Param("id") Long id, @Param("qty") Long qty); |
| | | |
| | | /** |
| | | * 新增云仓库存 |
| | | */ |
| | | public int insertWarehouse(AccountWarehouse accountWarehouse); |