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

import com.xinelu.manage.domain.questionsubject.QuestionSubject;
import com.xinelu.manage.mapper.questionsubject.QuestionSubjectMapper;
import com.xinelu.manage.service.questionsubject.IQuestionSubjectService;
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 QuestionSubjectServiceImpl implements IQuestionSubjectService {
    @Resource
    private QuestionSubjectMapper questionSubjectMapper;

    /**
     * 查询问卷题目信息
     *
     * @param id 问卷题目信息主键
     * @return 问卷题目信息
     */
    @Override
    public QuestionSubject selectQuestionSubjectById(Long id) {
        return questionSubjectMapper.selectQuestionSubjectById(id);
    }

    /**
     * 查询问卷题目信息列表
     *
     * @param questionSubject 问卷题目信息
     * @return 问卷题目信息
     */
    @Override
    public List<QuestionSubject> selectQuestionSubjectList(QuestionSubject questionSubject) {
        return questionSubjectMapper.selectQuestionSubjectList(questionSubject);
    }

    /**
     * 新增问卷题目信息
     *
     * @param questionSubject 问卷题目信息
     * @return 结果
     */
    @Override
    public int insertQuestionSubject(QuestionSubject questionSubject) {
        questionSubject.setCreateTime(LocalDateTime.now());
        return questionSubjectMapper.insertQuestionSubject(questionSubject);
    }

    /**
     * 修改问卷题目信息
     *
     * @param questionSubject 问卷题目信息
     * @return 结果
     */
    @Override
    public int updateQuestionSubject(QuestionSubject questionSubject) {
        questionSubject.setUpdateTime(LocalDateTime.now());
        return questionSubjectMapper.updateQuestionSubject(questionSubject);
    }

    /**
     * 批量删除问卷题目信息
     *
     * @param ids 需要删除的问卷题目信息主键
     * @return 结果
     */
    @Override
    public int deleteQuestionSubjectByIds(Long[] ids) {
        return questionSubjectMapper.deleteQuestionSubjectByIds(ids);
    }

    /**
     * 删除问卷题目信息信息
     *
     * @param id 问卷题目信息主键
     * @return 结果
     */
    @Override
    public int deleteQuestionSubjectById(Long id) {
        return questionSubjectMapper.deleteQuestionSubjectById(id);
    }
}
