计算机毕业设计 基于MVC的自习室管理和预约系统的设计与实现 Java实战项目 附源码+文档+视频讲解

发布时间:2024年01月18日

博主介绍:?从事软件开发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 项目介绍

传统办法管理信息首先需要花费的时间比较多,其次数据出错率比较高,而且对错误的数据进行更改也比较困难,最后,检索数据费事费力。因此,在计算机上安装自习室管理和预约系统软件来发挥其高效地信息处理的作用,可以规范信息管理流程,让管理工作可以系统化和程序化,同时,自习室管理和预约系统的有效运用可以帮助管理人员准确快速地处理信息。

自习室管理和预约系统在对开发工具的选择上也很慎重,为了便于开发实现,选择的开发工具为Eclipse,选择的数据库工具为Mysql,以此搭建开发环境实现自习室管理和预约系统的功能。自习室管理和预约系统是一款运用软件开发技术设计实现的应用系统,在信息处理上可以达到快速的目的,不管是针对数据添加,数据维护和统计,以及数据查询等处理要求,自习室管理和预约系统都可以轻松应对。

1.2 开发技术

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

2、系统功能设计结构图

3、功能截图

用户管理:用户信息的查询管理,可以删除用户信息、修改用户信息、新增用户信息,还进行了对用户名称的模糊查询的条件。

?自习室信息管理:查看已发布的自习室信息数据,修改自习室信息,自习室信息作废,即可删除,还进行了对自习室信息名称的模糊查询 自习室信息信息的类型查询等等一些条件。

公告类型管理:?根据公告类型进行条件查询,还可以对公告类型进行新增、修改、查询操作等等。

?公告信息管理:根据公告信息进行新增、修改、查询操作等等。

4、数据库表结构设计

CREATE DATABASE /*!32312 IF NOT EXISTS*/`zxsguanliyuyue` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `zxsguanliyuyue`;

/*Table structure for table `chat` */

DROP TABLE IF EXISTS `chat`;

CREATE TABLE `chat` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '提问用户',
  `chat_issue` varchar(200) DEFAULT NULL COMMENT '问题',
  `issue_time` timestamp NULL DEFAULT NULL COMMENT '问题时间 Search111',
  `chat_reply` varchar(200) DEFAULT NULL COMMENT '回复',
  `reply_time` timestamp NULL DEFAULT NULL COMMENT '回复时间 Search111',
  `zhuangtai_types` int(255) DEFAULT NULL COMMENT '状态',
  `chat_types` int(11) DEFAULT NULL COMMENT '数据类型',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='客服聊天';

/*Data for the table `chat` */

insert  into `chat`(`id`,`yonghu_id`,`chat_issue`,`issue_time`,`chat_reply`,`reply_time`,`zhuangtai_types`,`chat_types`,`insert_time`) values (1,1,'在线咨询','2023-03-24 17:32:18',NULL,NULL,2,1,'2023-03-24 17:32:19'),(2,1,NULL,NULL,'回复23123123','2023-03-24 17:33:42',NULL,2,'2023-03-24 17:33:43');

/*Table structure for table `config` */

