班级相关
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
package com.peanut.modules.common.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.ClassExamOption;
|
||||
import com.peanut.modules.common.entity.ClassExamSubject;
|
||||
import com.peanut.modules.common.service.ClassExamService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController("commonClassExam")
|
||||
@RequestMapping("common/classExam")
|
||||
public class ClassExamController {
|
||||
|
||||
@Autowired
|
||||
private ClassExamService classExamService;
|
||||
|
||||
//导入考试题
|
||||
@RequestMapping("/importSubject")
|
||||
public R importSubject(@RequestParam("file") MultipartFile file, @RequestParam("courseId") String courseId) {
|
||||
String res = classExamService.importSubject(file,courseId);
|
||||
if (res==null){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(res);
|
||||
}
|
||||
}
|
||||
|
||||
//考试题目列表
|
||||
@RequestMapping("/getClassExamSubjectList")
|
||||
public R getClassExamSubjectList(@RequestBody Map<String,Object> params){
|
||||
Page classExamSubjectList = classExamService.getClassExamSubjectList(params);
|
||||
return R.ok().put("page",classExamSubjectList);
|
||||
}
|
||||
|
||||
//考试题目列表
|
||||
@RequestMapping("/generateExamPaper")
|
||||
public R generateExamPaper(@RequestBody Map<String,Object> params){
|
||||
Object examPaper = classExamService.generateExamPaper(params);
|
||||
return R.ok().put("examPaper",examPaper);
|
||||
}
|
||||
|
||||
//提交考卷
|
||||
@RequestMapping("/submitExamPaper")
|
||||
public R submitExamPaper(@RequestBody Map<String,Object> params){
|
||||
Object examPaper = classExamService.submitExamPaper(params);
|
||||
return R.ok().put("examPaper",examPaper);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//添加题目
|
||||
@RequestMapping("/addClassExamSubject")
|
||||
public R addClassExamSubject(@RequestBody ClassExamSubject classExamSubject){
|
||||
if (classExamService.addClassExamSubject(classExamSubject)>0){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error();
|
||||
}
|
||||
}
|
||||
|
||||
//添加选项
|
||||
@RequestMapping("/addClassExamOption")
|
||||
public R addClassExamOption(@RequestBody ClassExamOption classExamOption){
|
||||
if (classExamService.addClassExamOption(classExamOption)>0){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error();
|
||||
}
|
||||
}
|
||||
|
||||
//修改题目
|
||||
@RequestMapping("/updateClassExamSubject")
|
||||
public R updateClassExamSubject(@RequestBody ClassExamSubject classExamSubject){
|
||||
if (classExamService.updateClassExamSubject(classExamSubject)>0){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error();
|
||||
}
|
||||
}
|
||||
|
||||
//修改选项
|
||||
@RequestMapping("/updateClassExamOption")
|
||||
public R updateClassExamOption(@RequestBody ClassExamOption classExamOption){
|
||||
if (classExamService.updateClassExamOption(classExamOption)>0){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error();
|
||||
}
|
||||
}
|
||||
|
||||
//删除题目
|
||||
@RequestMapping("/delClassExamSubject")
|
||||
public R delClassExamSubject(@RequestBody Map<String,Object> params){
|
||||
if (classExamService.delClassExamSubject(params)>0){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error();
|
||||
}
|
||||
}
|
||||
|
||||
//删除选项
|
||||
@RequestMapping("/delClassExamOption")
|
||||
public R delClassExamOption(@RequestBody Map<String,Object> params){
|
||||
if (classExamService.delClassExamOption(params)>0){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user