package com.fs.course.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fs.course.domain.FsCoursePlaySourceConfig;
import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
import com.fs.course.service.IFsCoursePlaySourceConfigService;
import com.fs.course.utils.FsCoursePlaySourceConfigQuery;
import com.fs.course.vo.FsCoursePlaySourceConfigVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Map;

@Service
@Slf4j
public class FsCoursePlaySourceConfigServiceImpl extends ServiceImpl<FsCoursePlaySourceConfigMapper, FsCoursePlaySourceConfig>
        implements IFsCoursePlaySourceConfigService {

    /**
     * 查询点播配置列表
     */
    @Override
    public List<FsCoursePlaySourceConfigVO> selectCoursePlaySourceConfigVOListByMap(Map<String, Object> params) {
        return baseMapper.selectCoursePlaySourceConfigVOListByMap(params);
    }

    @Override
    public List<FsCoursePlaySourceConfig> selectByAppIds(List<String> miniAppList) {
        QueryWrapper<FsCoursePlaySourceConfig> queryWrapper = new QueryWrapper<FsCoursePlaySourceConfig>()
                .in("appid", miniAppList)
                .eq("is_del", 0);
        FsCoursePlaySourceConfigQuery.excludeBanned(queryWrapper);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public FsCoursePlaySourceConfig selectCoursePlaySourceConfigByAppId(String appId) {
        return baseMapper.selectCoursePlaySourceConfigByAppId(appId);
    }

    @Override
    public int updateCoursePlaySourceConfig(FsCoursePlaySourceConfig config) {
        return baseMapper.updateCoursePlaySourceConfig(config);
    }
}
