package com.xinelu.manage.service.questionsubjectoption.impl;

import com.xinelu.manage.domain.questionsubjectoption.QuestionSubjectOption;
import com.xinelu.manage.mapper.questionsubjectoption.QuestionSubjectOptionMapper;
import com.xinelu.manage.service.questionsubjectoption.IQuestionSubjectOptionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;


/**
 * 问卷题目选项答案Service业务层处理
 *
 * @author xinelu
 * @date 2024-02-29
 */
@Service
public class QuestionSubjectOptionServiceImpl implements IQuestionSubjectOptionService {
    @Resource
    private QuestionSubjectOptionMapper questionSubjectOptionMapper;

    /**
     * 查询问卷题目选项答案
     *
     * @param id 问卷题目选项答案主键
     * @return 问卷题目选项答案
     */
    @Override
    public QuestionSubjectOption selectQuestionSubjectOptionById(Long id) {
        return questionSubjectOptionMapper.selectQuestionSubjectOptionById(id);
    }

    /**
     * 查询问卷题目选项答案列表
     *
     * @param questionSubjectOption 问卷题目选项答案
     * @return 问卷题目选项答案
     */
    @Override
    public List<QuestionSubjectOption> selectQuestionSubjectOptionList(QuestionSubjectOption questionSubjectOption) {
        return questionSubjectOptionMapper.selectQuestionSubjectOptionList(questionSubjectOption);
    }

    /**
     * 新增问卷题目选项答案
     *
     * @param questionSubjectOption 问卷题目选项答案
     * @return 结果
     */
    @Override
    public int insertQuestionSubjectOption(QuestionSubjectOption questionSubjectOption) {
        questionSubjectOption.setCreateTime(LocalDateTime.now());
        return questionSubjectOptionMapper.insertQuestionSubjectOption(questionSubjectOption);
    }

    /**
     * 修改问卷题目选项答案
     *
     * @param questionSubjectOption 问卷题目选项答案
     * @return 结果
     */
    @Override
    public int updateQuestionSubjectOption(QuestionSubjectOption questionSubjectOption) {
        questionSubjectOption.setUpdateTime(LocalDateTime.now());
        return questionSubjectOptionMapper.updateQuestionSubjectOption(questionSubjectOption);
    }

    /**
     * 批量删除问卷题目选项答案
     *
     * @param ids 需要删除的问卷题目选项答案主键
     * @return 结果
     */
    @Override
    public int deleteQuestionSubjectOptionByIds(Long[] ids) {
        return questionSubjectOptionMapper.deleteQuestionSubjectOptionByIds(ids);
    }

    /**
     * 删除问卷题目选项答案信息
     *
     * @param id 问卷题目选项答案主键
     * @return 结果
     */
    @Override
    public int deleteQuestionSubjectOptionById(Long id) {
        return questionSubjectOptionMapper.deleteQuestionSubjectOptionById(id);
    }
}
