|
|
|
@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@Api(tags = "课程方面API")
|
|
|
|
@ -318,6 +319,22 @@ public class ObjectiveApi {
|
|
|
|
|
* 参数:chapterId
|
|
|
|
|
* return:List<SysObjectiveQuestions>
|
|
|
|
|
*/
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("根据章节ID随机获取十道内置题目")
|
|
|
|
|
@PostMapping("selectRandomObjectiveByChapterId")
|
|
|
|
|
private List<SysObjectiveQuestions> selectRandomObjectiveByChapterId(@RequestParam String chapterId) {
|
|
|
|
|
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
|
|
|
|
|
example.createCriteria().andThreeIdEqualTo(chapterId);
|
|
|
|
|
List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example);
|
|
|
|
|
List<String> ids = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
SysObjectiveQuestionsExample example1 = new SysObjectiveQuestionsExample();
|
|
|
|
|
example1.createCriteria().andObjectiveIdIn(ids).andSourceEqualTo("管理员");
|
|
|
|
|
List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example1);
|
|
|
|
|
Collections.shuffle(sysObjectiveQuestions);
|
|
|
|
|
return sysObjectiveQuestions.stream().limit(10).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据章节ID 查询所有 内置 题目
|
|
|
|
@ -325,6 +342,21 @@ public class ObjectiveApi {
|
|
|
|
|
* 参数:chapterId
|
|
|
|
|
* return:List<SysObjectiveQuestions>
|
|
|
|
|
*/
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("根据章节I查询所有内置题目")
|
|
|
|
|
@PostMapping("selectObjectQuestionListByChapterId")
|
|
|
|
|
private List<SysObjectiveQuestions> selectObjectQuestionListByChapterId(@RequestParam String chapterId) {
|
|
|
|
|
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
|
|
|
|
|
example.createCriteria().andThreeIdEqualTo(chapterId);
|
|
|
|
|
List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example);
|
|
|
|
|
List<String> ids = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
SysObjectiveQuestionsExample example1 = new SysObjectiveQuestionsExample();
|
|
|
|
|
example1.createCriteria().andObjectiveIdIn(ids).andSourceEqualTo("管理员");
|
|
|
|
|
List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example1);
|
|
|
|
|
return sysObjectiveQuestions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 随机获取35道 内置 单选题
|
|
|
|
@ -333,19 +365,78 @@ public class ObjectiveApi {
|
|
|
|
|
* return:List<SysObjectiveQuestions>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("随机获取35道内置单选题")
|
|
|
|
|
@PostMapping("selectRandomObjectiveSingle")
|
|
|
|
|
private List<SysObjectiveQuestions> selectRandomObjectiveSingle(@RequestParam String systemOwner) {
|
|
|
|
|
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
|
|
|
|
|
String oneId = sysOneCatalogs.getOneId();
|
|
|
|
|
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
|
|
|
|
|
example.createCriteria().andOneIdEqualTo(oneId);
|
|
|
|
|
List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
|
List<String> ids = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
SysObjectiveQuestionsExample example1 = new SysObjectiveQuestionsExample();
|
|
|
|
|
example1.createCriteria().andObjectiveIdIn(ids).andSourceEqualTo("管理员").andTypeEqualTo("0");
|
|
|
|
|
List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example1);
|
|
|
|
|
Collections.shuffle(sysObjectiveQuestions);
|
|
|
|
|
return sysObjectiveQuestions.stream().limit(35).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 随机获取5道 内置 多选题
|
|
|
|
|
* 方法名:selectRandomObjectiveSingle
|
|
|
|
|
* 方法名:selectRandomObjectiveMany
|
|
|
|
|
* 参数:systemOwner
|
|
|
|
|
* return:List<SysObjectiveQuestions>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("随机获取5道内置多选题")
|
|
|
|
|
@PostMapping("selectRandomObjectiveMany")
|
|
|
|
|
private List<SysObjectiveQuestions> selectRandomObjectiveMany(@RequestParam String systemOwner) {
|
|
|
|
|
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
|
|
|
|
|
String oneId = sysOneCatalogs.getOneId();
|
|
|
|
|
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
|
|
|
|
|
example.createCriteria().andOneIdEqualTo(oneId);
|
|
|
|
|
List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
|
List<String> ids = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
SysObjectiveQuestionsExample example1 = new SysObjectiveQuestionsExample();
|
|
|
|
|
example1.createCriteria().andObjectiveIdIn(ids).andSourceEqualTo("管理员").andTypeEqualTo("1");
|
|
|
|
|
List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example1);
|
|
|
|
|
Collections.shuffle(sysObjectiveQuestions);
|
|
|
|
|
return sysObjectiveQuestions.stream().limit(5).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 随机获取10道 内置 判断题
|
|
|
|
|
* 方法名:selectRandomObjectiveJudge
|
|
|
|
|
* 参数:systemOwner
|
|
|
|
|
* return:List<SysObjectiveQuestions>
|
|
|
|
|
*/
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("随机获取5道内置多选题")
|
|
|
|
|
@PostMapping("selectRandomObjectiveJudge")
|
|
|
|
|
private List<SysObjectiveQuestions> selectRandomObjectiveJudge(@RequestParam String systemOwner) {
|
|
|
|
|
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
|
|
|
|
|
String oneId = sysOneCatalogs.getOneId();
|
|
|
|
|
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
|
|
|
|
|
example.createCriteria().andOneIdEqualTo(oneId);
|
|
|
|
|
List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
|
List<String> ids = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
SysObjectiveQuestionsExample example1 = new SysObjectiveQuestionsExample();
|
|
|
|
|
example1.createCriteria().andObjectiveIdIn(ids).andSourceEqualTo("管理员").andTypeEqualTo("2");
|
|
|
|
|
List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example1);
|
|
|
|
|
Collections.shuffle(sysObjectiveQuestions);
|
|
|
|
|
return sysObjectiveQuestions.stream().limit(10).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取客观题库单选题数量
|
|
|
|
@ -353,6 +444,29 @@ public class ObjectiveApi {
|
|
|
|
|
* 参数:schoolId systemOwner
|
|
|
|
|
* return:Integer
|
|
|
|
|
*/
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("获取客观题库单选题数量")
|
|
|
|
|
@PostMapping("selectCountSingle")
|
|
|
|
|
private Integer selectCountSingle(@RequestParam String systemOwner,
|
|
|
|
|
@RequestParam String schoolId) {
|
|
|
|
|
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
|
|
|
|
|
String oneId = sysOneCatalogs.getOneId();
|
|
|
|
|
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
|
|
|
|
|
example.createCriteria().andOneIdEqualTo(oneId);
|
|
|
|
|
List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
|
List<String> ids = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysObjectiveQuestionsExample example1 = new SysObjectiveQuestionsExample();
|
|
|
|
|
List<String> list = new ArrayList();
|
|
|
|
|
list.add(schoolId);
|
|
|
|
|
list.add("管理员");
|
|
|
|
|
example1.createCriteria().andObjectiveIdIn(ids).andSourceIn(list).andTypeEqualTo("0");
|
|
|
|
|
List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example1);
|
|
|
|
|
return sysObjectiveQuestions.size();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取客观题库多选题数量
|
|
|
|
@ -360,6 +474,29 @@ public class ObjectiveApi {
|
|
|
|
|
* 参数:schoolId systemOwner
|
|
|
|
|
* return:Integer
|
|
|
|
|
*/
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("获取客观题库多选题数量")
|
|
|
|
|
@PostMapping("selectCountMany")
|
|
|
|
|
private Integer selectCountMany(@RequestParam String systemOwner,
|
|
|
|
|
@RequestParam String schoolId) {
|
|
|
|
|
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
|
|
|
|
|
String oneId = sysOneCatalogs.getOneId();
|
|
|
|
|
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
|
|
|
|
|
example.createCriteria().andOneIdEqualTo(oneId);
|
|
|
|
|
List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
|
List<String> ids = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysObjectiveQuestionsExample example1 = new SysObjectiveQuestionsExample();
|
|
|
|
|
List<String> list = new ArrayList();
|
|
|
|
|
list.add(schoolId);
|
|
|
|
|
list.add("管理员");
|
|
|
|
|
example1.createCriteria().andObjectiveIdIn(ids).andSourceIn(list).andTypeEqualTo("1");
|
|
|
|
|
List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example1);
|
|
|
|
|
return sysObjectiveQuestions.size();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取客观题库判断数量
|
|
|
|
@ -367,4 +504,26 @@ public class ObjectiveApi {
|
|
|
|
|
* 参数:schoolId systemOwner
|
|
|
|
|
* return:Integer
|
|
|
|
|
*/
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
@ApiOperation("获取客观题库单选题数量")
|
|
|
|
|
@PostMapping("selectCountJudge")
|
|
|
|
|
private Integer selectCountJudge(@RequestParam String systemOwner,
|
|
|
|
|
@RequestParam String schoolId) {
|
|
|
|
|
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
|
|
|
|
|
String oneId = sysOneCatalogs.getOneId();
|
|
|
|
|
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
|
|
|
|
|
example.createCriteria().andOneIdEqualTo(oneId);
|
|
|
|
|
List<SysTopicAndCourse> sysTopicAndCourses = sysTopicAndCourseMapper.selectByExample(example);
|
|
|
|
|
|
|
|
|
|
List<String> ids = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SysObjectiveQuestionsExample example1 = new SysObjectiveQuestionsExample();
|
|
|
|
|
List<String> list = new ArrayList();
|
|
|
|
|
list.add(schoolId);
|
|
|
|
|
list.add("管理员");
|
|
|
|
|
example1.createCriteria().andObjectiveIdIn(ids).andSourceIn(list).andTypeEqualTo("2");
|
|
|
|
|
List<SysObjectiveQuestions> sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByExample(example1);
|
|
|
|
|
return sysObjectiveQuestions.size();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|