计算机毕业设计 基于Java的大学生计算机基础网络教学系统的设计与实现 Java实战项目 附源码+文档+视频讲解

博主介绍:✌从事软件开发10年之余,专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌
🍅文末获取源码联系🍅
👇🏻 精彩专栏推荐订阅👇🏻 不然下次找不到哟
————————————————
计算机毕业设计《1000套》

目录

1、项目介绍及开发技术

1.1 项目介绍

1.2 开发技术

2、系统功能设计结构图

3、功能截图

4、数据库表结构设计

5、关键代码

5.1错题表管理Controller模块 

5.2 错题表管理Service模块 

5.3 错题表管理ServiceImpl模块

5.4 错题表管理Dao模块

6、论文目录结构

7、源码获取


1、项目介绍及开发技术

1.1 项目介绍

近年来,信息化管理行业的不断兴起,使得人们的日常生活越来越离不开计算机和互联网技术。首先,根据收集到的用户需求分析,对设计系统有一个初步的认识与了解,确定大学生计算机基础网络教学系统的总体功能模块。然后,详细设计系统的主要功能模块,通过数据库设计过程将相关的数据信息存储到数据库中,再通过使用关键的开发工具,如IDEA开发平台、Java技术等,编码设计相关的功能模块。接着,主要采用功能测试的方式对系统进行测试,找出系统在运行过程中存在的问题,以及解决问题的方法,不断地改进和完善系统的设计。最后,总结本文介绍的系统的设计和实现过程,并且针对于系统的开发提出未来的展望工作。

本系统的研发具有重大的意义,在安全性方面,用户使用浏览器访问网站时,采用注册和密码等相关的保护措施,提高系统的可靠性,维护用户的个人信息和财产的安全。在方便性方面,促进了大学生计算机基础网络教学系统的信息化建设管理。

1.2 开发技术

Java开发语言、MyBatisPlus、MySQL数据库、Maven、IDEA开发工具、JDK1.8+、Vue、HTML、CSS、JS。

2、系统功能设计结构图

3、功能截图

管理员可以选择任一浏览器打开网址,输入信息无误后,以管理员的身份行使相关的管理权限。

管理员可以通过选择课程管理,管理相关的课程信息记录,比如进行查看课程信息标题,修改课程信息来源等操作。

管理员可以通过选择公告管理,管理相关的公告信息记录,比如进行查看公告详情,删除错误的公告信息,发布公告等操作。

 管理员可以通过选择公告类型管理,管理相关的公告类型信息,比如查看所有公告类型,删除无用公告类型,修改公告类型,添加公告类型等操作。

 试题管理页面,此页面提供给管理员的功能有:新增试题,修改试题,删除试题。

 课程类型管理页面,此页面提供给管理员的功能有:新增课程类型,修改课程类型,删除课程类型。

4、数据库表结构设计

CREATE TABLE `config` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(100) DEFAULT NULL COMMENT '配置参数名称',
  `value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';

/*Data for the table `config` */

insert  into `config`(`id`,`name`,`value`) values (1,'轮播图111','upload/config1.jpg'),(2,'轮播图2','upload/config2.jpg'),(3,'轮播图3','upload/config3.jpg');

/*Table structure for table `dictionary` */

DROP TABLE IF EXISTS `dictionary`;

CREATE TABLE `dictionary` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `dic_code` varchar(200) DEFAULT NULL COMMENT '字段',
  `dic_name` varchar(200) DEFAULT NULL COMMENT '字段名',
  `code_index` int(11) DEFAULT NULL COMMENT '编码',
  `index_name` varchar(200) DEFAULT NULL COMMENT '编码名字  Search111 ',
  `super_id` int(11) DEFAULT NULL COMMENT '父字段id',
  `beizhu` varchar(200) DEFAULT NULL COMMENT '备注',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COMMENT='字典';

/*Data for the table `dictionary` */

insert  into `dictionary`(`id`,`dic_code`,`dic_name`,`code_index`,`index_name`,`super_id`,`beizhu`,`create_time`) values (1,'sex_types','性别类型',1,'男',NULL,NULL,'2023-03-31 14:54:53'),(2,'sex_types','性别类型',2,'女',NULL,NULL,'2023-03-31 14:54:53'),(3,'shangxia_types','上下架',1,'上架',NULL,NULL,'2023-03-31 14:54:53'),(4,'shangxia_types','上下架',2,'下架',NULL,NULL,'2023-03-31 14:54:53'),(5,'kecheng_types','课程类型',1,'课程类型1',NULL,NULL,'2023-03-31 14:54:53'),(6,'kecheng_types','课程类型',2,'课程类型2',NULL,NULL,'2023-03-31 14:54:53'),(7,'kecheng_types','课程类型',3,'课程类型3',NULL,NULL,'2023-03-31 14:54:53'),(8,'kecheng_types','课程类型',4,'课程类型4',NULL,NULL,'2023-03-31 14:54:53'),(9,'kecheng_collection_types','收藏表类型',1,'收藏',NULL,NULL,'2023-03-31 14:54:53'),(10,'gonggao_types','公告类型',1,'公告类型1',NULL,NULL,'2023-03-31 14:54:53'),(11,'gonggao_types','公告类型',2,'公告类型2',NULL,NULL,'2023-03-31 14:54:53'),(12,'zujuan_types','组卷方式',1,'自动组卷',NULL,NULL,'2023-03-31 14:54:53'),(13,'zujuan_types','组卷方式',2,'手动组卷',NULL,NULL,'2023-03-31 14:54:53'),(14,'kemu_types','科目',1,'语文',NULL,NULL,'2023-03-31 14:54:53'),(15,'kemu_types','科目',2,'数学',NULL,NULL,'2023-03-31 14:54:53'),(16,'exampaper_types','试卷状态',1,'启用',NULL,NULL,'2023-03-31 14:54:53'),(17,'exampaper_types','试卷状态',2,'禁用',NULL,NULL,'2023-03-31 14:54:53'),(18,'examquestion_types','试题类型',1,'单选题',NULL,NULL,'2023-03-31 14:54:54'),(19,'examquestion_types','试题类型',2,'多选题',NULL,NULL,'2023-03-31 14:54:54'),(20,'examquestion_types','试题类型',3,'判断题',NULL,NULL,'2023-03-31 14:54:54'),(21,'examquestion_types','试题类型',4,'填空题',NULL,NULL,'2023-03-31 14:54:54'),(22,'kecheng_types','课程类型',5,'课程类型5',NULL,'','2023-03-31 15:14:31');

/*Table structure for table `exampaper` */

DROP TABLE IF EXISTS `exampaper`;

CREATE TABLE `exampaper` (
  `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `exampaper_name` varchar(200) NOT NULL COMMENT '试卷名称 Search111',
  `exampaper_date` int(11) DEFAULT NULL COMMENT '考试时长(分钟)',
  `exampaper_myscore` int(20) NOT NULL DEFAULT '0' COMMENT '试卷总分数',
  `kemu_types` int(11) DEFAULT NULL COMMENT '科目 Search111',
  `exampaper_types` int(11) NOT NULL DEFAULT '0' COMMENT '试卷状态 Search111',
  `zujuan_types` int(11) DEFAULT NULL COMMENT '组卷方式',
  `exampaper_delete` int(255) DEFAULT '0' COMMENT '逻辑删除(1代表未删除 2代表已删除)',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间 show2 photoShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='试卷';