DROP TABLE IF EXISTS `config`;

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,'轮播图1','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=123 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 (103,'zixishi_types','自习室类型',1,'自习室类型1',NULL,NULL,'2023-03-24 16:57:57'),(104,'zixishi_types','自习室类型',2,'自习室类型2',NULL,NULL,'2023-03-24 16:57:57'),(105,'zixishi_types','自习室类型',3,'自习室类型3',NULL,NULL,'2023-03-24 16:57:57'),(106,'zixishi_collection_types','收藏表类型',1,'收藏',NULL,NULL,'2023-03-24 16:57:57'),(107,'zixishi_collection_types','收藏表类型',2,'赞',NULL,NULL,'2023-03-24 16:57:57'),(108,'zixishi_collection_types','收藏表类型',3,'踩',NULL,NULL,'2023-03-24 16:57:57'),(109,'zixishi_order_types','订单类型',101,'已预约',NULL,NULL,'2023-03-24 16:57:57'),(110,'zixishi_order_types','订单类型',102,'已取消',NULL,NULL,'2023-03-24 16:57:57'),(111,'zixishi_order_types','订单类型',103,'已完成',NULL,NULL,'2023-03-24 16:57:57'),(112,'chat_types','数据类型',1,'问题',NULL,NULL,'2023-03-24 16:57:57'),(113,'chat_types','数据类型',2,'回复',NULL,NULL,'2023-03-24 16:57:57'),(114,'zhuangtai_types','状态',1,'未回复',NULL,NULL,'2023-03-24 16:57:57'),(115,'zhuangtai_types','状态',2,'已回复',NULL,NULL,'2023-03-24 16:57:57'),(116,'sex_types','性别类型',1,'男',NULL,NULL,'2023-03-24 16:57:58'),(117,'sex_types','性别类型',2,'女',NULL,NULL,'2023-03-24 16:57:58'),(118,'news_types','公告类型',1,'公告类型1',NULL,NULL,'2023-03-24 16:57:58'),(119,'news_types','公告类型',2,'公告类型2',NULL,NULL,'2023-03-24 16:57:58'),(120,'news_types','公告类型',3,'公告类型3',NULL,NULL,'2023-03-24 16:57:58'),(121,'forum_state_types','帖子状态',1,'发帖',NULL,NULL,'2023-03-24 16:57:58'),(122,'forum_state_types','帖子状态',2,'回帖',NULL,NULL,'2023-03-24 16:57:58');

/*Table structure for table `forum` */

DROP TABLE IF EXISTS `forum`;

CREATE TABLE `forum` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `forum_name` varchar(200) DEFAULT NULL COMMENT '帖子标题  Search111 ',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `users_id` int(11) DEFAULT NULL COMMENT '管理员',
  `forum_content` longtext COMMENT '发布内容',
  `super_ids` int(11) DEFAULT NULL COMMENT '父id',
  `forum_state_types` int(11) DEFAULT NULL COMMENT '帖子状态',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '发帖时间',
  `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show2',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='论坛';

/*Data for the table `forum` */

insert  into `forum`(`id`,`forum_name`,`yonghu_id`,`users_id`,`forum_content`,`super_ids`,`forum_state_types`,`insert_time`,`update_time`,`create_time`) values (1,'帖子标题1',2,NULL,'发布内容1',254,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(2,'帖子标题2',1,NULL,'发布内容2',34,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(3,'帖子标题3',2,NULL,'发布内容3',191,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(4,'帖子标题4',3,NULL,'发布内容4',284,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(5,'帖子标题5',2,NULL,'发布内容5',120,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(6,'帖子标题6',1,NULL,'发布内容6',44,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(7,'帖子标题7',1,NULL,'发布内容7',263,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(8,'帖子标题8',3,NULL,'发布内容8',408,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(9,'帖子标题9',2,NULL,'发布内容9',51,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(10,'帖子标题10',3,NULL,'发布内容10',358,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(11,'帖子标题11',2,NULL,'发布内容11',388,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(12,'帖子标题12',3,NULL,'发布内容12',421,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(13,'帖子标题13',1,NULL,'发布内容13',398,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(14,'帖子标题14',1,NULL,'发布内容14',112,1,'2023-03-24 16:58:05','2023-03-24 16:58:05','2023-03-24 16:58:05'),(15,NULL,1,NULL,'123123123',14,2,'2023-03-24 17:31:55',NULL,'2023-03-24 17:31:55'),(16,NULL,NULL,1,'论坛回复',14,2,'2023-03-24 17:33:55',NULL,'2023-03-24 17:33:55');

/*Table structure for table `news` */

DROP TABLE IF EXISTS `news`;

CREATE TABLE `news` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `news_name` varchar(200) DEFAULT NULL COMMENT '公告标题  Search111 ',
  `news_types` int(11) DEFAULT NULL COMMENT '公告类型  Search111 ',
  `news_photo` varchar(200) DEFAULT NULL COMMENT '公告图片',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
  `news_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 `news` */

