赞
踩
eclipse 下载
mysql 5.7 下载
jdk 1.8 下载
tomcat 8.0 下载
maven 3.5 下载
idea 下载
基于ssm的美食分享系统
ssm+vue驾校管理系统
springboot二手商城微信小程序
基于ssm+vue的化妆品商城
基于springboot的家具商城系统
@PostMapping("/item") public ApiResult ItemController(@RequestBody Item item) { // 选择题 Integer changeNumber = item.getChangeNumber(); // 填空题 Integer fillNumber = item.getFillNumber(); // 判断题 Integer judgeNumber = item.getJudgeNumber(); //出卷id Integer paperId = item.getPaperId(); // 选择题数据库获取 List<Integer> changeNumbers = multiQuestionService.findBySubject(item.getSubject(), changeNumber); if(changeNumbers==null){ return ApiResultHandler.buildApiResult(400,"选择题数据库获取失败",null); } for (Integer number : changeNumbers) { PaperManage paperManage = new PaperManage(paperId,1,number); int index = paperService.add(paperManage); if(index==0) return ApiResultHandler.buildApiResult(400,"选择题组卷保存失败",null); } // 填空题 List<Integer> fills = fillQuestionService.findBySubject(item.getSubject(), fillNumber); if(fills==null) return ApiResultHandler.buildApiResult(400,"填空题数据库获取失败",null); for (Integer fillNum : fills) { PaperManage paperManage = new PaperManage(paperId,2,fillNum); int index = paperService.add(paperManage); if(index==0) return ApiResultHandler.buildApiResult(400,"填空题题组卷保存失败",null); } // 判断题 List<Integer> judges = judgeQuestionService.findBySubject(item.getSubject(), judgeNumber); if(fills==null) return ApiResultHandler.buildApiResult(400,"判断题数据库获取失败",null); for (Integer judge : judges) { PaperManage paperManage = new PaperManage(paperId,3,judge); int index = paperService.add(paperManage); if(index==0) return ApiResultHandler.buildApiResult(400,"判断题题组卷保存失败",null); } return ApiResultHandler.buildApiResult(200,"试卷组卷成功",null); } }
@RestController public class ExamManageController { @Autowired private ExamManageServiceImpl examManageService; @GetMapping("/exams") public ApiResult findAll(){ System.out.println("不分页查询所有试卷"); ApiResult apiResult; apiResult = ApiResultHandler.buildApiResult(200, "请求成功!", examManageService.findAll()); return apiResult; } @GetMapping("/exams/{page}/{size}") public ApiResult findAll(@PathVariable("page") Integer page, @PathVariable("size") Integer size){ System.out.println("分页查询所有试卷"); ApiResult apiResult; Page<ExamManage> examManage = new Page<>(page,size); IPage<ExamManage> all = examManageService.findAll(examManage); apiResult = ApiResultHandler.buildApiResult(200, "请求成功!", all); return apiResult; } @GetMapping("/exam/{examCode}") public ApiResult findById(@PathVariable("examCode") Integer examCode){ System.out.println("根据ID查找"); ExamManage res = examManageService.findById(examCode); if(res == null) { return ApiResultHandler.buildApiResult(10000,"考试编号不存在",null); } return ApiResultHandler.buildApiResult(200,"请求成功!",res); } @DeleteMapping("/exam/{examCode}") public ApiResult deleteById(@PathVariable("examCode") Integer examCode){ int res = examManageService.delete(examCode); return ApiResultHandler.buildApiResult(200,"删除成功",res); } @PutMapping("/exam") public ApiResult update(@RequestBody ExamManage exammanage){ int res = examManageService.update(exammanage); System.out.print("更新操作执行---"); return ApiResultHandler.buildApiResult(200,"更新成功",res); } @PostMapping("/exam") public ApiResult add(@RequestBody ExamManage exammanage){ int res = examManageService.add(exammanage); if (res ==1) { return ApiResultHandler.buildApiResult(200, "添加成功", res); } else { return ApiResultHandler.buildApiResult(400,"添加失败",res); } } @GetMapping("/examManagePaperId") public ApiResult findOnlyPaperId() { ExamManage res = examManageService.findOnlyPaperId(); if (res != null) { return ApiResultHandler.buildApiResult(200,"请求成功",res); } return ApiResultHandler.buildApiResult(400,"请求失败",res); } }
注意:该项目只展示部分功能,如需了解,评论区咨询即可。
希望和大家多多交流!!
源码项目、定制开发、代码讲解、答辩辅导
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。