package com.fs.course.service.impl;

import java.util.List;
import com.fs.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fs.course.mapper.FsUserCourseStudyLogMapper;
import com.fs.course.domain.FsUserCourseStudyLog;
import com.fs.course.service.IFsUserCourseStudyLogService;

/**
 * 课程用户学习日志Service业务层处理
 *
 * @author fs
 * @date 2024-05-15
 */
@Service
public class FsUserCourseStudyLogServiceImpl implements IFsUserCourseStudyLogService
{
    @Autowired
    private FsUserCourseStudyLogMapper fsUserCourseStudyLogMapper;

    /**
     * 查询课程用户学习日志
     *
     * @param logId 课程用户学习日志主键
     * @return 课程用户学习日志
     */
    @Override
    public FsUserCourseStudyLog selectFsUserCourseStudyLogByLogId(String logId)
    {
        return fsUserCourseStudyLogMapper.selectFsUserCourseStudyLogByLogId(logId);
    }

    /**
     * 查询课程用户学习日志列表
     *
     * @param fsUserCourseStudyLog 课程用户学习日志
     * @return 课程用户学习日志
     */
    @Override
    public List<FsUserCourseStudyLog> selectFsUserCourseStudyLogList(FsUserCourseStudyLog fsUserCourseStudyLog)
    {
        return fsUserCourseStudyLogMapper.selectFsUserCourseStudyLogList(fsUserCourseStudyLog);
    }

    /**
     * 新增课程用户学习日志
     *
     * @param fsUserCourseStudyLog 课程用户学习日志
     * @return 结果
     */
    @Override
    public int insertFsUserCourseStudyLog(FsUserCourseStudyLog fsUserCourseStudyLog)
    {
        fsUserCourseStudyLog.setCreateTime(DateUtils.getNowDate());
        return fsUserCourseStudyLogMapper.insertFsUserCourseStudyLog(fsUserCourseStudyLog);
    }

    /**
     * 修改课程用户学习日志
     *
     * @param fsUserCourseStudyLog 课程用户学习日志
     * @return 结果
     */
    @Override
    public int updateFsUserCourseStudyLog(FsUserCourseStudyLog fsUserCourseStudyLog)
    {
        return fsUserCourseStudyLogMapper.updateFsUserCourseStudyLog(fsUserCourseStudyLog);
    }

    /**
     * 批量删除课程用户学习日志
     *
     * @param logIds 需要删除的课程用户学习日志主键
     * @return 结果
     */
    @Override
    public int deleteFsUserCourseStudyLogByLogIds(String[] logIds)
    {
        return fsUserCourseStudyLogMapper.deleteFsUserCourseStudyLogByLogIds(logIds);
    }

    /**
     * 删除课程用户学习日志信息
     *
     * @param logId 课程用户学习日志主键
     * @return 结果
     */
    @Override
    public int deleteFsUserCourseStudyLogByLogId(String logId)
    {
        return fsUserCourseStudyLogMapper.deleteFsUserCourseStudyLogByLogId(logId);
    }

    @Override
    public FsUserCourseStudyLog selectFsUserCourseStudyByCourseId(Long courseId, long userId) {
        return fsUserCourseStudyLogMapper.selectFsUserCourseStudyLogByCourse(userId,courseId);
    }
}