insert  into `news`(`id`,`news_name`,`news_types`,`news_photo`,`insert_time`,`news_content`,`create_time`) values (1,'公告标题1',1,'upload/news1.jpg','2023-03-24 16:58:05','公告详情1','2023-03-24 16:58:05'),(2,'公告标题2',2,'upload/news2.jpg','2023-03-24 16:58:05','公告详情2','2023-03-24 16:58:05'),(3,'公告标题3',2,'upload/news3.jpg','2023-03-24 16:58:05','公告详情3','2023-03-24 16:58:05'),(4,'公告标题4',2,'upload/news4.jpg','2023-03-24 16:58:05','公告详情4','2023-03-24 16:58:05'),(5,'公告标题5',1,'upload/news5.jpg','2023-03-24 16:58:05','公告详情5','2023-03-24 16:58:05'),(6,'公告标题6',2,'upload/news6.jpg','2023-03-24 16:58:05','公告详情6','2023-03-24 16:58:05'),(7,'公告标题7',3,'upload/news7.jpg','2023-03-24 16:58:05','公告详情7','2023-03-24 16:58:05'),(8,'公告标题8',1,'upload/news8.jpg','2023-03-24 16:58:05','公告详情8','2023-03-24 16:58:05'),(9,'公告标题9',2,'upload/news9.jpg','2023-03-24 16:58:05','公告详情9','2023-03-24 16:58:05'),(10,'公告标题10',3,'upload/news10.jpg','2023-03-24 16:58:05','公告详情10','2023-03-24 16:58:05'),(11,'公告标题11',1,'upload/news11.jpg','2023-03-24 16:58:05','公告详情11','2023-03-24 16:58:05'),(12,'公告标题12',3,'upload/news12.jpg','2023-03-24 16:58:05','公告详情12','2023-03-24 16:58:05'),(13,'公告标题13',3,'upload/news13.jpg','2023-03-24 16:58:05','公告详情13','2023-03-24 16:58:05'),(14,'公告标题14',1,'upload/news14.jpg','2023-03-24 16:58:05','公告详情14','2023-03-24 16:58:05');

/*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=3 DEFAULT CHARSET=utf8 COMMENT='token表';

/*Data for the table `token` */

insert  into `token`(`id`,`userid`,`username`,`tablename`,`role`,`token`,`addtime`,`expiratedtime`) values (1,1,'a1','yonghu','用户','lc3utui3iam2kbp77vlksaxawlykkl2v','2023-03-24 17:16:11','2023-03-24 18:30:24'),(2,1,'admin','users','管理员','78q3kltlr34ai4kz30d3pxxhqp8tznjf','2023-03-24 17:27:27','2023-03-24 18:33:30');

/*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-24 16:57:57');

/*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_photo` varchar(255) DEFAULT NULL COMMENT '头像',
  `yonghu_phone` varchar(200) DEFAULT NULL COMMENT '用户手机号',
  `yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '用户身份证号 ',
  `sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111 ',
  `yonghu_delete` int(11) DEFAULT '1' COMMENT '假删',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='用户';

/*Data for the table `yonghu` */

insert  into `yonghu`(`id`,`username`,`password`,`yonghu_name`,`yonghu_photo`,`yonghu_phone`,`yonghu_id_number`,`sex_types`,`yonghu_delete`,`create_time`) values (1,'a1','123456','用户姓名1','upload/yonghu1.jpg','17703786901','410224199010102001',2,1,'2023-03-24 16:58:05'),(2,'a2','123456','用户姓名2','upload/yonghu2.jpg','17703786902','410224199010102002',1,1,'2023-03-24 16:58:05'),(3,'a3','123456','用户姓名3','upload/yonghu3.jpg','17703786903','410224199010102003',2,1,'2023-03-24 16:58:05');

/*Table structure for table `zixishi` */

DROP TABLE IF EXISTS `zixishi`;

