package com.fs.live.service.impl;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import com.fs.common.utils.DateUtils;

import com.fs.live.vo.LiveUserFirstProfit;
import com.fs.live.vo.LiveUserEntryDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.live.mapper.LiveUserFirstEntryMapper;
import com.fs.live.domain.LiveUserFirstEntry;
import com.fs.live.service.ILiveUserFirstEntryService;

/**
 * 用户每日首次进入直播间记录Service业务层处理
 *
 * @author fs
 * @date 2025-09-04
 */
@Service
public class LiveUserFirstEntryServiceImpl implements ILiveUserFirstEntryService {
    @Autowired
    private LiveUserFirstEntryMapper baseMapper;

    /**
     * 查询用户每日首次进入直播间记录
     *
     * @param id 用户每日首次进入直播间记录主键
     * @return 用户每日首次进入直播间记录
     */
    @Override
    public LiveUserFirstEntry selectLiveUserFirstEntryById(Long id)
    {
        return baseMapper.selectLiveUserFirstEntryById(id);
    }

    /**
     * 查询用户每日首次进入直播间记录列表
     *
     * @param liveUserFirstEntry 用户每日首次进入直播间记录
     * @return 用户每日首次进入直播间记录
     */
    @Override
    public List<LiveUserFirstEntry> selectLiveUserFirstEntryList(LiveUserFirstEntry liveUserFirstEntry)
    {
        return baseMapper.selectLiveUserFirstEntryList(liveUserFirstEntry);
    }

    /**
     * 新增用户每日首次进入直播间记录
     *
     * @param liveUserFirstEntry 用户每日首次进入直播间记录
     * @return 结果
     */
    @Override
    public int insertLiveUserFirstEntry(LiveUserFirstEntry liveUserFirstEntry)
    {
        liveUserFirstEntry.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertLiveUserFirstEntry(liveUserFirstEntry);
    }

    /**
     * 修改用户每日首次进入直播间记录
     *
     * @param liveUserFirstEntry 用户每日首次进入直播间记录
     * @return 结果
     */
    @Override
    public int updateLiveUserFirstEntry(LiveUserFirstEntry liveUserFirstEntry)
    {
        liveUserFirstEntry.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateLiveUserFirstEntry(liveUserFirstEntry);
    }

    /**
     * 批量删除用户每日首次进入直播间记录
     *
     * @param ids 需要删除的用户每日首次进入直播间记录主键
     * @return 结果
     */
    @Override
    public int deleteLiveUserFirstEntryByIds(Long[] ids)
    {
        return baseMapper.deleteLiveUserFirstEntryByIds(ids);
    }

    /**
     * 删除用户每日首次进入直播间记录信息
     *
     * @param id 用户每日首次进入直播间记录主键
     * @return 结果
     */
    @Override
    public int deleteLiveUserFirstEntryById(Long id)
    {
        return baseMapper.deleteLiveUserFirstEntryById(id);
    }

    @Override
    public int selectTodayEntry(long userId) {
        Date now = DateUtils.getNowDate();
        return baseMapper.selectTodayEntry(userId, now);
    }

    @Override
    public List<LiveUserFirstProfit> selectLiveProfitList(LiveUserFirstProfit liveUserFirstProfit) {
        return baseMapper.selectLiveProfitList(liveUserFirstProfit);
    }

    @Override
    public LiveUserFirstEntry selectEntityByLiveIdUserId(long liveId,long userId) {
        return baseMapper.selectEntityByLiveIdUserId(liveId, userId);
    }

    @Override
    public List<LiveUserEntryDetail> selectLiveUserEntryDetailList(Long liveId, Long companyUserId) {
        return baseMapper.selectLiveUserEntryDetailList(liveId, companyUserId);
    }
}
