liujie
11 小时以前 fddf3d913d47f391f84f9e460cb76d427ef02c44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.ruoyi.user.mapper;
 
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.user.domain.AccountWarehouse;
 
/**
 * 会员云仓库存 数据层
 *
 * @author ruoyi
 */
public interface AccountWarehouseMapper
{
    /**
     * 根据会员ID查询云仓库存
     */
    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);
 
    /**
     * 修改云仓库存
     */
    public int updateWarehouse(AccountWarehouse accountWarehouse);
 
    /**
     * 批量逻辑删除云仓库存
     */
    public int deleteWarehouseByIds(Long[] ids);
}