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.LearnAnswerMapper;
import com.ruoyi.learn.domain.LearnAnswer;
import com.ruoyi.learn.service.ILearnAnswerService;

/**
 * 答卷答案Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-25
 */
@Service
public class LearnAnswerServiceImpl implements ILearnAnswerService 
{
    @Autowired
    private LearnAnswerMapper learnAnswerMapper;

    /**
     * 查询答卷答案
     * 
     * @param answerId 答卷答案主键
     * @return 答卷答案
     */
    @Override
    public LearnAnswer selectLearnAnswerByAnswerId(Long answerId)
    {
        return learnAnswerMapper.selectLearnAnswerByAnswerId(answerId);
    }

    /**
     * 查询答卷答案列表
     * 
     * @param learnAnswer 答卷答案
     * @return 答卷答案
     */
    @Override
    public List<LearnAnswer> selectLearnAnswerList(LearnAnswer learnAnswer)
    {
        return learnAnswerMapper.selectLearnAnswerList(learnAnswer);
    }

    /**
     * 新增答卷答案
     * 
     * @param learnAnswer 答卷答案
     * @return 结果
     */
    @Override
    public int insertLearnAnswer(LearnAnswer learnAnswer)
    {
        learnAnswer.setCreateTime(DateUtils.getNowDate());
        return learnAnswerMapper.insertLearnAnswer(learnAnswer);
    }

    /**
     * 修改答卷答案
     * 
     * @param learnAnswer 答卷答案
     * @return 结果
     */
    @Override
    public int updateLearnAnswer(LearnAnswer learnAnswer)
    {
        learnAnswer.setUpdateTime(DateUtils.getNowDate());
        return learnAnswerMapper.updateLearnAnswer(learnAnswer);
    }

    /**
     * 批量删除答卷答案
     * 
     * @param answerIds 需要删除的答卷答案主键
     * @return 结果
     */
    @Override
    public int deleteLearnAnswerByAnswerIds(Long[] answerIds)
    {
        return learnAnswerMapper.deleteLearnAnswerByAnswerIds(answerIds);
    }

    /**
     * 删除答卷答案信息
     * 
     * @param answerId 答卷答案主键
     * @return 结果
     */
    @Override
    public int deleteLearnAnswerByAnswerId(Long answerId)
    {
        return learnAnswerMapper.deleteLearnAnswerByAnswerId(answerId);
    }
}
