package com.fs.live.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fs.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.fs.live.mapper.LiveAnchorMapper;
import com.fs.live.domain.LiveAnchor;
import com.fs.live.service.ILiveAnchorService;

/**
 * 主播Service业务层处理
 * 
 * @author fs
 * @date 2025-01-17
 */
@Service
public class LiveAnchorServiceImpl extends ServiceImpl<LiveAnchorMapper, LiveAnchor> implements ILiveAnchorService
{

    /**
     * 查询主播
     * 
     * @param anchorId 主播主键
     * @return 主播
     */
    @Override
    public LiveAnchor selectLiveAnchorByAnchorId(Long anchorId)
    {
        return baseMapper.selectLiveAnchorByAnchorId(anchorId);
    }

    /**
     * 查询主播列表
     * 
     * @param liveAnchor 主播
     * @return 主播
     */
    @Override
    public List<LiveAnchor> selectLiveAnchorList(LiveAnchor liveAnchor)
    {
        return baseMapper.selectLiveAnchorList(liveAnchor);
    }

    /**
     * 新增主播
     * 
     * @param liveAnchor 主播
     * @return 结果
     */
    @Override
    public int insertLiveAnchor(LiveAnchor liveAnchor)
    {
        liveAnchor.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertLiveAnchor(liveAnchor);
    }

    /**
     * 修改主播
     * 
     * @param liveAnchor 主播
     * @return 结果
     */
    @Override
    public int updateLiveAnchor(LiveAnchor liveAnchor)
    {
        liveAnchor.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateLiveAnchor(liveAnchor);
    }

    /**
     * 批量删除主播
     * 
     * @param anchorIds 需要删除的主播主键
     * @return 结果
     */
    @Override
    public int deleteLiveAnchorByAnchorIds(Long[] anchorIds)
    {
        return baseMapper.deleteLiveAnchorByAnchorIds(anchorIds);
    }

    /**
     * 删除主播信息
     * 
     * @param anchorId 主播主键
     * @return 结果
     */
    @Override
    public int deleteLiveAnchorByAnchorId(Long anchorId)
    {
        return baseMapper.deleteLiveAnchorByAnchorId(anchorId);
    }
}
