博主介绍:✌从事软件开发10年之余,专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌
🍅文末获取源码联系🍅
👇🏻 精彩专栏推荐订阅👇🏻 不然下次找不到哟
目录
一.前言介绍及开发技术
本课题研发的图书馆管理系统管理系统,就是提供图书馆管理系统信息处理的解决方案,它可以短时间处理完信息,并且这些信息都有专门的存储设备,而且数据的备份和迁移都可以设定为无人值守,从人力角度和信息处理角度以及信息安全角度,图书馆管理系统管理系统是完胜传统纸质操作的。该系统采用了Mysql数据库,Java语言,Spring Boot框架等技术进行编程实现。
二.功能设计
图书馆管理系统管理系统按照操作主体分为管理员和用户。管理员的功能包括字典管理、公告管理、资讯管理、图书管理、图书评论管理、图书借阅管理、图书归还申请管理、用户管理、阅览室管理、阅览室座位预约管理、管理员管理。用户的功能包括管理部门以及部门岗位信息,管理图书信息,培训信息,薪资信息等。
三.功能截图
图书馆里功能模块,管理员在图书管理界面中可以对界面中显示,可以对图书信息的图书状态进行查看,可以添加新的图书信息等。
图书借阅功能模块,管理员在图书借阅管理界面中查看奖罚种类信息,奖罚描述信息,可以导出图书借阅信息,新增图书借阅信息等。
阅览室预约管理功能模块,管理员在阅览室预约管理界面中新增阅览室预约,可以删除阅览室预约。
公告管理功能模块,管理员在公告管理界面查看公告,可以对公告的数据进行导出,可以添加新公告的信息,可以编辑公告信息,删除公告信息。
用户图书馆查看功能模块,用户可查看自己所选的图书以及所选图书的简介。
用户图书馆归还功能模块,用户可归还自己所借阅的图书。
公告管理功能模块
四.数据库表结构设计
sql
CREATE TABLE `config` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(100) NOT 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=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-14 09:44:08'),(2,'sex_types','性别类型',2,'女',NULL,NULL,'2023-03-14 09:44:08'),(3,'yuelanshi_types','阅览室类型',1,'阅览室类型1',NULL,NULL,'2023-03-14 09:44:08'),(4,'yuelanshi_types','阅览室类型',2,'阅览室类型2',NULL,NULL,'2023-03-14 09:44:08'),(5,'yuelanshi_types','阅览室类型',3,'阅览室类型3',NULL,NULL,'2023-03-14 09:44:08'),(6,'yuelanshi_types','阅览室类型',4,'阅览室类型4',NULL,NULL,'2023-03-14 09:44:08'),(7,'yuelanshi_order_types','订单类型',101,'已预约',NULL,NULL,'2023-03-14 09:44:08'),(8,'yuelanshi_order_types','订单类型',102,'已取消预约',NULL,NULL,'2023-03-14 09:44:08'),(9,'yuelanshi_order_types','订单类型',103,'已使用',NULL,NULL,'2023-03-14 09:44:08'),(10,'tushu_types','图书类型',1,'图书类型1',NULL,NULL,'2023-03-14 09:44:08'),(11,'tushu_types','图书类型',2,'图书类型2',NULL,NULL,'2023-03-14 09:44:08'),(12,'tushu_types','图书类型',3,'图书类型3',NULL,NULL,'2023-03-14 09:44:08'),(13,'tushu_types','图书类型',4,'图书类型4',NULL,NULL,'2023-03-14 09:44:08'),(14,'tushu_order_types','借阅类型',101,'已借阅',NULL,NULL,'2023-03-14 09:44:08'),(15,'tushu_order_types','借阅类型',102,'已归还',NULL,NULL,'2023-03-14 09:44:08'),(16,'tushu_yuyue_yesno_types','报名状态',1,'待审核',NULL,NULL,'2023-03-14 09:44:09'),(17,'tushu_yuyue_yesno_types','报名状态',2,'同意归还书籍',NULL,NULL,'2023-03-14 09:44:09'),(18,'tushu_yuyue_yesno_types','报名状态',3,'拒绝归还书籍',NULL,NULL,'2023-03-14 09:44:09'),(19,'gonggao_types','公告类型',1,'公告类型1',NULL,NULL,'2023-03-14 09:44:09'),(20,'gonggao_types','公告类型',2,'公告类型2',NULL,NULL,'2023-03-14 09:44:09'),(21,'news_types','资讯类型',1,'资讯类型1',NULL,NULL,'2023-03-14 09:44:09'),(22,'news_types','资讯类型',2,'资讯类型2',NULL,NULL,'2023-03-14 09:44:09');
/*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` text 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-14 09:45:42','公告详情1','2023-03-14 09:45:42'),(2,'公告名称2','upload/gonggao2.jpg',2,'2023-03-14 09:45:42','公告详情2','2023-03-14 09:45:42'),(3,'公告名称3','upload/gonggao3.jpg',2,'2023-03-14 09:45:42','公告详情3','2023-03-14 09:45:42'),(4,'公告名称4','upload/gonggao4.jpg',1,'2023-03-14 09:45:42','公告详情4','2023-03-14 09:45:42'),(5,'公告名称5','upload/gonggao5.jpg',1,'2023-03-14 09:45:42','公告详情5','2023-03-14 09:45:42'),(6,'公告名称6','upload/gonggao6.jpg',1,'2023-03-14 09:45:42','公告详情6','2023-03-14 09:45:42'),(7,'公告名称7','upload/gonggao7.jpg',1,'2023-03-14 09:45:42','公告详情7','2023-03-14 09:45:42'),(8,'公告名称8','upload/gonggao8.jpg',2,'2023-03-14 09:45:42','公告详情8','2023-03-14 09:45:42'),(9,'公告名称9','upload/gonggao9.jpg',2,'2023-03-14 09:45:42','公告详情9','2023-03-14 09:45:42'),(10,'公告名称10','upload/gonggao10.jpg',1,'2023-03-14 09:45:42','公告详情10','2023-03-14 09:45:42'),(11,'公告名称11','upload/gonggao11.jpg',1,'2023-03-14 09:45:42','公告详情11','2023-03-14 09:45:42'),(12,'公告名称12','upload/gonggao12.jpg',2,'2023-03-14 09:45:42','公告详情12','2023-03-14 09:45:42'),(13,'公告名称13','upload/gonggao13.jpg',1,'2023-03-14 09:45:42','公告详情13','2023-03-14 09:45:42'),(14,'公告名称14','upload/gonggao14.jpg',1,'2023-03-14 09:45:42','公告详情14','2023-03-14 09:45:42');
/*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_photo` varchar(200) DEFAULT NULL COMMENT '资讯图片 ',
`news_types` int(11) NOT NULL COMMENT '资讯类型 Search111 ',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '资讯发布时间 ',
`news_content` text 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_photo`,`news_types`,`insert_time`,`news_content`,`create_time`) values (1,'资讯名称1','upload/news1.jpg',2,'2023-03-14 09:45:42','资讯详情1','2023-03-14 09:45:42'),(2,'资讯名称2','upload/news2.jpg',2,'2023-03-14 09:45:42','资讯详情2','2023-03-14 09:45:42'),(3,'资讯名称3','upload/news3.jpg',2,'2023-03-14 09:45:42','资讯详情3','2023-03-14 09:45:42'),(4,'资讯名称4','upload/news4.jpg',2,'2023-03-14 09:45:42','资讯详情4','2023-03-14 09:45:42'),(5,'资讯名称5','upload/news5.jpg',1,'2023-03-14 09:45:42','资讯详情5','2023-03-14 09:45:42'),(6,'资讯名称6','upload/news6.jpg',2,'2023-03-14 09:45:42','资讯详情6','2023-03-14 09:45:42'),(7,'资讯名称7','upload/news7.jpg',1,'2023-03-14 09:45:42','资讯详情7','2023-03-14 09:45:42'),(8,'资讯名称8','upload/news8.jpg',1,'2023-03-14 09:45:42','资讯详情8','2023-03-14 09:45:42'),(9,'资讯名称9','upload/news9.jpg',2,'2023-03-14 09:45:42','资讯详情9','2023-03-14 09:45:42'),(10,'资讯名称10','upload/news10.jpg',2,'2023-03-14 09:45:42','资讯详情10','2023-03-14 09:45:42'),(11,'资讯名称11','upload/news11.jpg',1,'2023-03-14 09:45:42','资讯详情11','2023-03-14 09:45:42'),(12,'资讯名称12','upload/news12.jpg',1,'2023-03-14 09:45:42','资讯详情12','2023-03-14 09:45:42'),(13,'资讯名称13','upload/news13.jpg',1,'2023-03-14 09:45:42','资讯详情13','2023-03-14 09:45:42'),(14,'资讯名称14','upload/news14.jpg',1,'2023-03-14 09:45:42','资讯详情14','2023-03-14 09:45:42');
/*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','用户','hf7b4j3cp7patrxgy6klb3yjzxht2tup','2023-03-14 09:47:18','2023-03-14 11:41:40'),(2,1,'admin','users','管理员','nsq5uyzwrjcsu2061o1yqoqvhr4f0pse','2023-03-14 10:05:03','2023-03-14 11:43:17');
/*Table structure for table `tushu` */
DROP TABLE IF EXISTS `tushu`;
CREATE TABLE `tushu` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`tushu_name` varchar(200) DEFAULT NULL COMMENT '图书名称 Search111 ',
`tushu_uuid_number` varchar(200) DEFAULT NULL COMMENT '图书编号',
`tushu_photo` varchar(200) DEFAULT NULL COMMENT '图书照片',
`tushu_zuozhe` varchar(200) DEFAULT NULL COMMENT '图书作者',
`tushu_types` int(11) DEFAULT NULL COMMENT '图书类型 Search111',
`tushu_content` text COMMENT '图书介绍 ',
`chuban_time` timestamp NULL DEFAULT NULL COMMENT '出版时间',
`tushu_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 `tushu` */
insert into `tushu`(`id`,`tushu_name`,`tushu_uuid_number`,`tushu_photo`,`tushu_zuozhe`,`tushu_types`,`tushu_content`,`chuban_time`,`tushu_delete`,`insert_time`,`create_time`) values (1,'图书名称1','1678758342729','upload/tushu1.jpg','图书作者1',4,'图书介绍1','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(2,'图书名称2','1678758342727','upload/tushu2.jpg','图书作者2',4,'图书介绍2','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(3,'图书名称3','1678758342738','upload/tushu3.jpg','图书作者3',3,'图书介绍3','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(4,'图书名称4','1678758342736','upload/tushu4.jpg','图书作者4',3,'图书介绍4','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(5,'图书名称5','1678758342751','upload/tushu5.jpg','图书作者5',3,'图书介绍5','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(6,'图书名称6','1678758342773','upload/tushu6.jpg','图书作者6',4,'图书介绍6','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(7,'图书名称7','1678758342745','upload/tushu7.jpg','图书作者7',3,'图书介绍7','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(8,'图书名称8','1678758342768','upload/tushu8.jpg','图书作者8',3,'图书介绍8','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(9,'图书名称9','1678758342776','upload/tushu9.jpg','图书作者9',3,'图书介绍9','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(10,'图书名称10','1678758342765','upload/tushu10.jpg','图书作者10',1,'图书介绍10','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(11,'图书名称11','1678758342694','upload/tushu11.jpg','图书作者11',3,'图书介绍11','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(12,'图书名称12','1678758342774','upload/tushu12.jpg','图书作者12',3,'图书介绍12','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(13,'图书名称13','1678758342790','upload/tushu13.jpg','图书作者13',3,'图书介绍13','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(14,'图书名称14','1678758342791','upload/tushu14.jpg','图书作者14',4,'图书介绍14','2023-03-14 09:45:42',1,'2023-03-14 09:45:42','2023-03-14 09:45:42');
/*Table structure for table `tushu_liuyan` */
DROP TABLE IF EXISTS `tushu_liuyan`;
CREATE TABLE `tushu_liuyan` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`tushu_id` int(11) DEFAULT NULL COMMENT '图书',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`tushu_liuyan_text` text COMMENT '评论内容',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '评论时间',
`reply_text` text COMMENT '回复内容',
`update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='图书评论';
/*Data for the table `tushu_liuyan` */
insert into `tushu_liuyan`(`id`,`tushu_id`,`yonghu_id`,`tushu_liuyan_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,1,1,'评论内容1','2023-03-14 09:45:42','回复信息1','2023-03-14 09:45:42','2023-03-14 09:45:42'),(2,2,3,'评论内容2','2023-03-14 09:45:42','回复信息2','2023-03-14 09:45:42','2023-03-14 09:45:42'),(3,3,2,'评论内容3','2023-03-14 09:45:42','回复信息3','2023-03-14 09:45:42','2023-03-14 09:45:42'),(4,4,3,'评论内容4','2023-03-14 09:45:42','回复信息4','2023-03-14 09:45:42','2023-03-14 09:45:42'),(5,5,3,'评论内容5','2023-03-14 09:45:42','回复信息5','2023-03-14 09:45:42','2023-03-14 09:45:42'),(6,6,1,'评论内容6','2023-03-14 09:45:42','回复信息6','2023-03-14 09:45:42','2023-03-14 09:45:42'),(7,7,3,'评论内容7','2023-03-14 09:45:42','回复信息7','2023-03-14 09:45:42','2023-03-14 09:45:42'),(8,8,2,'评论内容8','2023-03-14 09:45:42','回复信息8','2023-03-14 09:45:42','2023-03-14 09:45:42'),(9,9,1,'评论内容9','2023-03-14 09:45:42','回复信息9','2023-03-14 09:45:42','2023-03-14 09:45:42'),(10,10,3,'评论内容10','2023-03-14 09:45:42','回复信息10','2023-03-14 09:45:42','2023-03-14 09:45:42'),(11,11,2,'评论内容11','2023-03-14 09:45:42','回复信息11','2023-03-14 09:45:42','2023-03-14 09:45:42'),(12,12,3,'评论内容12','2023-03-14 09:45:42','回复信息12','2023-03-14 09:45:42','2023-03-14 09:45:42'),(13,13,2,'评论内容13','2023-03-14 09:45:42','回复信息13','2023-03-14 09:45:42','2023-03-14 09:45:42'),(14,14,3,'评论内容14','2023-03-14 09:45:42','回复信息14','2023-03-14 09:45:42','2023-03-14 09:45:42'),(15,7,1,'112','2023-03-14 10:42:03','03\n\n','2023-03-14 10:43:36','2023-03-14 10:42:03');
/*Table structure for table `tushu_order` */
DROP TABLE IF EXISTS `tushu_order`;
CREATE TABLE `tushu_order` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`tushu_id` int(11) DEFAULT NULL COMMENT '图书',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`tushu_order_types` int(11) DEFAULT NULL COMMENT '借阅类型 Search111 ',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '订单创建时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='图书借阅';
/*Data for the table `tushu_order` */
insert into `tushu_order`(`id`,`tushu_id`,`yonghu_id`,`tushu_order_types`,`insert_time`,`create_time`) values (1,13,1,102,'2023-03-14 09:49:18','2023-03-14 09:49:18'),(2,13,1,101,'2023-03-14 10:29:27','2023-03-14 10:29:27'),(3,7,1,102,'2023-03-14 10:42:16','2023-03-14 10:42:16');
/*Table structure for table `tushu_yuyue` */
DROP TABLE IF EXISTS `tushu_yuyue`;
CREATE TABLE `tushu_yuyue` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`tushu_id` int(11) DEFAULT NULL COMMENT '图书',
`yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
`tushu_yuyue_text` text COMMENT '理由',
`tushu_yuyue_yesno_types` int(11) DEFAULT NULL COMMENT '报名状态 Search111 ',
`tushu_yuyue_yesno_text` text COMMENT '审核回复',
`tushu_yuyue_shenhe_time` timestamp NULL DEFAULT NULL COMMENT '审核时间',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '活动报名时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 listShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 COMMENT='图书归还申请';
/*Data for the table `tushu_yuyue` */
insert into `tushu_yuyue`(`id`,`tushu_id`,`yonghu_id`,`tushu_yuyue_text`,`tushu_yuyue_yesno_types`,`tushu_yuyue_yesno_text`,`tushu_yuyue_shenhe_time`,`insert_time`,`create_time`) values (1,1,1,'理由1',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(2,2,2,'理由2',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(3,3,3,'理由3',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(4,4,3,'理由4',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(5,5,2,'理由5',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(6,6,2,'理由6',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(7,7,1,'理由7',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(8,8,2,'理由8',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(9,9,3,'理由9',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(10,10,3,'理由10',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(11,11,1,'理由11',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(12,12,2,'理由12',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(13,13,3,'理由13',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(14,14,3,'理由14',1,NULL,NULL,'2023-03-14 09:45:42','2023-03-14 09:45:42'),(16,13,1,'11',2,'11','2023-03-14 10:23:51','2023-03-14 10:02:08','2023-03-14 10:02:08'),(17,7,1,'还书',2,'厚的','2023-03-14 10:43:50','2023-03-14 10:43:05','2023-03-14 10:43:05');
/*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-14 09:44:08');
/*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=4 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-14 09:45:42'),(2,'a2','123456','用户姓名2','17703786902','410224199010102002','upload/yonghu2.jpg',2,'2@qq.com','2023-03-14 09:45:42'),(3,'a3','123456','用户姓名3','17703786903','410224199010102003','upload/yonghu3.jpg',2,'3@qq.com','2023-03-14 09:45:42');
/*Table structure for table `yuelanshi` */
DROP TABLE IF EXISTS `yuelanshi`;
CREATE TABLE `yuelanshi` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`yuelanshi_name` varchar(200) DEFAULT NULL COMMENT '阅览室名称 Search111 ',
`yuelanshi_photo` varchar(200) DEFAULT NULL COMMENT '阅览室照片',
`yuelanshi_types` int(11) DEFAULT NULL COMMENT '阅览室类型 Search111',
`section_number` int(11) DEFAULT NULL COMMENT '房间',
`zuowei_number` int(11) DEFAULT NULL COMMENT '座位',
`yuelanshi_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`yuelanshi_content` text 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 `yuelanshi` */
insert into `yuelanshi`(`id`,`yuelanshi_name`,`yuelanshi_photo`,`yuelanshi_types`,`section_number`,`zuowei_number`,`yuelanshi_delete`,`yuelanshi_content`,`create_time`) values (1,'阅览室名称1','upload/yuelanshi1.jpg',4,5,20,1,'阅览室简介1','2023-03-14 09:45:42'),(2,'阅览室名称2','upload/yuelanshi2.jpg',1,2,20,1,'阅览室简介2','2023-03-14 09:45:42'),(3,'阅览室名称3','upload/yuelanshi3.jpg',4,2,20,1,'阅览室简介3','2023-03-14 09:45:42'),(4,'阅览室名称4','upload/yuelanshi4.jpg',3,2,20,1,'阅览室简介4','2023-03-14 09:45:42'),(5,'阅览室名称5','upload/yuelanshi5.jpg',4,5,20,1,'阅览室简介5','2023-03-14 09:45:42'),(6,'阅览室名称6','upload/yuelanshi6.jpg',3,2,20,1,'阅览室简介6','2023-03-14 09:45:42'),(7,'阅览室名称7','upload/yuelanshi7.jpg',1,5,20,1,'阅览室简介7','2023-03-14 09:45:42'),(8,'阅览室名称8','upload/yuelanshi8.jpg',1,1,20,1,'阅览室简介8','2023-03-14 09:45:42'),(9,'阅览室名称9','upload/yuelanshi9.jpg',3,2,20,1,'阅览室简介9','2023-03-14 09:45:42'),(10,'阅览室名称10','upload/yuelanshi10.jpg',3,4,20,1,'阅览室简介10','2023-03-14 09:45:42'),(11,'阅览室名称11','upload/yuelanshi11.jpg',4,2,20,1,'阅览室简介11','2023-03-14 09:45:42'),(12,'阅览室名称12','upload/yuelanshi12.jpg',3,2,20,1,'阅览室简介12','2023-03-14 09:45:42'),(13,'阅览室名称13','upload/yuelanshi13.jpg',2,5,20,1,'阅览室简介13','2023-03-14 09:45:42'),(14,'阅览室名称14','upload/yuelanshi14.jpg',1,4,20,1,'阅览室简介14','2023-03-14 09:45:42');
/*Data for the table `yuelanshi_order` */
insert into `yuelanshi_order`(`id`,`yuelanshi_order_uuid_number`,`yuelanshi_id`,`yonghu_id`,`yuelanshi_order_true_price`,`yuelanshi_order_types`,`buy_section_number`,`buy_zuowei_number`,`buy_yuelanshi_time`,`insert_time`,`create_time`) values (1,'1678760949824',13,1,'0.00',101,1,'7,8,14','2023-03-15','2023-03-14 10:29:10','2023-03-14 10:29:10'),(2,'1678761757399',13,1,'0.00',103,1,'3,12,17','2023-03-15','2023-03-14 10:42:37','2023-03-14 10:42:37');
/*!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 */;
五.关键代码
java
package com.controller;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;
/**
* 登录相关
*/
@RequestMapping("users")
@RestController
public class UserController{
@Autowired
private UserService userService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@PostMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
if(user==null || !user.getPassword().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody UserEntity user){
// ValidatorUtils.validateEntity(user);
if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
return R.error("用户已存在");
}
userService.insert(user);
return R.ok();
}
/**
* 退出
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
if(user==null) {
return R.error("账号不存在");
}
user.setPassword("123456");
userService.update(user,null);
return R.ok("密码已重置为:123456");
}
/**
* 列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,UserEntity user){
EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/list")
public R list( UserEntity user){
EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
ew.allEq(MPUtil.allEQMapPre( user, "user"));
return R.ok().put("data", userService.selectListView(ew));
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id){
UserEntity user = userService.selectById(id);
return R.ok().put("data", user);
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Long id = (Long)request.getSession().getAttribute("userId");
UserEntity user = userService.selectById(id);
return R.ok().put("data", user);
}
/**
* 保存
*/
@PostMapping("/save")
public R save(@RequestBody UserEntity user){
// ValidatorUtils.validateEntity(user);
if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
return R.error("用户已存在");
}
userService.insert(user);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody UserEntity user){
// ValidatorUtils.validateEntity(user);
UserEntity u = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername()));
if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) {
return R.error("用户名已存在。");
}
userService.updateById(user);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
userService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
六.论文目录参考
七.源码获取
感谢大家的阅读,如有不懂的问题可以评论区交流或私聊!
喜欢文章可以点赞、收藏、关注、评论 啦 、👇🏻获取源码+V:jsjbysj88👇🏻