/*Data for the table `exampaper` */

insert  into `exampaper`(`id`,`exampaper_name`,`exampaper_date`,`exampaper_myscore`,`kemu_types`,`exampaper_types`,`zujuan_types`,`exampaper_delete`,`create_time`) values (1,'测试试卷1',60,100,2,1,2,1,'2023-03-31 14:54:53'),(2,'测试试卷2',180,100,2,1,1,1,'2023-03-31 14:54:53'),(3,'自动组卷试卷1',99,29,2,1,1,1,'2023-03-31 15:16:09'),(4,'手动组卷试卷2',88,28,2,1,2,1,'2023-03-31 15:16:51');

/*Table structure for table `exampapertopic` */

DROP TABLE IF EXISTS `exampapertopic`;

CREATE TABLE `exampapertopic` (
  `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `exampaper_id` int(20) NOT NULL COMMENT '试卷',
  `examquestion_id` int(20) NOT NULL COMMENT '试题',
  `exampapertopic_number` int(20) NOT NULL COMMENT '试题分数',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=48 DEFAULT CHARSET=utf8 COMMENT='试卷选题';

/*Data for the table `exampapertopic` */

insert  into `exampapertopic`(`id`,`exampaper_id`,`examquestion_id`,`exampapertopic_number`,`create_time`) values (7,1,5,10,'2023-03-31 14:54:53'),(8,1,4,10,'2023-03-31 14:54:53'),(9,1,6,70,'2023-03-31 14:54:53'),(18,2,5,15,'2023-03-31 14:54:53'),(19,2,11,15,'2023-03-31 14:54:53'),(20,2,9,15,'2023-03-31 14:54:53'),(21,2,1,15,'2023-03-31 14:54:53'),(22,2,10,20,'2023-03-31 14:54:53'),(23,2,3,20,'2023-03-31 14:54:53'),(31,1,7,10,'2023-03-31 14:54:54'),(33,1,9,0,'2023-03-31 14:54:54'),(34,1,12,0,'2023-03-31 14:54:54'),(35,3,11,3,'2023-03-31 15:16:27'),(36,3,5,3,'2023-03-31 15:16:27'),(37,3,7,4,'2023-03-31 15:16:27'),(38,3,9,3,'2023-03-31 15:16:27'),(39,3,6,3,'2023-03-31 15:16:27'),(40,3,1,3,'2023-03-31 15:16:27'),(41,3,8,5,'2023-03-31 15:16:27'),(42,3,10,5,'2023-03-31 15:16:27'),(43,4,12,10,'2023-03-31 15:16:56'),(44,4,11,8,'2023-03-31 15:16:57'),(45,4,9,5,'2023-03-31 15:16:58'),(46,4,8,3,'2023-03-31 15:16:58'),(47,4,7,2,'2023-03-31 15:16:59');

/*Table structure for table `examquestion` */

DROP TABLE IF EXISTS `examquestion`;

CREATE TABLE `examquestion` (
  `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `examquestion_name` varchar(200) DEFAULT NULL COMMENT '试题名称 Search111',
  `kemu_types` int(11) DEFAULT NULL COMMENT '科目 Search111',
  `examquestion_options` longtext COMMENT '选项,json字符串',
  `examquestion_answer` varchar(200) DEFAULT NULL COMMENT '正确答案',
  `examquestion_analysis` longtext COMMENT '答案解析',
  `examquestion_types` int(20) DEFAULT '0' COMMENT '试题类型 Search111',
  `examquestion_sequence` int(20) DEFAULT '100' COMMENT '试题排序,值越大排越前面',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COMMENT='试题表';

/*Data for the table `examquestion` */

insert  into `examquestion`(`id`,`examquestion_name`,`kemu_types`,`examquestion_options`,`examquestion_answer`,`examquestion_analysis`,`examquestion_types`,`examquestion_sequence`,`create_time`) values (1,'1-1=1',2,'[{\"text\":\"对\",\"code\":\"A\"},{\"text\":\"错\",\"code\":\"B\"}]','B','1-1=0',3,1,'2023-03-31 14:54:54'),(2,'1+1=?',2,'[{\"text\":\"1\",\"code\":\"A\"},{\"text\":\"2\",\"code\":\"B\"},{\"text\":\"3\",\"code\":\"C\"},{\"text\":\"4\",\"code\":\"D\"}]','B','1+1=2',1,2,'2023-03-31 14:54:54'),(3,'1+1-1=?',2,'[]','1','1+1-1=1',4,3,'2023-03-31 14:54:54'),(4,'2+2=?',2,'[]','4','2+2=4',4,4,'2023-03-31 14:54:54'),(5,'1-1-1+6=?',2,'[{\"text\":\"4\",\"code\":\"A\"},{\"text\":\"5\",\"code\":\"B\"},{\"text\":\"6\",\"code\":\"C\"},{\"text\":\"3\",\"code\":\"D\"}]','B','1-1-1+6=5',1,5,'2023-03-31 14:54:54'),(6,'3+3=9',2,'[{\"text\":\"对\",\"code\":\"A\"},{\"text\":\"错\",\"code\":\"B\"}]','B','3+3=6',3,6,'2023-03-31 14:54:54'),(7,'试题名称1',2,'[{\"text\":\"内容1\",\"code\":\"A\"},{\"text\":\"内容2\",\"code\":\"B\"},{\"text\":\"内容3\",\"code\":\"C\"},{\"text\":\"内容4\",\"code\":\"D\"}]','A,B,C','答案解析1',2,7,'2023-03-31 14:54:54'),(8,'试题名称2',2,'[]','正确答案2','答案解析2',4,8,'2023-03-31 14:54:54'),(9,'试题名称3',2,'[{\"text\":\"对\",\"code\":\"A\"},{\"text\":\"错\",\"code\":\"B\"}]','A','答案解析3',3,9,'2023-03-31 14:54:54'),(10,'试题名称4',2,'[]','正确答案4','答案解析4',4,10,'2023-03-31 14:54:54'),(11,'试题名称5',2,'[{\"text\":\"内容1\",\"code\":\"A\"},{\"text\":\"内容2\",\"code\":\"B\"},{\"text\":\"内容3\",\"code\":\"C\"},{\"text\":\"内容4\",\"code\":\"D\"}]','B','答案解析5',1,11,'2023-03-31 14:54:54'),(12,'试题名称6',2,'[{\"text\":\"内容1\",\"code\":\"A\"},{\"text\":\"内容2\",\"code\":\"B\"},{\"text\":\"内容3\",\"code\":\"C\"},{\"text\":\"内容4\",\"code\":\"D\"}]','A','答案解析6很好',1,12,'2023-03-31 14:54:54');

/*Table structure for table `examrecord` */

DROP TABLE IF EXISTS `examrecord`;

CREATE TABLE `examrecord` (
  `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `examrecord_uuid_number` varchar(200) DEFAULT NULL COMMENT '考试编号',
  `yonghu_id` int(20) NOT NULL COMMENT '考试用户',
  `exampaper_id` int(20) NOT NULL COMMENT '所属试卷id(外键)',
  `total_score` int(200) DEFAULT NULL COMMENT '所得总分',
  `insert_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '考试时间',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='考试记录表';

/*Data for the table `examrecord` */

insert  into `examrecord`(`id`,`examrecord_uuid_number`,`yonghu_id`,`exampaper_id`,`total_score`,`insert_time`,`create_time`) values (1,'1680246799427',4,2,15,'2023-03-31 15:13:19','2023-03-31 15:13:19');

/*Table structure for table `examredetails` */

DROP TABLE IF EXISTS `examredetails`;

CREATE TABLE `examredetails` (
  `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `examredetails_uuid_number` varchar(200) DEFAULT NULL COMMENT '试卷编号',
  `yonghu_id` int(20) NOT NULL COMMENT '用户id',
  `examquestion_id` int(20) NOT NULL COMMENT '试题id(外键)',
  `examredetails_myanswer` varchar(200) DEFAULT NULL COMMENT '考生答案',
  `examredetails_myscore` int(20) NOT NULL DEFAULT '0' COMMENT '试题得分',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='答题详情表';

/*Data for the table `examredetails` */

insert  into `examredetails`(`id`,`examredetails_uuid_number`,`yonghu_id`,`examquestion_id`,`examredetails_myanswer`,`examredetails_myscore`,`create_time`) values (1,'1680246799427',4,3,'2',0,'2023-03-31 15:13:20'),(2,'1680246799427',4,10,'3',0,'2023-03-31 15:13:20'),(3,'1680246799427',4,1,'A',0,'2023-03-31 15:13:20'),(4,'1680246799427',4,9,'A',15,'2023-03-31 15:13:20'),(5,'1680246799427',4,11,'A',0,'2023-03-31 15:13:20'),(6,'1680246799427',4,5,'A',0,'2023-03-31 15:13:20');

/*Table structure for table `examrewrongquestion` */

DROP TABLE IF EXISTS `examrewrongquestion`;

CREATE TABLE `examrewrongquestion` (
  `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `yonghu_id` int(20) NOT NULL COMMENT '用户id',
  `exampaper_id` int(20) NOT NULL COMMENT '试卷(外键)',
  `examquestion_id` int(20) NOT NULL COMMENT '试题id(外键)',
  `examredetails_myanswer` varchar(200) DEFAULT NULL COMMENT '考生作答',
  `insert_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '记录时间',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间 show3',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='错题表';

/*Data for the table `examrewrongquestion` */

insert  into `examrewrongquestion`(`id`,`yonghu_id`,`exampaper_id`,`examquestion_id`,`examredetails_myanswer`,`insert_time`,`create_time`) values (1,4,2,3,'2','2023-03-31 15:13:20','2023-03-31 15:13:20'),(2,4,2,10,'3','2023-03-31 15:13:20','2023-03-31 15:13:20'),(3,4,2,1,'A','2023-03-31 15:13:20','2023-03-31 15:13:20'),(4,4,2,11,'A','2023-03-31 15:13:20','2023-03-31 15:13:20'),(5,4,2,5,'A','2023-03-31 15:13:20','2023-03-31 15:13:20');

/*Table structure for table `gonggao` */

DROP TABLE IF EXISTS `gonggao`;

CREATE TABLE `gonggao` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
  `gonggao_name` varchar(200) DEFAULT NULL COMMENT '公告名称 Search111  ',
  `gonggao_photo` varchar(200) DEFAULT NULL COMMENT '公告图片 ',
  `gonggao_types` int(11) NOT NULL COMMENT '公告类型 Search111 ',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '公告发布时间 ',
  `gonggao_content` longtext COMMENT '公告详情 ',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='公告';

/*Data for the table `gonggao` */

insert  into `gonggao`(`id`,`gonggao_name`,`gonggao_photo`,`gonggao_types`,`insert_time`,`gonggao_content`,`create_time`) values (1,'公告名称1','upload/gonggao1.jpg',1,'2023-03-31 14:56:43','公告详情1','2023-03-31 14:56:43'),(2,'公告名称2','upload/gonggao2.jpg',1,'2023-03-31 14:56:43','公告详情2','2023-03-31 14:56:43'),(3,'公告名称3','upload/gonggao3.jpg',1,'2023-03-31 14:56:43','公告详情3','2023-03-31 14:56:43'),(4,'公告名称4','upload/gonggao4.jpg',2,'2023-03-31 14:56:43','公告详情4','2023-03-31 14:56:43'),(5,'公告名称5','upload/gonggao5.jpg',2,'2023-03-31 14:56:43','公告详情5','2023-03-31 14:56:43'),(6,'公告名称6','upload/gonggao6.jpg',1,'2023-03-31 14:56:43','公告详情6','2023-03-31 14:56:43'),(7,'公告名称7','upload/gonggao7.jpg',1,'2023-03-31 14:56:43','公告详情7','2023-03-31 14:56:43'),(8,'公告名称8','upload/gonggao8.jpg',1,'2023-03-31 14:56:43','公告详情8','2023-03-31 14:56:43'),(9,'公告名称9','upload/gonggao9.jpg',2,'2023-03-31 14:56:43','公告详情9','2023-03-31 14:56:43'),(10,'公告名称10','upload/gonggao10.jpg',2,'2023-03-31 14:56:43','公告详情10','2023-03-31 14:56:43'),(11,'公告名称11','upload/gonggao11.jpg',1,'2023-03-31 14:56:43','公告详情11','2023-03-31 14:56:43'),(12,'公告名称12','upload/gonggao12.jpg',1,'2023-03-31 14:56:43','公告详情12','2023-03-31 14:56:43'),(13,'公告名称13','upload/gonggao13.jpg',2,'2023-03-31 14:56:43','公告详情13','2023-03-31 14:56:43'),(14,'公告名称14','upload/gonggao14.jpg',1,'2023-03-31 14:56:43','公告详情14','2023-03-31 14:56:43');

/*Table structure for table `kecheng` */

DROP TABLE IF EXISTS `kecheng`;

CREATE TABLE `kecheng` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
  `laoshi_id` int(11) DEFAULT NULL COMMENT '老师',
  `kecheng_name` varchar(200) DEFAULT NULL COMMENT '课程名称  Search111 ',
  `kecheng_uuid_number` varchar(200) DEFAULT NULL COMMENT '课程编号',
  `kecheng_photo` varchar(200) DEFAULT NULL COMMENT '课程照片',
  `kecheng_file` varchar(200) DEFAULT NULL COMMENT '附件',
  `kecheng_video` varchar(200) DEFAULT NULL COMMENT '视频',
  `kecheng_types` int(11) DEFAULT NULL COMMENT '课程类型 Search111',
  `kecheng_clicknum` int(11) DEFAULT NULL COMMENT '课程热度',
  `kecheng_content` longtext COMMENT '课程介绍 ',
  `shangxia_types` int(11) DEFAULT NULL COMMENT '是否上架 ',
  `kecheng_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '录入时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间  show1 show2 photoShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 COMMENT='课程';

/*Data for the table `kecheng` */

insert  into `kecheng`(`id`,`laoshi_id`,`kecheng_name`,`kecheng_uuid_number`,`kecheng_photo`,`kecheng_file`,`kecheng_video`,`kecheng_types`,`kecheng_clicknum`,`kecheng_content`,`shangxia_types`,`kecheng_delete`,`insert_time`,`create_time`) values (1,3,'课程名称1','1680245803690','upload/kecheng1.jpg','upload/file.rar','upload/video.mp4',2,486,'课程介绍1',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(2,3,'课程名称2','1680245803707','upload/kecheng2.jpg','upload/file.rar','upload/video.mp4',1,46,'课程介绍2',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(3,2,'课程名称3','1680245803716','upload/kecheng3.jpg','upload/file.rar','upload/video.mp4',1,248,'课程介绍3',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(4,2,'课程名称4','1680245803672','upload/kecheng4.jpg','upload/file.rar','upload/video.mp4',3,124,'课程介绍4',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(5,3,'课程名称5','1680245803671','upload/kecheng5.jpg','upload/file.rar','upload/video.mp4',4,368,'课程介绍5',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(6,2,'课程名称6','1680245803729','upload/kecheng6.jpg','upload/file.rar','upload/video.mp4',3,18,'课程介绍6',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(7,3,'课程名称7','1680245803727','upload/kecheng7.jpg','upload/file.rar','upload/video.mp4',4,462,'课程介绍7',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(8,1,'课程名称8','1680245803704','upload/kecheng8.jpg','upload/file.rar','upload/video.mp4',4,466,'课程介绍8',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(9,1,'课程名称9','1680245803635','upload/kecheng9.jpg','upload/file.rar','upload/video.mp4',3,246,'<p>课程介绍9hhhh</p>',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(10,2,'课程名称10','1680245803705','upload/kecheng10.jpg','upload/file.rar','upload/video.mp4',4,269,'课程介绍10',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(11,2,'课程名称11','1680245803660','upload/kecheng11.jpg','upload/file.rar','upload/video.mp4',1,382,'课程介绍11',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(12,3,'课程名称12','1680245803682','upload/kecheng12.jpg','upload/file.rar','upload/video.mp4',3,231,'课程介绍12',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(13,3,'课程名称13','1680245803645','upload/kecheng13.jpg','upload/file.rar','upload/video.mp4',3,432,'课程介绍13',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(14,2,'课程名称14','1680245803703','upload/kecheng14.jpg','upload/file.rar','upload/video.mp4',2,97,'课程介绍14',1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43');

/*Table structure for table `kecheng_collection` */

DROP TABLE IF EXISTS `kecheng_collection`;

CREATE TABLE `kecheng_collection` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `kecheng_id` int(11) DEFAULT NULL COMMENT '课程',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `kecheng_collection_types` int(11) DEFAULT NULL COMMENT '类型',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='课程收藏';

/*Data for the table `kecheng_collection` */

insert  into `kecheng_collection`(`id`,`kecheng_id`,`yonghu_id`,`kecheng_collection_types`,`insert_time`,`create_time`) values (1,1,3,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(2,2,2,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(3,3,2,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(4,4,2,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(5,5,1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(6,6,1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(7,7,2,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(8,8,1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(9,9,2,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(10,10,3,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(11,11,1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(12,12,3,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(13,13,1,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(14,14,2,1,'2023-03-31 14:56:43','2023-03-31 14:56:43'),(15,8,4,1,'2023-03-31 15:13:52','2023-03-31 15:13:52');

/*Table structure for table `kecheng_liuyan` */

DROP TABLE IF EXISTS `kecheng_liuyan`;

CREATE TABLE `kecheng_liuyan` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `kecheng_id` int(11) DEFAULT NULL COMMENT '课程',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `kecheng_liuyan_text` longtext COMMENT '留言内容',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '留言时间',
  `reply_text` longtext COMMENT '回复内容',
  `update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='课程留言';

/*Data for the table `kecheng_liuyan` */

insert  into `kecheng_liuyan`(`id`,`kecheng_id`,`yonghu_id`,`kecheng_liuyan_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,1,1,'留言内容1','2023-03-31 14:56:43','回复信息1','2023-03-31 14:56:43','2023-03-31 14:56:43'),(2,2,2,'留言内容2','2023-03-31 14:56:43','回复信息2','2023-03-31 14:56:43','2023-03-31 14:56:43'),(3,3,3,'留言内容3','2023-03-31 14:56:43','回复信息3','2023-03-31 14:56:43','2023-03-31 14:56:43'),(4,4,1,'留言内容4','2023-03-31 14:56:43','回复信息4','2023-03-31 14:56:43','2023-03-31 14:56:43'),(5,5,1,'留言内容5','2023-03-31 14:56:43','回复信息5','2023-03-31 14:56:43','2023-03-31 14:56:43'),(6,6,1,'留言内容6','2023-03-31 14:56:43','回复信息6','2023-03-31 14:56:43','2023-03-31 14:56:43'),(7,7,3,'留言内容7','2023-03-31 14:56:43','回复信息7','2023-03-31 14:56:43','2023-03-31 14:56:43'),(8,8,3,'留言内容8','2023-03-31 14:56:43','回复信息8','2023-03-31 14:56:43','2023-03-31 14:56:43'),(9,9,3,'留言内容9','2023-03-31 14:56:43','回复信息9','2023-03-31 14:56:43','2023-03-31 14:56:43'),(10,10,2,'留言内容10','2023-03-31 14:56:43','回复信息10','2023-03-31 14:56:43','2023-03-31 14:56:43'),(11,11,1,'留言内容11','2023-03-31 14:56:43','回复信息11','2023-03-31 14:56:43','2023-03-31 14:56:43'),(12,12,2,'留言内容12','2023-03-31 14:56:43','回复信息12','2023-03-31 14:56:43','2023-03-31 14:56:43'),(13,13,2,'留言内容13','2023-03-31 14:56:43','回复信息13','2023-03-31 14:56:43','2023-03-31 14:56:43'),(14,14,3,'留言内容14','2023-03-31 14:56:43','回复信息14','2023-03-31 14:56:43','2023-03-31 14:56:43'),(15,1,4,'hhhh','2023-03-31 15:13:33',NULL,NULL,'2023-03-31 15:13:33'),(16,8,4,'hhh','2023-03-31 15:13:49','hfsdhdf发广东省格式的','2023-03-31 15:15:41','2023-03-31 15:13:49');

/*Table structure for table `laoshi` */

DROP TABLE IF EXISTS `laoshi`;

CREATE TABLE `laoshi` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `username` varchar(200) DEFAULT NULL COMMENT '账户',
  `password` varchar(200) DEFAULT NULL COMMENT '密码',
  `laoshi_name` varchar(200) DEFAULT NULL COMMENT '老师姓名 Search111 ',
  `laoshi_phone` varchar(200) DEFAULT NULL COMMENT '老师手机号',
  `laoshi_id_number` varchar(200) DEFAULT NULL COMMENT '老师身份证号',
  `laoshi_photo` varchar(200) DEFAULT NULL COMMENT '老师头像',
  `sex_types` int(11) DEFAULT NULL COMMENT '性别',
  `laoshi_email` varchar(200) DEFAULT NULL COMMENT '老师邮箱',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='老师';

/*Data for the table `laoshi` */

insert  into `laoshi`(`id`,`username`,`password`,`laoshi_name`,`laoshi_phone`,`laoshi_id_number`,`laoshi_photo`,`sex_types`,`laoshi_email`,`create_time`) values (1,'a1','123456','老师姓名1','17703786901','410224199010102001','upload/laoshi1.jpg',2,'1@qq.com','2023-03-31 14:56:43'),(2,'a2','123456','老师姓名2','17703786902','410224199010102002','upload/laoshi2.jpg',2,'2@qq.com','2023-03-31 14:56:43'),(3,'a3','123456','老师姓名3','17703786903','410224199010102003','upload/laoshi3.jpg',2,'3@qq.com','2023-03-31 14:56:43');

/*Table structure for table `token` */

DROP TABLE IF EXISTS `token`;

CREATE TABLE `token` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `userid` bigint(20) NOT NULL COMMENT '老师id',
  `username` varchar(100) NOT NULL COMMENT '老师名',
  `tablename` varchar(100) DEFAULT NULL COMMENT '表名',
  `role` varchar(100) DEFAULT NULL COMMENT '角色',
  `token` varchar(200) NOT NULL COMMENT '密码',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
  `expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='token表';

/*Data for the table `token` */

insert  into `token`(`id`,`userid`,`username`,`tablename`,`role`,`token`,`addtime`,`expiratedtime`) values (1,1,'admin','users','管理员','h1ctonakpm119moex8ikxf0e3ize5jd7','2023-03-31 14:59:59','2023-03-31 16:14:14'),(2,1,'a1','yonghu','用户','d2tv8n0amhe73aiyyenmzf5zq0y7ldor','2023-03-31 15:12:08','2023-03-31 16:12:17'),(3,4,'a5','yonghu','用户','f01lee0ingfkfhm7wglf0qcpzxl4htn3','2023-03-31 15:13:04','2023-03-31 16:13:05'),(4,1,'a1','laoshi','老师','jefy84jn5msd9c0ewbgmbzjsywkkrqs5','2023-03-31 15:15:22','2023-03-31 16:15:23');

/*Table structure for table `users` */

DROP TABLE IF EXISTS `users`;

CREATE TABLE `users` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `username` varchar(100) NOT NULL COMMENT '老师名',
  `password` varchar(100) NOT NULL COMMENT '密码',
  `role` varchar(100) DEFAULT '管理员' COMMENT '角色',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='管理员';

/*Data for the table `users` */

insert  into `users`(`id`,`username`,`password`,`role`,`addtime`) values (1,'admin','admin','管理员','2023-03-31 14:54:53');

/*Table structure for table `yonghu` */

DROP TABLE IF EXISTS `yonghu`;

CREATE TABLE `yonghu` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `username` varchar(200) DEFAULT NULL COMMENT '账户',
  `password` varchar(200) DEFAULT NULL COMMENT '密码',
  `yonghu_name` varchar(200) DEFAULT NULL COMMENT '用户姓名 Search111 ',
  `yonghu_phone` varchar(200) DEFAULT NULL COMMENT '用户手机号',
  `yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '用户身份证号',
  `yonghu_photo` varchar(200) DEFAULT NULL COMMENT '用户头像',
  `sex_types` int(11) DEFAULT NULL COMMENT '性别',
  `yonghu_email` varchar(200) DEFAULT NULL COMMENT '用户邮箱',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='用户';

/*Data for the table `yonghu` */

insert  into `yonghu`(`id`,`username`,`password`,`yonghu_name`,`yonghu_phone`,`yonghu_id_number`,`yonghu_photo`,`sex_types`,`yonghu_email`,`create_time`) values (1,'a1','123456','用户姓名1','17703786901','410224199010102001','upload/yonghu1.jpg',1,'1@qq.com','2023-03-31 14:56:43'),(2,'a2','123456','用户姓名2','17703786902','410224199010102002','upload/yonghu2.jpg',1,'2@qq.com','2023-03-31 14:56:43'),(3,'a3','123456','用户姓名3','17703786903','410224199010102003','upload/yonghu3.jpg',1,'3@qq.com','2023-03-31 14:56:43'),(4,'a5','123456','张5','17788889999','444555888899999999','upload/1680246823791.jpg',2,'5@qq.com','2023-03-31 15:13:00');

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

5、关键代码

5.1错题表管理Controller模块 

/**
 * 错题表
 * 后端接口
 * @author 学长编程
 * @email
 * WeChat jsjbysj88
*/
@RestController
@Controller
@RequestMapping("/examrewrongquestion")
public class ExamrewrongquestionController {
    private static final Logger logger = LoggerFactory.getLogger(ExamrewrongquestionController.class);

    private static final String TABLE_NAME = "examrewrongquestion";

    @Autowired
    private ExamrewrongquestionService examrewrongquestionService;

    @Autowired
    private TokenService tokenService;

    @Autowired
    private DictionaryService dictionaryService;//字典
    @Autowired
    private ExampaperService exampaperService;//试卷
    @Autowired
    private ExampapertopicService exampapertopicService;//试卷选题
    @Autowired
    private ExamquestionService examquestionService;//试题表
    @Autowired
    private ExamrecordService examrecordService;//考试记录表
    @Autowired
    private ExamredetailsService examredetailsService;//答题详情表
    @Autowired
    private GonggaoService gonggaoService;//公告
    @Autowired
    private KechengService kechengService;//课程
    @Autowired
    private KechengCollectionService kechengCollectionService;//课程收藏
    @Autowired
    private KechengLiuyanService kechengLiuyanService;//课程留言
    @Autowired
    private LaoshiService laoshiService;//老师
    @Autowired
    private YonghuService yonghuService;//用户
    @Autowired
    private UsersService usersService;//管理员

    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        else if("老师".equals(role))
            params.put("laoshiId",request.getSession().getAttribute("userId"));
        CommonUtil.checkMap(params);
        PageUtils page = examrewrongquestionService.queryPage(params);

        //字典表数据转换
        List<ExamrewrongquestionView> list =(List<ExamrewrongquestionView>)page.getList();
        for(ExamrewrongquestionView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        ExamrewrongquestionEntity examrewrongquestion = examrewrongquestionService.selectById(id);
        if(examrewrongquestion !=null){
            //entity转view
            ExamrewrongquestionView view = new ExamrewrongquestionView();
            BeanUtils.copyProperties( examrewrongquestion , view );//把实体数据重构到view中
            //级联表 用户
            //级联表
            YonghuEntity yonghu = yonghuService.selectById(examrewrongquestion.getYonghuId());
            if(yonghu != null){
            BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setYonghuId(yonghu.getId());
            }
            //级联表 试卷
            //级联表
            ExampaperEntity exampaper = exampaperService.selectById(examrewrongquestion.getExampaperId());
            if(exampaper != null){
            BeanUtils.copyProperties( exampaper , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setExampaperId(exampaper.getId());
            }
            //级联表 试题表
            //级联表
            ExamquestionEntity examquestion = examquestionService.selectById(examrewrongquestion.getExamquestionId());
            if(examquestion != null){
            BeanUtils.copyProperties( examquestion , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
            view.setExamquestionId(examquestion.getId());
            }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody ExamrewrongquestionEntity examrewrongquestion, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,examrewrongquestion:{}",this.getClass().getName(),examrewrongquestion.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");
        else if("用户".equals(role))
            examrewrongquestion.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        Wrapper<ExamrewrongquestionEntity> queryWrapper = new EntityWrapper<ExamrewrongquestionEntity>()
            .eq("yonghu_id", examrewrongquestion.getYonghuId())
            .eq("exampaper_id", examrewrongquestion.getExampaperId())
            .eq("examquestion_id", examrewrongquestion.getExamquestionId())
            .eq("examredetails_myanswer", examrewrongquestion.getExamredetailsMyanswer())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ExamrewrongquestionEntity examrewrongquestionEntity = examrewrongquestionService.selectOne(queryWrapper);
        if(examrewrongquestionEntity==null){
            examrewrongquestion.setInsertTime(new Date());
            examrewrongquestion.setCreateTime(new Date());
            examrewrongquestionService.insert(examrewrongquestion);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody ExamrewrongquestionEntity examrewrongquestion, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        logger.debug("update方法:,,Controller:{},,examrewrongquestion:{}",this.getClass().getName(),examrewrongquestion.toString());
        ExamrewrongquestionEntity oldExamrewrongquestionEntity = examrewrongquestionService.selectById(examrewrongquestion.getId());//查询原先数据

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("用户".equals(role))
//            examrewrongquestion.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

            examrewrongquestionService.updateById(examrewrongquestion);//根据id更新
            return R.ok();
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        List<ExamrewrongquestionEntity> oldExamrewrongquestionList =examrewrongquestionService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        examrewrongquestionService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();
    }

    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
        try {
            List<ExamrewrongquestionEntity> examrewrongquestionList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            ExamrewrongquestionEntity examrewrongquestionEntity = new ExamrewrongquestionEntity();
//                            examrewrongquestionEntity.setYonghuId(Integer.valueOf(data.get(0)));   //用户id 要改的
//                            examrewrongquestionEntity.setExampaperId(Integer.valueOf(data.get(0)));   //试卷(外键) 要改的
//                            examrewrongquestionEntity.setExamquestionId(Integer.valueOf(data.get(0)));   //试题id(外键) 要改的
//                            examrewrongquestionEntity.setExamredetailsMyanswer(data.get(0));                    //考生作答 要改的
//                            examrewrongquestionEntity.setInsertTime(date);//时间
//                            examrewrongquestionEntity.setCreateTime(date);//时间
                            examrewrongquestionList.add(examrewrongquestionEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        examrewrongquestionService.insertBatch(examrewrongquestionList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }

    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        CommonUtil.checkMap(params);
        PageUtils page = examrewrongquestionService.queryPage(params);

        //字典表数据转换
        List<ExamrewrongquestionView> list =(List<ExamrewrongquestionView>)page.getList();
        for(ExamrewrongquestionView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段

        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        ExamrewrongquestionEntity examrewrongquestion = examrewrongquestionService.selectById(id);
            if(examrewrongquestion !=null){

                //entity转view
                ExamrewrongquestionView view = new ExamrewrongquestionView();
                BeanUtils.copyProperties( examrewrongquestion , view );//把实体数据重构到view中

                //级联表
                    YonghuEntity yonghu = yonghuService.selectById(examrewrongquestion.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
                //级联表
                    ExampaperEntity exampaper = exampaperService.selectById(examrewrongquestion.getExampaperId());
                if(exampaper != null){
                    BeanUtils.copyProperties( exampaper , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setExampaperId(exampaper.getId());
                }
                //级联表
                    ExamquestionEntity examquestion = examquestionService.selectById(examrewrongquestion.getExamquestionId());
                if(examquestion != null){
                    BeanUtils.copyProperties( examquestion , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setExamquestionId(examquestion.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }
    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody ExamrewrongquestionEntity examrewrongquestion, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,examrewrongquestion:{}",this.getClass().getName(),examrewrongquestion.toString());
        Wrapper<ExamrewrongquestionEntity> queryWrapper = new EntityWrapper<ExamrewrongquestionEntity>()
            .eq("yonghu_id", examrewrongquestion.getYonghuId())
            .eq("exampaper_id", examrewrongquestion.getExampaperId())
            .eq("examquestion_id", examrewrongquestion.getExamquestionId())
            .eq("examredetails_myanswer", examrewrongquestion.getExamredetailsMyanswer())
//            .notIn("examrewrongquestion_types", new Integer[]{102})
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ExamrewrongquestionEntity examrewrongquestionEntity = examrewrongquestionService.selectOne(queryWrapper);
        if(examrewrongquestionEntity==null){
            examrewrongquestion.setInsertTime(new Date());
            examrewrongquestion.setCreateTime(new Date());
        examrewrongquestionService.insert(examrewrongquestion);

            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

}

5.2 错题表管理Service模块 

package com.service;

import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.ExamrewrongquestionEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;

/**
 * 错题表 服务类
 */
public interface ExamrewrongquestionService extends IService<ExamrewrongquestionEntity> {

    /**
    * @param params 查询参数
    * @return 带分页的查询出来的数据
    */
     PageUtils queryPage(Map<String, Object> params);

}

5.3 错题表管理ServiceImpl模块

package com.service.impl;

import com.utils.StringUtil;
import com.service.DictionaryService;
import com.utils.ClazzDiff;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.util.*;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import com.utils.PageUtils;
import com.utils.Query;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import com.dao.ExamrewrongquestionDao;
import com.entity.ExamrewrongquestionEntity;
import com.service.ExamrewrongquestionService;
import com.entity.view.ExamrewrongquestionView;

/**
 * 错题表 服务实现类
 */
@Service("examrewrongquestionService")
@Transactional
public class ExamrewrongquestionServiceImpl extends ServiceImpl<ExamrewrongquestionDao, ExamrewrongquestionEntity> implements ExamrewrongquestionService {

    @Override
    public PageUtils queryPage(Map<String,Object> params) {
        Page<ExamrewrongquestionView> page =new Query<ExamrewrongquestionView>(params).getPage();
        page.setRecords(baseMapper.selectListView(page,params));
        return new PageUtils(page);
    }

}

5.4 错题表管理Dao模块

package com.dao;

import com.entity.ExamrewrongquestionEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;

import org.apache.ibatis.annotations.Param;
import com.entity.view.ExamrewrongquestionView;

/**
 * 错题表 Dao 接口
 *
 * @author 学长编程
 */
public interface ExamrewrongquestionDao extends BaseMapper<ExamrewrongquestionEntity> {

   List<ExamrewrongquestionView> selectListView(Pagination page,@Param("params")Map<String,Object> params);

}

6、论文目录结构

7、源码获取

感谢大家的阅读,如有不懂的问题可以评论区交流或私聊!

喜欢文章可以点赞、收藏、关注、评论

获取源码请私信

  • 35
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值