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);
|
}
|
}
|