package com.ruoyi.learn.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.learn.mapper.LearnPaperMapper;
import com.ruoyi.learn.domain.LearnPaper;
import com.ruoyi.learn.service.ILearnPaperService;

/**
 * 试卷Service业务层处理
 *
 * @author ruoyi
 * @date 2025-09-18
 */
@Service
public class LearnPaperServiceImpl implements ILearnPaperService
{
    @Autowired
    private LearnPaperMapper learnPaperMapper;

    /**
     * 查询试卷
     *
     * @param id 试卷主键
     * @return 试卷
     */
    @Override
    public LearnPaper selectLearnPaperById(Long id)
    {
        return learnPaperMapper.selectLearnPaperById(id);
    }

    /**
     * 查询试卷列表
     *
     * @param learnPaper 试卷
     * @return 试卷
     */
    @Override
    public List<LearnPaper> selectLearnPaperList(LearnPaper learnPaper)
    {
        return learnPaperMapper.selectLearnPaperList(learnPaper);
    }

    @Override
    public List<LearnPaper> selectLearnPaperForExam(LearnPaper learnPaper)
    {
        return learnPaperMapper.selectLearnPaperForExam(learnPaper);
    }

    @Override
    public List<LearnPaper> selectPapersListFromFavorites(LearnPaper papers) {
        return learnPaperMapper.selectPapersListFromFavorites(papers);
    }

    /**
     * 新增试卷
     *
     * @param learnPaper 试卷
     * @return 结果
     */
    @Override
    public int insertLearnPaper(LearnPaper learnPaper)
    {
        learnPaper.setCreateTime(DateUtils.getNowDate());
        return learnPaperMapper.insertLearnPaper(learnPaper);
    }

    /**
     * 修改试卷
     *
     * @param learnPaper 试卷
     * @return 结果
     */
    @Override
    public int updateLearnPaper(LearnPaper learnPaper)
    {
        return learnPaperMapper.updateLearnPaper(learnPaper);
    }

    /**
     * 批量删除试卷
     *
     * @param ids 需要删除的试卷主键
     * @return 结果
     */
    @Override
    public int deleteLearnPaperByIds(Long[] ids)
    {
        return learnPaperMapper.deleteLearnPaperByIds(ids);
    }

    /**
     * 删除试卷信息
     *
     * @param id 试卷主键
     * @return 结果
     */
    @Override
    public int deleteLearnPaperById(Long id)
    {
        return learnPaperMapper.deleteLearnPaperById(id);
    }
}
