yanderong
4 天以前 7617d46abee2950b7336e3379f8c7a564939cb54
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
package com.ruoyi.account.mapper;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.account.api.model.TAppUserWhitelist;
import org.apache.ibatis.annotations.Param;
 
import java.math.BigDecimal;
 
/**
 * 白名单用户 Mapper
 */
public interface TAppUserWhitelistMapper extends BaseMapper<TAppUserWhitelist> {
 
    /**
     * 根据手机号查询未删除的白名单配置,避免已逻辑删除数据阻塞重新新增。
     *
     * @param phone 用户手机号
     * @return 未删除的白名单配置
     */
    TAppUserWhitelist selectValidByPhone(String phone);
 
    /**
     * 忽略逻辑删除条件更新白名单配置,用于编辑时显式恢复有效状态。
     *
     * @param whitelist 白名单配置
     * @return 更新行数
     */
    int updateByIdIgnoreLogic(TAppUserWhitelist whitelist);
 
    /**
     * 原子累加白名单用户余额(额度分配使用,不触碰逻辑删除标记与状态)
     *
     * @param id       白名单记录ID
     * @param amount   本次累加金额(元)
     * @param updateBy 操作人账号
     * @return 更新行数
     */
    int addBalance(@Param("id") Long id, @Param("amount") BigDecimal amount, @Param("updateBy") String updateBy);
 
    /**
     * 原子清零余额(账户模式切换回收专用:仅当余额>0时清零,返回受影响行数,天然幂等)
     */
    int clearBalance(@Param("id") Long id, @Param("updateBy") String updateBy);
}