package com.fs.course.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fs.course.domain.FsDepVideoShow;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 部门视频疗包展示关联Mapper接口
 * 
 * @author fs
 * @date 2025-10-11
 */
public interface FsDepVideoShowMapper extends BaseMapper<FsDepVideoShow>{
    /**
     * 部门视频疗包展示关联
     * 
     * @param videoId, depId  部门视频疗包展示关联主键
     * @return 部门视频疗包展示关联
     */
    @Select("<script>" +
            "SELECT is_show FROM fs_dep_video_show WHERE video_id = #{videoId}" +
            "<if test='depId != null'> AND dep_id = #{depId}</if>" +
            "</script>")
    String selectFsDepVideoShowByVideoId(@Param("videoId")Long videoId,@Param("depId") Long depId);

    @Select("SELECT is_show FROM fs_dep_video_show WHERE video_id = #{videoId}")
    String searchAllByVideoIdString(Long videoId);
    /**
     * 增加部门视频疗包展示关联
     *
     * @param fsDepVideoShow 部门视频疗包展示关联主键
     * @return 部门视频疗包展示关联
     */
    @Insert("INSERT INTO fs_dep_video_show(video_id, is_show, dep_id) VALUES(#{videoId}, #{isShow}, #{depId})")
    int insertFsDepVideoShowByVideoId(FsDepVideoShow fsDepVideoShow);

    @Update("UPDATE fs_dep_video_show SET is_show = #{isShow} WHERE video_id = #{videoId} AND dep_id = #{depId}")
    int updateByVideoId(FsDepVideoShow fsDepVideoShow);

}
