package com.hzs.system.config.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.common.core.constant.CacheConstants;
import com.hzs.common.core.service.RedisService;
import com.hzs.common.core.web.domain.AjaxResult;
import com.hzs.common.domain.system.config.BdBank;
import com.hzs.system.config.mapper.BdBankMapper;
import com.hzs.system.config.service.IBdBankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 银行卡表 服务实现类
 * </p>
 *
 * @author hzs
 * @since 2022-10-25
 */
@Service
public class BdBankServiceImpl extends ServiceImpl<BdBankMapper, BdBank> implements IBdBankService {

    @Autowired
    private RedisService redisService;

    @Override
    public BdBank getCurrency(Integer pkId) {
        BdBank bank = redisService.getCacheObject(CacheConstants.BD_BANK + pkId);
        if (bank == null){
            bank = baseMapper.selectById(pkId);
            if(bank != null){
                redisService.setCacheObject(CacheConstants.BD_BANK + pkId, bank);
            }
        }
        return bank;
    }
}
