package com.dora.mapper;

import com.dora.entity.VideoCollectionItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 视频合集关联 Mapper
 */
@Mapper
public interface VideoCollectionItemMapper {

    /**
     * 根据合集ID查询视频列表
     */
    List<VideoCollectionItem> selectByCollectionId(@Param("collectionId") Long collectionId);

    /**
     * 根据视频ID查询所属合集
     */
    List<VideoCollectionItem> selectByVideoId(@Param("videoId") Long videoId);

    /**
     * 将视频添加到合集
     */
    int insert(VideoCollectionItem item);

    /**
     * 从合集中移除视频
     */
    int deleteByCollectionAndVideo(@Param("collectionId") Long collectionId, @Param("videoId") Long videoId);

    /**
     * 更新视频在合集中的排序
     */
    int updateSortOrder(@Param("id") Long id, @Param("sortOrder") Integer sortOrder);
}
