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