package com.fs.course.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fs.course.domain.FsVideoResource;
import com.fs.course.mapper.FsVideoResourceMapper;
import com.fs.course.service.IFsVideoResourceService;
import com.fs.course.vo.FsVideoResourceVO;
import org.springframework.stereotype.Service;

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

@Service
public class FsVideoResourceServiceImpl extends ServiceImpl<FsVideoResourceMapper, FsVideoResource> implements IFsVideoResourceService {

    /**
     * 查询素材库列表
     *
     * @param params    参数
     * @return  list
     */
    @Override
    public List<FsVideoResourceVO> selectVideoResourceListByMap(Map<String, Object> params) {
        return baseMapper.selectVideoResourceListByMap(params);
    }

    /**
     * 通过fileKey查询数据信息
     *
     * @param fileKey
     * @return
     */
    @Override
    public FsVideoResource selectByFileKey(String fileKey) {
        FsVideoResource fsVideoResource = baseMapper.selectOne(new LambdaQueryWrapper<FsVideoResource>().eq(FsVideoResource::getFileKey, fileKey));
        return fsVideoResource;
    }
}
