Administrator
2024-01-31 742e0a8ec019ccb76f03fcc58859ed15e9264c4c
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
package com.dy.pipIrrSell.wallet;
 
import com.dy.pipIrrGlobal.daoSe.SeConsumeMapper;
import com.dy.pipIrrGlobal.daoSe.SeRefundMapper;
import com.dy.pipIrrGlobal.daoSe.SeWalletMapper;
import com.dy.pipIrrGlobal.daoSe.SeWalletRechargeMapper;
import com.dy.pipIrrGlobal.pojoSe.SeWallet;
import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge;
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 SeConsumeMapper seConsumeMapper;
 
    @Autowired
    private SeRefundMapper seRefundMapper;
 
    /**
     * 根据农户ID获取电子钱包对象
     * @param clientId
     * @return
     */
    public SeWallet getWalletByClientId(Long clientId) {
        return seWalletMapper.getWalletByClientId(clientId);
    }
 
    /**
     * 注册电子钱包账号
     * @param po 电子钱包实体类
     * @return 电子钱包ID
     */
    public Long addWallet(SeWallet po) {
        seWalletMapper.insert(po);
        return po.getId();
    }
 
    public Integer updateWallet(SeWallet po) {
        return seWalletMapper.updateByPrimaryKeySelective(po);
    }
 
    /**
     * 电子钱包充值
     * @param po
     * @return
     */
    public Long addRecharge(SeWalletRecharge po) {
        seWalletRechargeMapper.insert(po);
        return po.getId();
    }
 
}