package com.fs.course.service.impl;

import com.fs.common.utils.DateUtils;
import com.fs.course.domain.FsCourseAnswerLogs;
import com.fs.course.mapper.FsCourseAnswerLogsMapper;
import com.fs.course.param.FsCourseAnswerLogsParam;
import com.fs.course.service.IFsCourseAnswerLogsService;
import com.fs.course.vo.FsCourseAnswerLogsListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * 答题日志Service业务层处理
 *
 * @author fs
 * @date 2024-10-26
 */
@Service
public class FsCourseAnswerLogsServiceImpl implements IFsCourseAnswerLogsService
{
    @Autowired
    private FsCourseAnswerLogsMapper fsCourseAnswerLogsMapper;

    /**
     * 查询答题日志
     *
     * @param logId 答题日志主键
     * @return 答题日志
     */
    @Override
    public FsCourseAnswerLogs selectFsCourseAnswerLogsByLogId(Long logId)
    {
        return fsCourseAnswerLogsMapper.selectFsCourseAnswerLogsByLogId(logId);
    }

    /**
     * 查询答题日志列表
     *
     * @param fsCourseAnswerLogs 答题日志
     * @return 答题日志
     */
    @Override
    public List<FsCourseAnswerLogs> selectFsCourseAnswerLogsList(FsCourseAnswerLogs fsCourseAnswerLogs)
    {
        return fsCourseAnswerLogsMapper.selectFsCourseAnswerLogsList(fsCourseAnswerLogs);
    }

    @Override
    public List<FsCourseAnswerLogsListVO> selectFsCourseAnswerLogsListVO(FsCourseAnswerLogsParam param) {
        return fsCourseAnswerLogsMapper.selectFsCourseAnswerLogsListVO(param);
    }

    /**
     * 新增答题日志
     *
     * @param fsCourseAnswerLogs 答题日志
     * @return 结果
     */
    @Override
    public int insertFsCourseAnswerLogs(FsCourseAnswerLogs fsCourseAnswerLogs)
    {
        fsCourseAnswerLogs.setCreateTime(DateUtils.getNowDate());
        return fsCourseAnswerLogsMapper.insertFsCourseAnswerLogs(fsCourseAnswerLogs);
    }

    /**
     * 修改答题日志
     *
     * @param fsCourseAnswerLogs 答题日志
     * @return 结果
     */
    @Override
    public int updateFsCourseAnswerLogs(FsCourseAnswerLogs fsCourseAnswerLogs)
    {
        return fsCourseAnswerLogsMapper.updateFsCourseAnswerLogs(fsCourseAnswerLogs);
    }

    /**
     * 批量删除答题日志
     *
     * @param logIds 需要删除的答题日志主键
     * @return 结果
     */
    @Override
    public int deleteFsCourseAnswerLogsByLogIds(Long[] logIds)
    {
        return fsCourseAnswerLogsMapper.deleteFsCourseAnswerLogsByLogIds(logIds);
    }

    /**
     * 删除答题日志信息
     *
     * @param logId 答题日志主键
     * @return 结果
     */
    @Override
    public int deleteFsCourseAnswerLogsByLogId(Long logId)
    {
        return fsCourseAnswerLogsMapper.deleteFsCourseAnswerLogsByLogId(logId);
    }
}
