package com.ruoyi.model.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.model.mapper.AnswerMapper;
import com.ruoyi.model.domain.Answer;
import com.ruoyi.model.service.IAnswerService;

/**
 * 选择题答案管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-05
 */
@Service
public class AnswerServiceImpl implements IAnswerService 
{
    @Autowired
    private AnswerMapper answerMapper;

    /**
     * 查询选择题答案管理
     * 
     * @param answerId 选择题答案管理主键
     * @return 选择题答案管理
     */
    @Override
    public Answer selectAnswerByAnswerId(Long answerId)
    {
        return answerMapper.selectAnswerByAnswerId(answerId);
    }

    /**
     * 查询选择题答案管理列表
     * 
     * @param answer 选择题答案管理
     * @return 选择题答案管理
     */
    @Override
    public List<Answer> selectAnswerList(Answer answer)
    {
        return answerMapper.selectAnswerList(answer);
    }

    /**
     * 新增选择题答案管理
     * 
     * @param answer 选择题答案管理
     * @return 结果
     */
    @Override
    public int insertAnswer(Answer answer)
    {
        answer.setCreateTime(DateUtils.getNowDate());
        return answerMapper.insertAnswer(answer);
    }

    /**
     * 修改选择题答案管理
     * 
     * @param answer 选择题答案管理
     * @return 结果
     */
    @Override
    public int updateAnswer(Answer answer)
    {
        answer.setUpdateTime(DateUtils.getNowDate());
        return answerMapper.updateAnswer(answer);
    }

    /**
     * 批量删除选择题答案管理
     * 
     * @param answerIds 需要删除的选择题答案管理主键
     * @return 结果
     */
    @Override
    public int deleteAnswerByAnswerIds(Long[] answerIds)
    {
        return answerMapper.deleteAnswerByAnswerIds(answerIds);
    }

    /**
     * 删除选择题答案管理信息
     * 
     * @param answerId 选择题答案管理主键
     * @return 结果
     */
    @Override
    public int deleteAnswerByAnswerId(Long answerId)
    {
        return answerMapper.deleteAnswerByAnswerId(answerId);
    }
}
