AnsweringQuestionServiceImpl.java 1.59 KB
package com.subsidy.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.GetCourseQuestionDTO;
import com.subsidy.model.AnsweringQuestionDO;
import com.subsidy.mapper.AnsweringQuestionMapper;
import com.subsidy.service.AnsweringQuestionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 问题答疑表 服务实现类
 * </p>
 *
 * @author DengMin
 * @since 2021-10-14
 */
@Service
public class AnsweringQuestionServiceImpl extends ServiceImpl<AnsweringQuestionMapper, AnsweringQuestionDO> implements AnsweringQuestionService {


    public IPage getCourseQuestion(GetCourseQuestionDTO getCourseQuestionDTO) {
        Page pager = new Page(getCourseQuestionDTO.getPageNum(), getCourseQuestionDTO.getPageSize());
        return this.baseMapper.getCourseQuestion(pager, getCourseQuestionDTO.getClassId(), getCourseQuestionDTO.getMemberId());
    }

    public String addQuestion(AnsweringQuestionDO answeringQuestionDO) {
        this.baseMapper.insert(answeringQuestionDO);
        return ConstantUtils.ADD_SUCCESS;
    }

    public String deleteQuestion(AnsweringQuestionDO answeringQuestionDO) {
        this.baseMapper.deleteById(answeringQuestionDO.getId());
        return ConstantUtils.DELETE_SUCCESS;
    }

    public String updateQuestion(AnsweringQuestionDO answeringQuestionDO) {
        this.baseMapper.updateById(answeringQuestionDO);
        return ConstantUtils.SET_SUCCESS;
    }


}