package com.fs.live.service.impl;


import com.fs.common.core.redis.RedisCache;
import com.fs.live.domain.LiveGift;
import com.fs.live.mapper.LiveGiftMapper;
import com.fs.live.service.ILiveGiftService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 直播间礼物配置Service业务层处理
 *
 * @author fs
 * @date 2025-07-08
 */
@Service
public class LiveGiftServiceImpl implements ILiveGiftService {

    @Autowired
    private RedisCache redisCache;
    @Autowired
    private LiveGiftMapper baseMapper;

//    @PostConstruct
//    public void init() {
//        loadGifts();
//    }
//
//    private void loadGifts() {
//        List<LiveGift> liveGifts = baseMapper.selectList(null);
//        redisCache.setCacheList("liveGift", liveGifts);
//    }

    /**
     * 查询直播间礼物配置
     *
     * @param giftId 直播间礼物配置主键
     * @return 直播间礼物配置
     */
    @Override
    public LiveGift selectLiveGiftByGiftId(Long giftId)
    {
        return baseMapper.selectLiveGiftByGiftId(giftId);
    }

    /**
     * 查询直播间礼物配置列表
     *
     * @param liveGift 直播间礼物配置
     * @return 直播间礼物配置
     */
    @Override
    public List<LiveGift> selectLiveGiftList(LiveGift liveGift)
    {
        return baseMapper.selectLiveGiftList(liveGift);
    }

    /**
     * 新增直播间礼物配置
     *
     * @param liveGift 直播间礼物配置
     * @return 结果
     */
    @Override
    public int insertLiveGift(LiveGift liveGift)
    {
        return baseMapper.insertLiveGift(liveGift);
    }

    /**
     * 修改直播间礼物配置
     *
     * @param liveGift 直播间礼物配置
     * @return 结果
     */
    @Override
    public int updateLiveGift(LiveGift liveGift)
    {
        return baseMapper.updateLiveGift(liveGift);
    }

    /**
     * 批量删除直播间礼物配置
     *
     * @param giftIds 需要删除的直播间礼物配置主键
     * @return 结果
     */
    @Override
    public int deleteLiveGiftByGiftIds(Long[] giftIds)
    {
        return baseMapper.deleteLiveGiftByGiftIds(giftIds);
    }

    /**
     * 删除直播间礼物配置信息
     *
     * @param giftId 直播间礼物配置主键
     * @return 结果
     */
    @Override
    public int deleteLiveGiftByGiftId(Long giftId)
    {
        return baseMapper.deleteLiveGiftByGiftId(giftId);
    }
}
