| | |
| | | import com.mindskip.xzs.vo.QuestionExportData; |
| | | import com.mindskip.xzs.vo.QuestionExportVO; |
| | | import com.mindskip.xzs.vo.QuestionImportVO; |
| | | import com.mindskip.xzs.vo.QuestionSubjectVO; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.modelmapper.ModelMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | questionMapper.insertSelective(question); |
| | | |
| | | // 题目所属部门插入 |
| | | List<DeptQuestion> deptQuestions = model.getDeptIds().stream().map(deptId -> { |
| | | DeptQuestion deptQuestion = new DeptQuestion(); |
| | | deptQuestion.setQuestionId(question.getId()); |
| | | deptQuestion.setDeptId(deptId); |
| | | return deptQuestion; |
| | | }).collect(Collectors.toList()); |
| | | if (! CollectionUtils.isEmpty(model.getDeptIds())) { |
| | | deptQuestionMapper.add(deptQuestions); |
| | | List<DeptQuestion> deptQuestions = model.getDeptIds().stream().map(deptId -> { |
| | | DeptQuestion deptQuestion = new DeptQuestion(); |
| | | deptQuestion.setQuestionId(question.getId()); |
| | | deptQuestion.setDeptId(deptId); |
| | | return deptQuestion; |
| | | }).collect(Collectors.toList()); |
| | | if (! CollectionUtils.isEmpty(model.getDeptIds())) { |
| | | deptQuestionMapper.add(deptQuestions); |
| | | } |
| | | } |
| | | |
| | | //批量添加 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<QuestionExportData> exportData(QuestionExportVO query) { |
| | | public List<QuestionImportVO> exportData(QuestionExportVO query) { |
| | | return questionMapper.exportData(query); |
| | | } |
| | | |
| | |
| | | return RestResponse.ok(null); |
| | | } |
| | | |
| | | @Override |
| | | public Integer countQuestionByTitle(String title) { |
| | | return questionMapper.countQuestionByTitle(title); |
| | | } |
| | | |
| | | @Override |
| | | public List<QuestionSubjectVO> countQuestionByTitleAndSubject(String title, Integer subjectId) { |
| | | return questionMapper.countQuestionByTitleAndSubject(title, subjectId); |
| | | } |
| | | |
| | | /** |
| | | * 处理题目内容JSON |
| | | * |