计算机毕业设计 基于HTML语言的环保网站的设计与实现 Java实战项目 附源码+文档+视频讲解

博主介绍:✌从事软件开发10年之余,专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌

🍅文末获取源码联系🍅

👇🏻 精彩专栏推荐订阅👇🏻 不然下次找不到哟
————————————————

计算机毕业设计题目《1000套》

目录

一.前言介绍

二.功能设计

三.功能截图

四.数据库表结构设计

五.关键代码

六.论文目录参考

七.源码获取

一.前言介绍

 本环保网站可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。本环保网站也是紧跟科学技术的发展,运用当今一流的软件技术实现软件系统的开发,让环保方面的信息完全通过管理系统实现科学化,规范化,程序化管理。从而帮助信息管理者节省事务处理的时间,降低数据处理的错误率,对于基础数据的管理水平可以起到促进作用,也从一定程度上对随意的业务管理工作进行了避免,同时,环保网站的数据库里面存储的各种动态信息,也为上层管理人员作出重大决策提供了大量的事实依据此环保网站使用跨平台的可开发大型商业网站的HTML技术,以及最受欢迎的RDBMS应用软件之一的MySQL数据库进行程序开发,后台采用Java语言的Spring Boot框架,前台采用VUE框架和layui样式,环保网站实现页面基本用HTML文件写作方式。

二.功能设计

 管理员功能有个人中心,管理员管理,濒危生物管理,地区管理,环保健康类型管理,保护法类型管理,公告类型管理,论坛管理,环保健康管理,环境保护管理,环境保护法管理,公告信息管理,轮播图管理。用户可以注册登录,修改个人信息,查看管理员发布的各种信息还可以留言,可以对濒危生物收藏,环保健康收藏,环境保护收藏等操作。

三.功能截图

管理员管理页面,管理员可以对管理员信息进行添加,修改,删除,查询操作。

 濒危生物管理页面,管理员可以对濒危生物信息进行添加,修改,删除,查询操作。

 论坛管理页面,管理员可以对论坛信息进行添加,修改,删除,查询操作。

 环保健康管理页面,管理员可以对环保健康信息进行添加,修改,删除,查询操作。

 环境保护页面,管理员可以对环境保护信息进行添加,修改,删除,查询操作。

 环境保护法管理页面,管理员可以对环境保护法信息进行添加,修改,删除,查询操作。

 公告信息管理页面,管理员可以对公告信息进行添加,修改,删除,查询操作。

 用户信息页面,管理员可以对用户信息进行添加,修改,删除,查询操作。

 个人中心页面,用户注册登录后点击个人中心可以修改个人资料和查看自己的收藏信息。

 濒危生物页面,用户可以在濒危生物界面查看濒危生物信息。

 环境保护信息页面,用户点击环境保护可以查看环境保护信息。

 公告信息页面,用户登录后可以点击公告信息里面查看公告信息。

四.数据库表结构设计

CREATE TABLE `binweishengwu` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `binweishengwu_name` varchar(200) DEFAULT NULL COMMENT '动物 Search111',
  `address_types` int(11) DEFAULT NULL COMMENT '所在地区 Search111',
  `binweishengwu_photo` varchar(200) DEFAULT NULL COMMENT '图片',
  `binweishengwu_size` varchar(200) DEFAULT NULL COMMENT '现存数量',
  `zan_number` int(11) DEFAULT NULL COMMENT '赞',
  `cai_number` int(11) DEFAULT NULL COMMENT '踩',
  `binweishengwu_content` text 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=6 DEFAULT CHARSET=utf8 COMMENT='濒危生物';

/*Data for the table `binweishengwu` */

