|
|
|
|
package com.gszc.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.plugins.Page;
|
|
|
|
|
import com.gszc.entity.Question;
|
|
|
|
|
import com.gszc.entity.Question;
|
|
|
|
|
import com.gszc.mapper.QuestionMapper;
|
|
|
|
|
import com.gszc.service.IQuestionService;
|
|
|
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <p>
|
|
|
|
|
* 服务实现类
|
|
|
|
|
* </p>
|
|
|
|
|
*
|
|
|
|
|
* @author ky
|
|
|
|
|
* @since 2020-05-25
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> implements IQuestionService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
QuestionMapper questionMapper;
|
|
|
|
|
|
|
|
|
|
public void addQuestion(Question question){
|
|
|
|
|
String id = UUID.randomUUID().toString();
|
|
|
|
|
question.setId(id);
|
|
|
|
|
question.setCreateDate(new Date());
|
|
|
|
|
question.setModifyDate(new Date());
|
|
|
|
|
questionMapper.insert(question);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void deleteQuestion(Question question){
|
|
|
|
|
questionMapper.deleteById(question);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void updateQuestion(Question question){
|
|
|
|
|
questionMapper.updateById(question);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Question> queryQuestion(Integer pageNum, Integer pageSize){
|
|
|
|
|
|
|
|
|
|
List<Question> result = questionMapper.selectPage(new Page<>((pageNum - 1) * pageSize, pageSize), new EntityWrapper<Question>().eq("1", "1").orderBy("ix", true));
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|