package com.ruoyi.hezhi.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.hezhi.domain.TbTeacherCourse;
import com.ruoyi.hezhi.domain.vo.CourseCardVO;
import com.ruoyi.hezhi.mapper.TbTeacherCourseMapper;
import com.ruoyi.hezhi.service.ITbTeacherCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * 老师课程关联Service业务层处理
 *
 * @author ruoyi
 * @date 2024-09-14
 */
@Service
public class TbTeacherCourseServiceImpl implements ITbTeacherCourseService
{
    @Autowired
    private TbTeacherCourseMapper tbTeacherCourseMapper;

    /**
     * 查询老师课程关联
     *
     * @param teacherCourseId 老师课程关联主键
     * @return 老师课程关联
     */
    @Override
    public TbTeacherCourse selectTbTeacherCourseByTeacherCourseId(Long teacherCourseId)
    {
        return tbTeacherCourseMapper.selectTbTeacherCourseByTeacherCourseId(teacherCourseId);
    }

    /**
     * 查询老师课程关联列表
     *
     * @param tbTeacherCourse 老师课程关联
     * @return 老师课程关联
     */
    @Override
    public List<TbTeacherCourse> selectTbTeacherCourseList(TbTeacherCourse tbTeacherCourse)
    {
        return tbTeacherCourseMapper.selectTbTeacherCourseList(tbTeacherCourse);
    }

    /**
     * 新增老师课程关联
     *
     * @param tbTeacherCourse 老师课程关联
     * @return 结果
     */
    @Override
    public int insertTbTeacherCourse(TbTeacherCourse tbTeacherCourse)
    {
        tbTeacherCourse.setCreateTime(DateUtils.getNowDate());
        return tbTeacherCourseMapper.insertTbTeacherCourse(tbTeacherCourse);
    }

    /**
     * 修改老师课程关联
     *
     * @param tbTeacherCourse 老师课程关联
     * @return 结果
     */
    @Override
    public int updateTbTeacherCourse(TbTeacherCourse tbTeacherCourse)
    {
        tbTeacherCourse.setUpdateTime(DateUtils.getNowDate());
        return tbTeacherCourseMapper.updateTbTeacherCourse(tbTeacherCourse);
    }

    /**
     * 批量删除老师课程关联
     *
     * @param teacherCourseIds 需要删除的老师课程关联主键
     * @return 结果
     */
    @Override
    public int deleteTbTeacherCourseByTeacherCourseIds(Long[] teacherCourseIds)
    {
        return tbTeacherCourseMapper.deleteTbTeacherCourseByTeacherCourseIds(teacherCourseIds);
    }

    /**
     * 删除老师课程关联信息
     *
     * @param teacherCourseId 老师课程关联主键
     * @return 结果
     */
    @Override
    public int deleteTbTeacherCourseByTeacherCourseId(Long teacherCourseId)
    {
        return tbTeacherCourseMapper.deleteTbTeacherCourseByTeacherCourseId(teacherCourseId);
    }

    /**
     * 查询教师课程列表
     * @param teacherId 教师id
     * @param isSpeak 是否主讲（0-否，1-是）
     * @return
     */
    @Override
    public List<CourseCardVO> selectTeacherCourseList(Long teacherId, Integer isSpeak) {
        return tbTeacherCourseMapper.selectTeacherCourseList(teacherId,isSpeak);
    }
    /**
     * 查询课程下教师列表
     *
     * @param params 参数
     * @return ok
     */
    @Override
    public List<Map<String, Object>> getTeacherList(Map<String, Object> params) {
        return tbTeacherCourseMapper.getTeacherList(params);
    }
}
