package com.fs.live.service.impl;


import com.fs.common.utils.DateUtils;
import com.fs.live.domain.LiveUserRedRecord;
import com.fs.live.mapper.LiveUserRedRecordMapper;
import com.fs.live.service.ILiveUserRedRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 直播用户红包记录Service业务层处理
 *
 * @author fs
 * @date 2025-07-17
 */
@Service
public class LiveUserRedRecordServiceImpl implements ILiveUserRedRecordService {
    @Autowired
    private LiveUserRedRecordMapper baseMapper;

    /**
     * 查询直播用户红包记录
     *
     * @param id 直播用户红包记录主键
     * @return 直播用户红包记录
     */
    @Override
    public LiveUserRedRecord selectLiveUserRedRecordById(Long id)
    {
        return baseMapper.selectLiveUserRedRecordById(id);
    }

    /**
     * 查询直播用户红包记录列表
     *
     * @param liveUserRedRecord 直播用户红包记录
     * @return 直播用户红包记录
     */
    @Override
    public List<LiveUserRedRecord> selectLiveUserRedRecordList(LiveUserRedRecord liveUserRedRecord)
    {
        return baseMapper.selectLiveUserRedRecordList(liveUserRedRecord);
    }

    /**
     * 新增直播用户红包记录
     *
     * @param liveUserRedRecord 直播用户红包记录
     * @return 结果
     */
    @Override
    public int insertLiveUserRedRecord(LiveUserRedRecord liveUserRedRecord)
    {
        liveUserRedRecord.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertLiveUserRedRecord(liveUserRedRecord);
    }

    /**
     * 修改直播用户红包记录
     *
     * @param liveUserRedRecord 直播用户红包记录
     * @return 结果
     */
    @Override
    public int updateLiveUserRedRecord(LiveUserRedRecord liveUserRedRecord)
    {
        return baseMapper.updateLiveUserRedRecord(liveUserRedRecord);
    }

    /**
     * 批量删除直播用户红包记录
     *
     * @param ids 需要删除的直播用户红包记录主键
     * @return 结果
     */
    @Override
    public int deleteLiveUserRedRecordByIds(Long[] ids)
    {
        return baseMapper.deleteLiveUserRedRecordByIds(ids);
    }

    /**
     * 删除直播用户红包记录信息
     *
     * @param id 直播用户红包记录主键
     * @return 结果
     */
    @Override
    public int deleteLiveUserRedRecordById(Long id)
    {
        return baseMapper.deleteLiveUserRedRecordById(id);
    }

    @Override
    public boolean existsByUserIdAndRedId(Long redId, String userId) {
        return baseMapper.existsByUserIdAndRedId(redId,userId);
    }
}
