基于ssm的學(xué)生競賽模擬系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)-計(jì)算機(jī)畢業(yè)設(shè)計(jì)源碼+LW文檔
開發(fā)語言:Java
框架:ssm
JDK版本:JDK1.8
服務(wù)器:tomcat7
數(shù)據(jù)庫:mysql 5.7(一定要5.7版本)
數(shù)據(jù)庫工具:Navicat11
開發(fā)軟件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
瀏覽器:谷歌瀏覽器
數(shù)據(jù)庫腳本:
DROP TABLE IF EXISTS `exampaper`;
/*!40101 SET @saved_cs_client? ? ?= @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `exampaper` (
? `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
? `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創(chuàng)建時(shí)間',
? `name` varchar(200) NOT NULL COMMENT '試卷名稱',
? `time` int(11) NOT NULL COMMENT '考試時(shí)長(分鐘)',
? `status` int(11) NOT NULL DEFAULT '0' COMMENT '試卷狀態(tài)',
? PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1643101663794 DEFAULT CHARSET=utf8 COMMENT='試卷表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `exampaper`
--
LOCK TABLES `exampaper` WRITE;
/*!40000 ALTER TABLE `exampaper` DISABLE KEYS */;
INSERT INTO `exampaper` VALUES (1,'2022-01-25 09:00:30','十萬個(gè)為什么',60,0),(1643101663793,'2022-01-25 09:07:43','高數(shù)',180,1);
/*!40000 ALTER TABLE `exampaper` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `examquestion`
--
DROP TABLE IF EXISTS `examquestion`;
/*!40101 SET @saved_cs_client? ? ?= @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `examquestion` (
? `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
? `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創(chuàng)建時(shí)間',
? `paperid` bigint(20) NOT NULL COMMENT '所屬試卷id(外鍵)',
? `papername` varchar(200) NOT NULL COMMENT '試卷名稱',
? `questionname` varchar(200) NOT NULL COMMENT '試題名稱',
? `options` longtext COMMENT '選項(xiàng),json字符串',
? `score` bigint(20) DEFAULT '0' COMMENT '分值',
? `answer` varchar(200) DEFAULT NULL COMMENT '正確答案',
? `analysis` longtext COMMENT '答案解析',
? `type` bigint(20) DEFAULT '0' COMMENT '試題類型,0:單選題 1:多選題 2:判斷題 3:填空題(暫不考慮多項(xiàng)填空)',
? `sequence` bigint(20) DEFAULT '100' COMMENT '試題排序,值越大排越前面',
? PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1643101786000 DEFAULT CHARSET=utf8 COMMENT='試題表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `examquestion`
--
LOCK TABLES `examquestion` WRITE;
/*!40000 ALTER TABLE `examquestion` DISABLE KEYS */;
INSERT INTO `examquestion` VALUES (1,'2022-01-25 09:00:30',1,'十萬個(gè)為什么','下面動(dòng)物不屬于昆蟲的是()。','[{\"text\":\"A.蒼蠅\",\"code\":\"A\"},{\"text\":\"B.蜜蜂\",\"code\":\"B\"},{\"text\":\"C.蜂鳥\",\"code\":\"C\"}]',20,'C','蜂鳥',0,1),(2,'2022-01-25 09:00:30',1,'十萬個(gè)為什么','油著火后可以用水撲滅。','[{\"text\":\"A.對(duì)\",\"code\":\"A\"},{\"text\":\"B.錯(cuò)\",\"code\":\"B\"}]',20,'B','油著火后不可以用水撲滅',2,2),(3,'2022-01-25 09:00:30',1,'十萬個(gè)為什么','地球是個(gè)球體,中間是( )。','[]',30,'赤道','赤道',3,3),(4,'2022-01-25 09:00:30',1,'十萬個(gè)為什么','下面動(dòng)物中會(huì)流汗的有( )。','[{\"text\":\"A.馬\",\"code\":\"A\"},{\"text\":\"B.貓\",\"code\":\"B\"},{\"text\":\"C.狗\",\"code\":\"C\"}]',30,'A,B','狗不會(huì)流汗',1,4),(1643101715017,'2022-01-25 09:08:34',1643101663793,'高數(shù)','水電費(fèi)干啥地方噶水電費(fèi)嘎','[{\"text\":\"A.1\",\"code\":\"A\"},{\"text\":\"B.2\",\"code\":\"B\"},{\"text\":\"C.3\",\"code\":\"C\"},{\"text\":\"D.4\",\"code\":\"D\"}]',20,'A','的風(fēng)格會(huì)更好的風(fēng)格',0,1),(1643101751868,'2022-01-25 09:09:11',1643101663793,'高數(shù)','發(fā)給撒地方干啥的','[{\"text\":\"A.山東分公司\",\"code\":\"A\"},{\"text\":\"B.森島帆高水電費(fèi)\",\"code\":\"B\"},{\"text\":\"C.顛覆三觀的雙縫干涉\",\"code\":\"C\"},{\"text\":\"D.森島帆高水電費(fèi)\",\"code\":\"D\"}]',20,'A,B,C','森島帆高水電費(fèi)個(gè)',1,2),(1643101766053,'2022-01-25 09:09:26',1643101663793,'高數(shù)','第三方嘎山東分公司','[{\"text\":\"A.對(duì)\",\"code\":\"A\"},{\"text\":\"B.錯(cuò)\",\"code\":\"B\"}]',20,'A','風(fēng)格會(huì)更好發(fā)',2,3),(1643101785999,'2022-01-25 09:09:46',1643101663793,'高數(shù)','的發(fā)送到發(fā)給改水電費(fèi)','[]',40,'11','的發(fā)給森島帆高水電費(fèi)',3,4);
/*!40000 ALTER TABLE `examquestion` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `examrecord`
--
DROP TABLE IF EXISTS `examrecord`;
/*!40101 SET @saved_cs_client? ? ?= @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `examrecord` (
? `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
? `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創(chuàng)建時(shí)間',
? `userid` bigint(20) NOT NULL COMMENT '用戶id',
? `username` varchar(200) DEFAULT NULL COMMENT '用戶名',
? `paperid` bigint(20) NOT NULL COMMENT '試卷id(外鍵)',
? `papername` varchar(200) NOT NULL COMMENT '試卷名稱',
? `questionid` bigint(20) NOT NULL COMMENT '試題id(外鍵)',
? `questionname` varchar(200) NOT NULL COMMENT '試題名稱',
? `options` longtext COMMENT '選項(xiàng),json字符串',
? `score` bigint(20) DEFAULT '0' COMMENT '分值',
? `answer` varchar(200) DEFAULT NULL COMMENT '正確答案',
? `analysis` longtext COMMENT '答案解析',
? `myscore` bigint(20) NOT NULL DEFAULT '0' COMMENT '試題得分',
? `myanswer` varchar(200) DEFAULT NULL COMMENT '考生答案',
? PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1643101865967 DEFAULT CHARSET=utf8 COMMENT='考試記錄表';
/*!40101 SET character_set_client = @saved_cs_client */;
業(yè)務(wù)邏輯代碼:
/**
?* 考試記錄表
?* 后端接口
?* @author?
?* @email?
?* @date 2022-01-25 16:59:54
?*/
@RestController
@RequestMapping("/examrecord")
public class ExamrecordController {
? ? @Autowired
? ? private ExamrecordService examrecordService;
? ??
? ? ? ? /**
? ? ?* 考試記錄接口
? ? ?*/
? ? @RequestMapping("/groupby")
? ? public R page2(@RequestParam Map<String, Object> params,ExamrecordEntity examrecord, HttpServletRequest request){
? ? if(!request.getSession().getAttribute("role").toString().equals("管理員")) {
? ? examrecord.setUserid((Long)request.getSession().getAttribute("userId"));
? ? }
? ? ? ? EntityWrapper<ExamrecordEntity> ew = new EntityWrapper<ExamrecordEntity>();
PageUtils page = examrecordService.queryPageGroupBy(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, examrecord), params), params));
? ? ? ? return R.ok().put("data", page);
? ? }
? ? /**
? ? ?* 后端列表
? ? ?*/
? ? @RequestMapping("/page")
? ? public R page(@RequestParam Map<String, Object> params,ExamrecordEntity examrecord,?
HttpServletRequest request){
? ? if(!request.getSession().getAttribute("role").toString().equals("管理員")) {
? ? examrecord.setUserid((Long)request.getSession().getAttribute("userId"));
? ? }
? ? ? ? EntityWrapper<ExamrecordEntity> ew = new EntityWrapper<ExamrecordEntity>();
PageUtils page = examrecordService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, examrecord), params), params));
? ? ? ? return R.ok().put("data", page);
? ? }
? ??
? ? /**
? ? ?* 前端列表
? ? ?*/
? ? @RequestMapping("/list")
? ? public R list(@RequestParam Map<String, Object> params,ExamrecordEntity examrecord,?
HttpServletRequest request){
? ? if(!request.getSession().getAttribute("role").toString().equals("管理員")) {
? ? examrecord.setUserid((Long)request.getSession().getAttribute("userId"));
? ? }
? ? ? ? EntityWrapper<ExamrecordEntity> ew = new EntityWrapper<ExamrecordEntity>();
PageUtils page = examrecordService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, examrecord), params), params));
? ? ? ? return R.ok().put("data", page);
? ? }
/**
? ? ?* 列表
? ? ?*/
? ? @RequestMapping("/lists")
? ? public R list( ExamrecordEntity examrecord){
? ? ? ? EntityWrapper<ExamrecordEntity> ew = new EntityWrapper<ExamrecordEntity>();
? ? ? ew.allEq(MPUtil.allEQMapPre( examrecord, "examrecord"));?
? ? ? ? return R.ok().put("data", examrecordService.selectListView(ew));
? ? }
/**
? ? ?* 查詢
? ? ?*/
? ? @RequestMapping("/query")
? ? public R query(ExamrecordEntity examrecord){
? ? ? ? EntityWrapper< ExamrecordEntity> ew = new EntityWrapper< ExamrecordEntity>();
? ew.allEq(MPUtil.allEQMapPre( examrecord, "examrecord"));?
ExamrecordView examrecordView =? examrecordService.selectView(ew);
return R.ok("查詢考試記錄表成功").put("data", examrecordView);
? ? }
? ? /**
? ? ?* 后端詳情
? ? ?*/
? ? @RequestMapping("/info/{id}")
? ? public R info(@PathVariable("id") Long id){
? ? ? ? ExamrecordEntity examrecord = examrecordService.selectById(id);
? ? ? ? return R.ok().put("data", examrecord);
? ? }

