Administrator
2023-12-29 9e095f66c1547e4af8a0b21e2276187cd5d4b2a0
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package com.dy.pipIrrSell.wallet;
 
import com.dy.pipIrrGlobal.daoSe.SeWalletMapper;
import com.dy.pipIrrGlobal.daoSe.SeWalletRechargeHistoryMapper;
import com.dy.pipIrrGlobal.daoSe.SeWalletRechargeMapper;
import com.dy.pipIrrGlobal.pojoSe.SeWallet;
import com.dy.pipIrrGlobal.pojoSe.SeWalletRechargeHistory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
/**
 * @author ZhuBaoMin
 * @date 2023/12/11 16:36
 * @LastEditTime 2023/12/11 16:36
 * @Description
 */
 
@Slf4j
@Service
public class WalletSv {
    @Autowired
    private SeWalletMapper seWalletMapper;
 
    @Autowired
    private SeWalletRechargeMapper seWalletRechargeMapper;
 
    @Autowired
    private SeWalletRechargeHistoryMapper seWalletRechargeHistoryMapper;
 
    /**
     * 注册电子钱包账号
     * @param po
     * @return
     */
    public Integer add(SeWallet po) {
        return seWalletMapper.insert(po);
    }
 
    /**
     * 根据编号从钱包表中获取该钱包余额
     * @param id
     * @return
     */
    public Float getMoneyById(Long id) {
        SeWallet po = seWalletMapper.selectByPrimaryKey(id);
        return po.getMoney();
    }
 
    /**
     * 根据钱包编号修改钱包余额
     * @param id 钱包编号(主键)
     * @param money 钱包余额
     * @return 修改记录数量
     */
    public Integer updateMoneyById(Long id, Float money) {
        SeWallet po = seWalletMapper.selectByPrimaryKey(id);
        po.setMoney(money);
        return seWalletMapper.updateByPrimaryKey(po);
    }
 
    /**
     * 根据id删除充值记录
     * @param id
     * @return
     */
    public Integer deleteWallerRechargeById(Long id) {
        return seWalletMapper.deleteByPrimaryKey(id);
    }
 
    /**
     * 将充值记录添加到充值历史表
     * @param po 充值历史实体
     * @return
     */
    public Integer addWallerRechargeHistory(SeWalletRechargeHistory po) {
        return seWalletRechargeHistoryMapper.insert(po);
    }
}