欢迎光临散文网 会员登陆 & 注册

基于ssm的学生竞赛模拟系统设计与实现-计算机毕业设计源码+LW文档

2022-09-15 22:25 作者:计算机毕业设计大神888  | 我要投稿

开发语言:Java

框架:ssm

JDK版本:JDK1.8

服务器:tomcat7

数据库:mysql 5.7(一定要5.7版本)

数据库工具:Navicat11

开发软件:eclipse/myeclipse/idea

Maven包:Maven3.3.9

浏览器:谷歌浏览器


数据库脚本:



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 '创建时间',

  `name` varchar(200) NOT NULL COMMENT '试卷名称',

  `time` int(11) NOT NULL COMMENT '考试时长(分钟)',

  `status` int(11) NOT NULL DEFAULT '0' COMMENT '试卷状态',

  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','十万个为什么',60,0),(1643101663793,'2022-01-25 09:07:43','高数',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 '创建时间',

  `paperid` bigint(20) NOT NULL COMMENT '所属试卷id(外键)',

  `papername` varchar(200) NOT NULL COMMENT '试卷名称',

  `questionname` varchar(200) NOT NULL COMMENT '试题名称',

  `options` longtext COMMENT '选项,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:填空题(暂不考虑多项填空)',

  `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,'十万个为什么','下面动物不属于昆虫的是()。','[{\"text\":\"A.苍蝇\",\"code\":\"A\"},{\"text\":\"B.蜜蜂\",\"code\":\"B\"},{\"text\":\"C.蜂鸟\",\"code\":\"C\"}]',20,'C','蜂鸟',0,1),(2,'2022-01-25 09:00:30',1,'十万个为什么','油着火后可以用水扑灭。','[{\"text\":\"A.对\",\"code\":\"A\"},{\"text\":\"B.错\",\"code\":\"B\"}]',20,'B','油着火后不可以用水扑灭',2,2),(3,'2022-01-25 09:00:30',1,'十万个为什么','地球是个球体,中间是( )。','[]',30,'赤道','赤道',3,3),(4,'2022-01-25 09:00:30',1,'十万个为什么','下面动物中会流汗的有( )。','[{\"text\":\"A.马\",\"code\":\"A\"},{\"text\":\"B.猫\",\"code\":\"B\"},{\"text\":\"C.狗\",\"code\":\"C\"}]',30,'A,B','狗不会流汗',1,4),(1643101715017,'2022-01-25 09:08:34',1643101663793,'高数','水电费干啥地方噶水电费嘎','[{\"text\":\"A.1\",\"code\":\"A\"},{\"text\":\"B.2\",\"code\":\"B\"},{\"text\":\"C.3\",\"code\":\"C\"},{\"text\":\"D.4\",\"code\":\"D\"}]',20,'A','的风格会更好的风格',0,1),(1643101751868,'2022-01-25 09:09:11',1643101663793,'高数','发给撒地方干啥的','[{\"text\":\"A.山东分公司\",\"code\":\"A\"},{\"text\":\"B.森岛帆高水电费\",\"code\":\"B\"},{\"text\":\"C.颠覆三观的双缝干涉\",\"code\":\"C\"},{\"text\":\"D.森岛帆高水电费\",\"code\":\"D\"}]',20,'A,B,C','森岛帆高水电费个',1,2),(1643101766053,'2022-01-25 09:09:26',1643101663793,'高数','第三方嘎山东分公司','[{\"text\":\"A.对\",\"code\":\"A\"},{\"text\":\"B.错\",\"code\":\"B\"}]',20,'A','风格会更好发',2,3),(1643101785999,'2022-01-25 09:09:46',1643101663793,'高数','的发送到发给改水电费','[]',40,'11','的发给森岛帆高水电费',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 '创建时间',

  `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 '选项,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 */;





业务逻辑代码:




/**

 * 考试记录表

 * 后端接口

 * @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);

    }




基于ssm的学生竞赛模拟系统设计与实现-计算机毕业设计源码+LW文档的评论 (共 条)

分享到微博请遵守国家法律