Blame view

AnsweringQuestionServiceImpl.java 1.59 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
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;
    }


}