insert  into `binweishengwu`(`id`,`binweishengwu_name`,`address_types`,`binweishengwu_photo`,`binweishengwu_size`,`zan_number`,`cai_number`,`binweishengwu_content`,`insert_time`,`create_time`) values (1,'动物1',2,'http://localhost:8080/huanbaowangzhan/upload/1650112322844.jpeg','现存数量1',234,163,'<p>介绍1</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(2,'动物2',1,'http://localhost:8080/huanbaowangzhan/upload/1650112312072.jpeg','现存数量2',290,321,'<p>介绍2</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(3,'动物3',3,'http://localhost:8080/huanbaowangzhan/upload/1650112303555.jpeg','现存数量3',493,190,'<p>介绍3</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(4,'动物4',2,'http://localhost:8080/huanbaowangzhan/upload/1650112296219.jpeg','现存数量4',293,67,'<p>介绍4</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(5,'动物5',3,'http://localhost:8080/huanbaowangzhan/upload/1650112288417.jpeg','现存数量5',387,197,'<p>介绍5</p>','2022-04-16 20:09:58','2022-04-16 20:09:58');

/*Table structure for table `binweishengwu_collection` */

DROP TABLE IF EXISTS `binweishengwu_collection`;

CREATE TABLE `binweishengwu_collection` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `binweishengwu_id` int(11) DEFAULT NULL COMMENT '濒危生物',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `binweishengwu_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=8 DEFAULT CHARSET=utf8 COMMENT='濒危生物收藏';

/*Data for the table `binweishengwu_collection` */

insert  into `binweishengwu_collection`(`id`,`binweishengwu_id`,`yonghu_id`,`binweishengwu_collection_types`,`insert_time`,`create_time`) values (1,1,2,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(2,2,3,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(3,3,3,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(4,4,2,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(5,5,3,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(6,3,1,2,'2022-04-16 20:39:37','2022-04-16 20:39:37');

/*Table structure for table `binweishengwu_liuyan` */

DROP TABLE IF EXISTS `binweishengwu_liuyan`;

CREATE TABLE `binweishengwu_liuyan` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `binweishengwu_id` int(11) DEFAULT NULL COMMENT '濒危生物',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `binweishengwu_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=7 DEFAULT CHARSET=utf8 COMMENT='濒危生物留言';

/*Data for the table `binweishengwu_liuyan` */

insert  into `binweishengwu_liuyan`(`id`,`binweishengwu_id`,`yonghu_id`,`binweishengwu_liuyan_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,1,3,'留言内容1','2022-04-16 20:09:58','回复信息1','2022-04-16 20:09:58','2022-04-16 20:09:58'),(2,2,1,'留言内容2','2022-04-16 20:09:58','回复信息2','2022-04-16 20:09:58','2022-04-16 20:09:58'),(3,3,1,'留言内容3','2022-04-16 20:09:58','回复信息3','2022-04-16 20:09:58','2022-04-16 20:09:58'),(4,4,1,'留言内容4','2022-04-16 20:09:58','回复信息4','2022-04-16 20:09:58','2022-04-16 20:09:58'),(5,5,3,'留言内容5','2022-04-16 20:09:58','回复信息5','2022-04-16 20:09:58','2022-04-16 20:09:58'),(6,3,1,'登录后才能看到详情页面 和留言','2022-04-16 20:39:54','管理回复123','2022-04-16 20:41:32','2022-04-16 20:39:54');

/*Table structure for table `config` */

DROP TABLE IF EXISTS `config`;

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','http://localhost:8080/huanbaowangzhan/upload/config1.jpg'),(2,'轮播图2','http://localhost:8080/huanbaowangzhan/upload/config2.jpg'),(3,'轮播图3','http://localhost:8080/huanbaowangzhan/upload/config3.jpg');

/*Table structure for table `dictionary` */

DROP TABLE IF EXISTS `dictionary`;

CREATE TABLE `dictionary` (
  `id` int(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=26 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,'address_types','地区',1,'地区1',NULL,NULL,'2022-04-16 20:09:05'),(2,'address_types','地区',2,'地区2',NULL,NULL,'2022-04-16 20:09:05'),(3,'address_types','地区',3,'地区3',NULL,NULL,'2022-04-16 20:09:05'),(4,'huanjingbaohu_collection_types','收藏表类型',1,'收藏',NULL,NULL,'2022-04-16 20:09:05'),(5,'huanjingbaohu_collection_types','收藏表类型',2,'赞',NULL,NULL,'2022-04-16 20:09:05'),(6,'huanjingbaohu_collection_types','收藏表类型',3,'踩',NULL,NULL,'2022-04-16 20:09:05'),(7,'binweishengwu_collection_types','收藏表类型',1,'收藏',NULL,NULL,'2022-04-16 20:09:05'),(8,'binweishengwu_collection_types','收藏表类型',2,'赞',NULL,NULL,'2022-04-16 20:09:05'),(9,'binweishengwu_collection_types','收藏表类型',3,'踩',NULL,NULL,'2022-04-16 20:09:05'),(10,'huanjingbaohufa_types','保护法类型',1,'保护法类型1',NULL,NULL,'2022-04-16 20:09:05'),(11,'huanjingbaohufa_types','保护法类型',2,'保护法类型2',NULL,NULL,'2022-04-16 20:09:05'),(12,'huanjingbaohufa_types','保护法类型',3,'保护法类型3',NULL,NULL,'2022-04-16 20:09:05'),(13,'huanbaojiankang_types','环保健康类型',1,'环保健康类型1',NULL,NULL,'2022-04-16 20:09:05'),(14,'huanbaojiankang_types','环保健康类型',2,'环保健康类型2',NULL,NULL,'2022-04-16 20:09:05'),(15,'huanbaojiankang_types','环保健康类型',3,'环保健康类型3',NULL,NULL,'2022-04-16 20:09:05'),(16,'huanbaojiankang_collection_types','收藏表类型',1,'收藏',NULL,NULL,'2022-04-16 20:09:05'),(17,'huanbaojiankang_collection_types','收藏表类型',2,'赞',NULL,NULL,'2022-04-16 20:09:05'),(18,'huanbaojiankang_collection_types','收藏表类型',3,'踩',NULL,NULL,'2022-04-16 20:09:05'),(19,'news_types','公告类型',1,'公告类型1',NULL,NULL,'2022-04-16 20:09:05'),(20,'news_types','公告类型',2,'公告类型2',NULL,NULL,'2022-04-16 20:09:05'),(21,'news_types','公告类型',3,'公告类型3',NULL,NULL,'2022-04-16 20:09:06'),(22,'sex_types','性别类型',1,'男',NULL,NULL,'2022-04-16 20:09:06'),(23,'sex_types','性别类型',2,'女',NULL,NULL,'2022-04-16 20:09:06'),(24,'forum_state_types','帖子状态',1,'发帖',NULL,NULL,'2022-04-16 20:09:06'),(25,'forum_state_types','帖子状态',2,'回帖',NULL,NULL,'2022-04-16 20:09:06');

/*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` text 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=9 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',1,NULL,'发布内容1',NULL,1,'2022-04-16 20:09:58','2022-04-16 20:09:58','2022-04-16 20:09:58'),(2,'帖子标题2',3,NULL,'发布内容2',NULL,1,'2022-04-16 20:09:58','2022-04-16 20:09:58','2022-04-16 20:09:58'),(3,'帖子标题3',2,NULL,'发布内容3',NULL,1,'2022-04-16 20:09:58','2022-04-16 20:09:58','2022-04-16 20:09:58'),(4,'帖子标题4',2,NULL,'发布内容4',NULL,1,'2022-04-16 20:09:58','2022-04-16 20:09:58','2022-04-16 20:09:58'),(5,'帖子标题5',3,NULL,'发布内容5',NULL,1,'2022-04-16 20:09:58','2022-04-16 20:09:58','2022-04-16 20:09:58'),(6,NULL,1,NULL,'评论内容111123',5,2,'2022-04-16 20:40:15',NULL,'2022-04-16 20:40:15'),(7,NULL,NULL,1,'管理评论123',5,2,'2022-04-16 20:41:47',NULL,'2022-04-16 20:41:47');

/*Table structure for table `huanbaojiankang` */

DROP TABLE IF EXISTS `huanbaojiankang`;

CREATE TABLE `huanbaojiankang` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `huanbaojiankang_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111',
  `huanbaojiankang_types` int(11) DEFAULT NULL COMMENT '环保健康类型 Search111',
  `huanbaojiankang_photo` varchar(200) DEFAULT NULL COMMENT '封面',
  `zan_number` int(11) DEFAULT NULL COMMENT '赞',
  `cai_number` int(11) DEFAULT NULL COMMENT '踩',
  `huanbaojiankang_content` text 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=6 DEFAULT CHARSET=utf8 COMMENT='环保健康';

/*Data for the table `huanbaojiankang` */

insert  into `huanbaojiankang`(`id`,`huanbaojiankang_name`,`huanbaojiankang_types`,`huanbaojiankang_photo`,`zan_number`,`cai_number`,`huanbaojiankang_content`,`insert_time`,`create_time`) values (1,'标题1',1,'http://localhost:8080/huanbaowangzhan/upload/1650112387392.jpeg',371,126,'<p>介绍1</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(2,'标题2',2,'http://localhost:8080/huanbaowangzhan/upload/1650112378955.jpeg',133,244,'<p>介绍2</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(3,'标题3',3,'http://localhost:8080/huanbaowangzhan/upload/1650112370907.jpeg',307,359,'<p>介绍3</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(4,'标题4',1,'http://localhost:8080/huanbaowangzhan/upload/1650112362784.jpeg',489,119,'<p>介绍4</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(5,'标题5',1,'http://localhost:8080/huanbaowangzhan/upload/1650112354631.jpeg',87,383,'<p>介绍5</p>','2022-04-16 20:09:58','2022-04-16 20:09:58');

/*Table structure for table `huanbaojiankang_collection` */

DROP TABLE IF EXISTS `huanbaojiankang_collection`;

CREATE TABLE `huanbaojiankang_collection` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `huanbaojiankang_id` int(11) DEFAULT NULL COMMENT '环保健康',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `huanbaojiankang_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=8 DEFAULT CHARSET=utf8 COMMENT='环保健康收藏';

/*Data for the table `huanbaojiankang_collection` */

insert  into `huanbaojiankang_collection`(`id`,`huanbaojiankang_id`,`yonghu_id`,`huanbaojiankang_collection_types`,`insert_time`,`create_time`) values (1,1,1,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(3,3,2,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(4,4,2,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(6,3,1,2,'2022-04-16 20:40:31','2022-04-16 20:40:31');

/*Table structure for table `huanbaojiankang_liuyan` */

DROP TABLE IF EXISTS `huanbaojiankang_liuyan`;

CREATE TABLE `huanbaojiankang_liuyan` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `huanbaojiankang_id` int(11) DEFAULT NULL COMMENT '环保健康',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `huanbaojiankang_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=7 DEFAULT CHARSET=utf8 COMMENT='环保健康留言';

/*Data for the table `huanbaojiankang_liuyan` */

insert  into `huanbaojiankang_liuyan`(`id`,`huanbaojiankang_id`,`yonghu_id`,`huanbaojiankang_liuyan_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,1,2,'留言内容1','2022-04-16 20:09:58','回复信息1','2022-04-16 20:09:58','2022-04-16 20:09:58'),(2,2,2,'留言内容2','2022-04-16 20:09:58','回复信息2','2022-04-16 20:09:58','2022-04-16 20:09:58'),(3,3,2,'留言内容3','2022-04-16 20:09:58','回复信息3','2022-04-16 20:09:58','2022-04-16 20:09:58'),(4,4,1,'留言内容4','2022-04-16 20:09:58','回复信息4','2022-04-16 20:09:58','2022-04-16 20:09:58'),(5,5,1,'留言内容5','2022-04-16 20:09:58','回复信息5','2022-04-16 20:09:58','2022-04-16 20:09:58'),(6,3,1,'留言11111','2022-04-16 20:40:30',NULL,NULL,'2022-04-16 20:40:30');

/*Table structure for table `huanjingbaohu` */

DROP TABLE IF EXISTS `huanjingbaohu`;

CREATE TABLE `huanjingbaohu` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `huanjingbaohu_name` varchar(200) DEFAULT NULL COMMENT '名称 Search111',
  `address_types` int(11) DEFAULT NULL COMMENT '地区 Search111',
  `huanjingbaohu_photo` varchar(200) DEFAULT NULL COMMENT '图片',
  `huanjingbaohu_size` varchar(200) DEFAULT NULL COMMENT '大小',
  `zan_number` int(11) DEFAULT NULL COMMENT '赞',
  `cai_number` int(11) DEFAULT NULL COMMENT '踩',
  `huanjingbaohu_content` text 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=6 DEFAULT CHARSET=utf8 COMMENT='环境保护';

/*Data for the table `huanjingbaohu` */

insert  into `huanjingbaohu`(`id`,`huanjingbaohu_name`,`address_types`,`huanjingbaohu_photo`,`huanjingbaohu_size`,`zan_number`,`cai_number`,`huanjingbaohu_content`,`insert_time`,`create_time`) values (1,'名称1',2,'http://localhost:8080/huanbaowangzhan/upload/1650112465892.jpeg','大小1',250,296,'<p>介绍1</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(2,'名称2',3,'http://localhost:8080/huanbaowangzhan/upload/1650112458858.jpeg','大小2',496,474,'<p>介绍2</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(3,'名称3',2,'http://localhost:8080/huanbaowangzhan/upload/1650112450975.jpeg','大小3',419,428,'<p>介绍3</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(4,'名称4',2,'http://localhost:8080/huanbaowangzhan/upload/1650112443477.jpeg','大小4',144,288,'<p>介绍4</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(5,'名称5',3,'http://localhost:8080/huanbaowangzhan/upload/1650112435202.jpeg','大小5',371,199,'<p>介绍5</p>','2022-04-16 20:09:58','2022-04-16 20:09:58');

/*Table structure for table `huanjingbaohu_collection` */

DROP TABLE IF EXISTS `huanjingbaohu_collection`;

CREATE TABLE `huanjingbaohu_collection` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `huanjingbaohu_id` int(11) DEFAULT NULL COMMENT '环境保护',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `huanjingbaohu_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=7 DEFAULT CHARSET=utf8 COMMENT='环境保护收藏';

/*Data for the table `huanjingbaohu_collection` */

insert  into `huanjingbaohu_collection`(`id`,`huanjingbaohu_id`,`yonghu_id`,`huanjingbaohu_collection_types`,`insert_time`,`create_time`) values (1,1,1,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(2,2,3,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(3,3,3,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(4,4,2,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(5,5,2,1,'2022-04-16 20:09:58','2022-04-16 20:09:58'),(6,4,1,2,'2022-04-16 20:40:44','2022-04-16 20:40:44');

/*Table structure for table `huanjingbaohu_liuyan` */

DROP TABLE IF EXISTS `huanjingbaohu_liuyan`;

CREATE TABLE `huanjingbaohu_liuyan` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `huanjingbaohu_id` int(11) DEFAULT NULL COMMENT '环境保护',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `huanjingbaohu_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=6 DEFAULT CHARSET=utf8 COMMENT='环境保护留言';

/*Data for the table `huanjingbaohu_liuyan` */

insert  into `huanjingbaohu_liuyan`(`id`,`huanjingbaohu_id`,`yonghu_id`,`huanjingbaohu_liuyan_text`,`insert_time`,`reply_text`,`update_time`,`create_time`) values (1,1,3,'留言内容1','2022-04-16 20:09:58','回复信息1','2022-04-16 20:09:58','2022-04-16 20:09:58'),(2,2,2,'留言内容2','2022-04-16 20:09:58','回复信息2','2022-04-16 20:09:58','2022-04-16 20:09:58'),(3,3,2,'留言内容3','2022-04-16 20:09:58','回复信息3','2022-04-16 20:09:58','2022-04-16 20:09:58'),(4,4,3,'留言内容4','2022-04-16 20:09:58','回复信息4','2022-04-16 20:09:58','2022-04-16 20:09:58'),(5,5,1,'留言内容5','2022-04-16 20:09:58','回复信息5','2022-04-16 20:09:58','2022-04-16 20:09:58');

/*Table structure for table `huanjingbaohufa` */

DROP TABLE IF EXISTS `huanjingbaohufa`;

CREATE TABLE `huanjingbaohufa` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `huanjingbaohufa_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111',
  `huanjingbaohufa_types` int(11) DEFAULT NULL COMMENT '保护法类型 Search111',
  `huanjingbaohufa_photo` varchar(200) DEFAULT NULL COMMENT '封面',
  `huanjingbaohufa_content` text COMMENT '详情',
  `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='濒危生物法';

/*Data for the table `huanjingbaohufa` */

insert  into `huanjingbaohufa`(`id`,`huanjingbaohufa_name`,`huanjingbaohufa_types`,`huanjingbaohufa_photo`,`huanjingbaohufa_content`,`insert_time`,`create_time`) values (1,'标题1',1,'http://localhost:8080/huanbaowangzhan/upload/1650112607688.jpeg','<p>详情1</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(2,'标题2',1,'http://localhost:8080/huanbaowangzhan/upload/1650112600474.jpeg','<p>详情2</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(3,'标题3',2,'http://localhost:8080/huanbaowangzhan/upload/1650112593159.jpg','<p>详情3</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(4,'标题4',2,'http://localhost:8080/huanbaowangzhan/upload/1650112585705.jpeg','<p>详情4</p>','2022-04-16 20:09:58','2022-04-16 20:09:58'),(5,'标题5',2,'http://localhost:8080/huanbaowangzhan/upload/1650112577297.jpeg','<p>详情5</p>','2022-04-16 20:09:58','2022-04-16 20:09:58');

/*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` text COMMENT '公告详情',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 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',3,'http://localhost:8080/huanbaowangzhan/upload/news1.jpg','2022-04-16 20:09:58','公告详情1','2022-04-16 20:09:58'),(2,'公告标题2',3,'http://localhost:8080/huanbaowangzhan/upload/news2.jpg','2022-04-16 20:09:58','公告详情2','2022-04-16 20:09:58'),(3,'公告标题3',3,'http://localhost:8080/huanbaowangzhan/upload/news3.jpg','2022-04-16 20:09:58','公告详情3','2022-04-16 20:09:58'),(4,'公告标题4',2,'http://localhost:8080/huanbaowangzhan/upload/news4.jpg','2022-04-16 20:09:58','公告详情4','2022-04-16 20:09:58'),(5,'公告标题5',1,'http://localhost:8080/huanbaowangzhan/upload/news5.jpg','2022-04-16 20:09:58','公告详情5','2022-04-16 20:09:58');

/*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','用户','k3rxhv0e5ms9hv08padtxu99pg3jquf6','2022-04-16 20:26:40','2022-04-16 21:42:14'),(2,1,'admin','users','管理员','az1z95l9m1zzp5ad7bkp92vneps2aa1i','2022-04-16 20:30:50','2022-04-16 21:30:51');

/*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','管理员','2022-05-01 00:00:00');

/*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(200) DEFAULT NULL COMMENT '头像',
  `yonghu_phone` varchar(200) DEFAULT NULL COMMENT '手机号',
  `yonghu_email` 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_email`,`sex_types`,`yonghu_delete`,`create_time`) values (1,'a1','123456','用户姓名1','http://localhost:8080/huanbaowangzhan/upload/yonghu1.jpg','17703786901','1@qq.com',2,1,'2022-04-16 20:09:58'),(2,'a2','123456','用户姓名2','http://localhost:8080/huanbaowangzhan/upload/yonghu2.jpg','17703786902','2@qq.com',1,1,'2022-04-16 20:09:58'),(3,'a3','123456','用户姓名3','http://localhost:8080/huanbaowangzhan/upload/yonghu3.jpg','17703786903','3@qq.com',1,1,'2022-04-16 20:09:58');

/*!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 */;

五.关键代码

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();
    }
}

六.论文目录参考

七.源码获取

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

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

获取源码请私信

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值