CREATE TABLE `zixishi` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
  `zixishi_name` varchar(200) DEFAULT NULL COMMENT '自习室标题 Search111 ',
  `zixishi_photo` varchar(200) DEFAULT NULL COMMENT '自习室照片',
  `zixishi_types` int(11) DEFAULT NULL COMMENT '自习室类型 Search111',
  `zuowei_number` int(11) DEFAULT NULL COMMENT '座位',
  `zan_number` int(11) DEFAULT NULL COMMENT '赞',
  `cai_number` int(11) DEFAULT NULL COMMENT '踩',
  `zixishi_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
  `zixishi_content` longtext 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 `zixishi` */

insert  into `zixishi`(`id`,`zixishi_name`,`zixishi_photo`,`zixishi_types`,`zuowei_number`,`zan_number`,`cai_number`,`zixishi_delete`,`zixishi_content`,`create_time`) values (1,'自习室标题1','upload/zixishi1.jpg',2,20,22,13,1,'详情1','2023-03-24 16:58:05'),(2,'自习室标题2','upload/zixishi2.jpg',1,20,163,125,1,'详情2','2023-03-24 16:58:05'),(3,'自习室标题3','upload/zixishi3.jpg',1,20,425,474,1,'详情3','2023-03-24 16:58:05'),(4,'自习室标题4','upload/zixishi4.jpg',2,20,378,96,1,'详情4','2023-03-24 16:58:05'),(5,'自习室标题5','upload/zixishi5.jpg',3,20,264,40,1,'详情5','2023-03-24 16:58:05'),(6,'自习室标题6','upload/zixishi6.jpg',3,20,418,459,1,'详情6','2023-03-24 16:58:05'),(7,'自习室标题7','upload/zixishi7.jpg',2,20,288,473,1,'详情7','2023-03-24 16:58:05'),(8,'自习室标题8','upload/zixishi1.jpg',3,20,234,334,1,'详情8','2023-03-24 16:58:05'),(9,'自习室标题9','upload/zixishi2.jpg',3,20,61,29,1,'详情9','2023-03-24 16:58:05'),(10,'自习室标题10','upload/zixishi3.jpg',1,20,427,98,1,'详情10','2023-03-24 16:58:05'),(11,'自习室标题11','upload/zixishi4.jpg',1,20,154,98,1,'详情11','2023-03-24 16:58:05'),(12,'自习室标题12','upload/zixishi5.jpg',1,20,268,227,1,'详情12','2023-03-24 16:58:05'),(13,'自习室标题13','upload/zixishi6.jpg',2,20,161,258,1,'详情13','2023-03-24 16:58:05'),(14,'自习室标题14','upload/zixishi7.jpg',1,20,247,282,1,'详情14','2023-03-24 16:58:05');

/*Table structure for table `zixishi_collection` */

DROP TABLE IF EXISTS `zixishi_collection`;

CREATE TABLE `zixishi_collection` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `zixishi_id` int(11) DEFAULT NULL COMMENT '自习室',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `zixishi_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=17 DEFAULT CHARSET=utf8 COMMENT='自习室收藏';

/*Data for the table `zixishi_collection` */

