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.LearnTestPaperMapper;
import com.ruoyi.learn.domain.LearnTestPaper;
import com.ruoyi.learn.service.ILearnTestPaperService;

/**
 * 批次测试卷Service业务层处理
 *
 * @author ruoyi
 * @date 2025-09-18
 */
@Service
public class LearnTestPaperServiceImpl implements ILearnTestPaperService
{
    @Autowired
    private LearnTestPaperMapper learnTestPaperMapper;

    /**
     * 查询批次测试卷
     *
     * @param id 批次测试卷主键
     * @return 批次测试卷
     */
    @Override
    public LearnTestPaper selectLearnTestPaperById(Long id)
    {
        return learnTestPaperMapper.selectLearnTestPaperById(id);
    }

    @Override
    public LearnTestPaper selectLearnTestPaperByPaperId(Long paperId) {
        return learnTestPaperMapper.selectLearnTestPaperByPaperId(paperId);
    }

    /**
     * 查询批次测试卷列表
     *
     * @param learnTestPaper 批次测试卷
     * @return 批次测试卷
     */
    @Override
    public List<LearnTestPaper> selectLearnTestPaperList(LearnTestPaper learnTestPaper)
    {
        return learnTestPaperMapper.selectLearnTestPaperList(learnTestPaper);
    }

    /**
     * 新增批次测试卷
     *
     * @param learnTestPaper 批次测试卷
     * @return 结果
     */
    @Override
    public int insertLearnTestPaper(LearnTestPaper learnTestPaper)
    {
        learnTestPaper.setCreateTime(DateUtils.getNowDate());
        return learnTestPaperMapper.insertLearnTestPaper(learnTestPaper);
    }

    /**
     * 修改批次测试卷
     *
     * @param learnTestPaper 批次测试卷
     * @return 结果
     */
    @Override
    public int updateLearnTestPaper(LearnTestPaper learnTestPaper)
    {
        return learnTestPaperMapper.updateLearnTestPaper(learnTestPaper);
    }

    /**
     * 批量删除批次测试卷
     *
     * @param ids 需要删除的批次测试卷主键
     * @return 结果
     */
    @Override
    public int deleteLearnTestPaperByIds(String[] ids)
    {
        return learnTestPaperMapper.deleteLearnTestPaperByIds(ids);
    }

    /**
     * 删除批次测试卷信息
     *
     * @param id 批次测试卷主键
     * @return 结果
     */
    @Override
    public int deleteLearnTestPaperById(String id)
    {
        return learnTestPaperMapper.deleteLearnTestPaperById(id);
    }
}
