package com.fs.live.mapper;


import com.fs.live.domain.LiveVideo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 直播视频Mapper接口
 *
 * @author fs
 * @date 2025-01-17
 */
public interface LiveVideoMapper
{
    /**
     * 查询直播视频
     *
     * @param videoId 直播视频主键
     * @return 直播视频
     */
    public LiveVideo selectLiveVideoByVideoId(Long videoId);

    /**
     * 查询企业直播视频
     * @param videoId           视频ID
     * @param companyId         企业ID
     * @param companyUserId     企业用户ID
     * @return LiveVideo
     */
    LiveVideo selectLiveVideoByVideoIdAndCompanyIdAndCompanyUserId(@Param("videoId") Long videoId, @Param("companyId") Long companyId, @Param("companyUserId") Long companyUserId);

    /**
     * 查询直播视频列表
     *
     * @param liveVideo 直播视频
     * @return 直播视频集合
     */
    public List<LiveVideo> selectLiveVideoList(LiveVideo liveVideo);

    /**
     * 新增直播视频
     *
     * @param liveVideo 直播视频
     * @return 结果
     */
    public int insertLiveVideo(LiveVideo liveVideo);

    /**
     * 修改直播视频
     *
     * @param liveVideo 直播视频
     * @return 结果
     */
    public int updateLiveVideo(LiveVideo liveVideo);

    /**
     * 删除直播视频
     *
     * @param videoId 直播视频主键
     * @return 结果
     */
    public int deleteLiveVideoByVideoId(Long videoId);

    /**
     * 批量删除直播视频
     *
     * @param videoIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteLiveVideoByVideoIds(Long[] videoIds);

    @Select("select * from live_video where live_id = #{liveId} and video_type in (#{type},2)")
    List<LiveVideo> selectByIdAndType(@Param("liveId") Long liveId,@Param("type") Integer type);

    @Select("select * from live_video where live_id = #{liveId} limit 1")
    LiveVideo selectOne(@Param("liveId") Long liveId);

    @Select("select * from live_video where live_id = #{liveId}")
    List<LiveVideo> selectByLiveId(@Param("liveId")Long liveId);

    @Select("select * from live_video where live_id = #{liveId} and video_type = #{videoType}")
    List<LiveVideo> selectByLiveIdAndType(@Param("liveId")Long liveId,@Param("videoType") Integer videoType);

    @Select("select * from live_video where live_id = #{liveId}")
    List<LiveVideo> selectLiveVideosByLiveId(@Param("liveId") Long liveId);

    @Select("select * from live_video")
    List<LiveVideo> selectByAll();
}