insert  into `zixishi_collection`(`id`,`zixishi_id`,`yonghu_id`,`zixishi_collection_types`,`insert_time`,`create_time`) values (1,1,2,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(2,2,3,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(3,3,3,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(4,4,3,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(5,5,1,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(6,6,2,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(7,7,3,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(8,8,3,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(9,9,3,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(10,10,3,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(11,11,3,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(13,13,3,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(14,14,1,1,'2023-03-24 16:58:05','2023-03-24 16:58:05'),(15,11,1,2,'2023-03-24 17:31:39','2023-03-24 17:31:39'),(16,11,1,1,'2023-03-24 17:31:43','2023-03-24 17:31:43');

/*Table structure for table `zixishi_liuyan` */

DROP TABLE IF EXISTS `zixishi_liuyan`;

CREATE TABLE `zixishi_liuyan` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `zixishi_id` int(11) DEFAULT NULL COMMENT '自习室',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `zixishi_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 '创建时间 show3 listShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='自习室留言';

/*Data for the table `zixishi_liuyan` */

insert  into `zixishi_liuyan`(`id`,`zixishi_id`,`yonghu_id`,`zixishi_liuyan_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,1,3,'留言内容1','2023-03-24 16:58:05','回复信息1','2023-03-24 16:58:05','2023-03-24 16:58:05'),(2,2,2,'留言内容2','2023-03-24 16:58:05','回复信息2','2023-03-24 16:58:05','2023-03-24 16:58:05'),(3,3,2,'留言内容3','2023-03-24 16:58:05','回复信息3','2023-03-24 16:58:05','2023-03-24 16:58:05'),(4,4,2,'留言内容4','2023-03-24 16:58:05','回复信息4','2023-03-24 16:58:05','2023-03-24 16:58:05'),(5,5,1,'留言内容5','2023-03-24 16:58:05','回复信息5','2023-03-24 16:58:05','2023-03-24 16:58:05'),(6,6,3,'留言内容6','2023-03-24 16:58:05','回复信息6','2023-03-24 16:58:05','2023-03-24 16:58:05'),(7,7,1,'留言内容7','2023-03-24 16:58:05','回复信息7','2023-03-24 16:58:05','2023-03-24 16:58:05'),(8,8,1,'留言内容8','2023-03-24 16:58:05','回复信息8','2023-03-24 16:58:05','2023-03-24 16:58:05'),(9,9,3,'留言内容9','2023-03-24 16:58:05','回复信息9','2023-03-24 16:58:05','2023-03-24 16:58:05'),(10,10,2,'留言内容10','2023-03-24 16:58:05','回复信息10','2023-03-24 16:58:05','2023-03-24 16:58:05'),(11,11,1,'留言内容11','2023-03-24 16:58:05','回复信息11','2023-03-24 16:58:05','2023-03-24 16:58:05'),(12,12,3,'留言内容12','2023-03-24 16:58:05','回复信息12','2023-03-24 16:58:05','2023-03-24 16:58:05'),(13,13,2,'留言内容13','2023-03-24 16:58:05','回复信息13','2023-03-24 16:58:05','2023-03-24 16:58:05'),(14,14,3,'留言内容14','2023-03-24 16:58:05','回复信息14留言回复2123123','2023-03-24 17:34:13','2023-03-24 16:58:05');

/*Table structure for table `zixishi_order` */

DROP TABLE IF EXISTS `zixishi_order`;

CREATE TABLE `zixishi_order` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `zixishi_order_uuid_number` varchar(200) DEFAULT NULL COMMENT '订单号 Search111 ',
  `zixishi_id` int(11) DEFAULT NULL COMMENT '自习室',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `zixishi_order_types` int(11) DEFAULT NULL COMMENT '订单类型 Search111',
  `buy_zuowei_number` varchar(200) DEFAULT NULL COMMENT '预定的座位',
  `buy_zuowei_time` date DEFAULT NULL COMMENT '预定日期',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '订单创建时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='订座订单';

/*Data for the table `zixishi_order` */

insert  into `zixishi_order`(`id`,`zixishi_order_uuid_number`,`zixishi_id`,`yonghu_id`,`zixishi_order_types`,`buy_zuowei_number`,`buy_zuowei_time`,`insert_time`,`create_time`) values (1,'1679649720873',13,1,103,'6,7','2023-03-24','2023-03-24 17:22:01','2023-03-24 17:22:01'),(2,'1679650256500',11,1,102,'4,5,6','2023-03-24','2023-03-24 17:30:57','2023-03-24 17:30:57');

/*!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("/zixishi")
public class ZixishiController {
    private static final Logger logger = LoggerFactory.getLogger(ZixishiController.class);

    private static final String TABLE_NAME = "zixishi";

    @Autowired
    private ZixishiService zixishiService;


    @Autowired
    private TokenService tokenService;

    @Autowired
    private ChatService chatService;//客服聊天
    @Autowired
    private DictionaryService dictionaryService;//字典表
    @Autowired
    private ForumService forumService;//论坛
    @Autowired
    private NewsService newsService;//通知公告
    @Autowired
    private YonghuService yonghuService;//用户
    @Autowired
    private ZixishiCollectionService zixishiCollectionService;//自习室收藏
    @Autowired
    private ZixishiLiuyanService zixishiLiuyanService;//自习室留言
    @Autowired
    private ZixishiOrderService zixishiOrderService;//订座订单
    @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"));
        params.put("zixishiDeleteStart",1);params.put("zixishiDeleteEnd",1);
        CommonUtil.checkMap(params);
        PageUtils page = zixishiService.queryPage(params);

        //字典表数据转换
        List<ZixishiView> list =(List<ZixishiView>)page.getList();
        for(ZixishiView 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);
        ZixishiEntity zixishi = zixishiService.selectById(id);
        if(zixishi !=null){
            //entity转view
            ZixishiView view = new ZixishiView();
            BeanUtils.copyProperties( zixishi , view );//把实体数据重构到view中
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");

        Wrapper<ZixishiEntity> queryWrapper = new EntityWrapper<ZixishiEntity>()
            .eq("zixishi_name", zixishi.getZixishiName())
            .eq("zixishi_types", zixishi.getZixishiTypes())
            .eq("zuowei_number", zixishi.getZuoweiNumber())
            .eq("zan_number", zixishi.getZanNumber())
            .eq("cai_number", zixishi.getCaiNumber())
            .eq("zixishi_delete", 1)
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ZixishiEntity zixishiEntity = zixishiService.selectOne(queryWrapper);
        if(zixishiEntity==null){
            zixishi.setZixishiDelete(1);
            zixishi.setCreateTime(new Date());
            zixishiService.insert(zixishi);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        if("".equals(zixishi.getZixishiPhoto()) || "null".equals(zixishi.getZixishiPhoto())){
                zixishi.setZixishiPhoto(null);
        }

            zixishiService.updateById(zixishi);//根据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<ZixishiEntity> oldZixishiList =zixishiService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        ArrayList<ZixishiEntity> list = new ArrayList<>();
        for(Integer id:ids){
            ZixishiEntity zixishiEntity = new ZixishiEntity();
            zixishiEntity.setId(id);
            zixishiEntity.setZixishiDelete(2);
            list.add(zixishiEntity);
        }
        if(list != null && list.size() >0){
            zixishiService.updateBatchById(list);
        }

        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");
        try {
            List<ZixishiEntity> zixishiList = 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){
                            //循环
                            ZixishiEntity zixishiEntity = new ZixishiEntity();
//                            zixishiEntity.setZixishiName(data.get(0));                    //自习室标题 要改的
//                            zixishiEntity.setZixishiPhoto("");//详情和图片
//                            zixishiEntity.setZixishiTypes(Integer.valueOf(data.get(0)));   //自习室类型 要改的
//                            zixishiEntity.setZuoweiNumber(Integer.valueOf(data.get(0)));   //座位 要改的
//                            zixishiEntity.setZanNumber(Integer.valueOf(data.get(0)));   //赞 要改的
//                            zixishiEntity.setCaiNumber(Integer.valueOf(data.get(0)));   //踩 要改的
//                            zixishiEntity.setZixishiDelete(1);//逻辑删除字段
//                            zixishiEntity.setZixishiContent("");//详情和图片
//                            zixishiEntity.setCreateTime(date);//时间
                            zixishiList.add(zixishiEntity);


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

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



    /**
    * 个性推荐
    */
    @IgnoreAuth
    @RequestMapping("/gexingtuijian")
    public R gexingtuijian(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("gexingtuijian方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        CommonUtil.checkMap(params);
        List<ZixishiView> returnZixishiViewList = new ArrayList<>();

        //查询订单
        Map<String, Object> params1 = new HashMap<>(params);params1.put("sort","id");params1.put("yonghuId",request.getSession().getAttribute("userId"));
        PageUtils pageUtils = zixishiOrderService.queryPage(params1);
        List<ZixishiOrderView> orderViewsList =(List<ZixishiOrderView>)pageUtils.getList();
        Map<Integer,Integer> typeMap=new HashMap<>();//购买的类型list
        for(ZixishiOrderView orderView:orderViewsList){
            Integer zixishiTypes = orderView.getZixishiTypes();
            if(typeMap.containsKey(zixishiTypes)){
                typeMap.put(zixishiTypes,typeMap.get(zixishiTypes)+1);
            }else{
                typeMap.put(zixishiTypes,1);
            }
        }
        List<Integer> typeList = new ArrayList<>();//排序后的有序的类型 按最多到最少
        typeMap.entrySet().stream().sorted((o1, o2) -> o2.getValue() - o1.getValue()).forEach(e -> typeList.add(e.getKey()));//排序
        Integer limit = Integer.valueOf(String.valueOf(params.get("limit")));
        for(Integer type:typeList){
            Map<String, Object> params2 = new HashMap<>(params);params2.put("zixishiTypes",type);
            PageUtils pageUtils1 = zixishiService.queryPage(params2);
            List<ZixishiView> zixishiViewList =(List<ZixishiView>)pageUtils1.getList();
            returnZixishiViewList.addAll(zixishiViewList);
            if(returnZixishiViewList.size()>= limit) break;//返回的推荐数量大于要的数量 跳出循环
        }
        //正常查询出来商品,用于补全推荐缺少的数据
        PageUtils page = zixishiService.queryPage(params);
        if(returnZixishiViewList.size()<limit){//返回数量还是小于要求数量
            int toAddNum = limit - returnZixishiViewList.size();//要添加的数量
            List<ZixishiView> zixishiViewList =(List<ZixishiView>)page.getList();
            for(ZixishiView zixishiView:zixishiViewList){
                Boolean addFlag = true;
                for(ZixishiView returnZixishiView:returnZixishiViewList){
                    if(returnZixishiView.getId().intValue() ==zixishiView.getId().intValue()) addFlag=false;//返回的数据中已存在此商品
                }
                if(addFlag){
                    toAddNum=toAddNum-1;
                    returnZixishiViewList.add(zixishiView);
                    if(toAddNum==0) break;//够数量了
                }
            }
        }else {
            returnZixishiViewList = returnZixishiViewList.subList(0, limit);
        }

        for(ZixishiView c:returnZixishiViewList)
            dictionaryService.dictionaryConvert(c, request);
        page.setList(returnZixishiViewList);
        return R.ok().put("data", page);
    }

    /**
    * 前端列表
    */
    @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 = zixishiService.queryPage(params);

        //字典表数据转换
        List<ZixishiView> list =(List<ZixishiView>)page.getList();
        for(ZixishiView 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);
        ZixishiEntity zixishi = zixishiService.selectById(id);
            if(zixishi !=null){


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

                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody ZixishiEntity zixishi, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,zixishi:{}",this.getClass().getName(),zixishi.toString());
        Wrapper<ZixishiEntity> queryWrapper = new EntityWrapper<ZixishiEntity>()
            .eq("zixishi_name", zixishi.getZixishiName())
            .eq("zixishi_types", zixishi.getZixishiTypes())
            .eq("zuowei_number", zixishi.getZuoweiNumber())
            .eq("zan_number", zixishi.getZanNumber())
            .eq("cai_number", zixishi.getCaiNumber())
            .eq("zixishi_delete", zixishi.getZixishiDelete())
//            .notIn("zixishi_types", new Integer[]{102})
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ZixishiEntity zixishiEntity = zixishiService.selectOne(queryWrapper);
        if(zixishiEntity==null){
                zixishi.setZanNumber(1);
                zixishi.setCaiNumber(1);
            zixishi.setZixishiDelete(1);
            zixishi.setCreateTime(new Date());
        zixishiService.insert(zixishi);

            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.ZixishiEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;

/**
 * 自习室信息 服务类
 */
public interface ZixishiService extends IService<ZixishiEntity> {

    /**
    * @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.ZixishiDao;
import com.entity.ZixishiEntity;
import com.service.ZixishiService;
import com.entity.view.ZixishiView;

/**
 * 自习室信息 服务实现类
 */
@Service("zixishiService")
@Transactional
public class ZixishiServiceImpl extends ServiceImpl<ZixishiDao, ZixishiEntity> implements ZixishiService {

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

}

5.4?自习室信息Dao模块

package com.dao;

import com.entity.ZixishiEntity;
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.ZixishiView;

/**
 * 自习室信息 Dao 接口
 *
 * @author 
 */
public interface ZixishiDao extends BaseMapper<ZixishiEntity> {

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

}

6、论文目录结构

7、源码获取

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

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

获取源码请私信

文章来源:https://blog.csdn.net/m0_74181697/article/details/135663163
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。