计算机毕业设计 基于Java的美食信息推荐系统的设计与实现 Java实战项目 附源码+文档+视频讲解

news2024/9/29 3:34:47

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

目录

1、项目介绍及开发技术

1.1 项目介绍

1.2 开发技术

2、系统功能设计结构图

3、功能截图

3.1 前台功能

3.2 后台功能

4、数据库表结构设计

5、关键代码

5.1 菜谱Controller模块 

5.2 菜谱Service模块 

5.3 菜谱ServiceImpl模块

5.4 菜谱Dao模块

6、论文目录结构

7、源码获取


1、项目介绍及开发技术

1.1 项目介绍

现代社会,美食不仅是满足人们基本生存需求的方式,更是一种文化和生活方式的体现。随着互联网技术的发展,人们获取美食信息的途径日益多样化,但信息的碎片化和个性化需求的增长使得用户在海量的美食信息中寻找到适合自己的内容变得困难。因此,开发一个基于Java的美食信息推荐系统,能够根据用户的个人喜好和饮食习惯,智能推荐个性化的菜谱和饮食资讯,对于提升用户体验和满足用户需求具有重要意义。该系统的设计和实现还将涉及到用户界面(UI)的友好性、系统的可扩展性、数据的安全性和隐私保护等方面,这些都是当前互联网应用开发中的关键问题。通过本课题的研究,不仅可以推动美食信息推荐技术的创新,还可以为相关领域的研究和实践提供参考,具有较高的学术价值和实际应用价值。

1.2 开发技术

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

2、系统功能设计结构图

管理员:登录、首页、个人中心(修改密码、个人信息)、管理员管理、用户管理、菜谱管理、论坛管理、饮食资讯管理、基础数据管理(菜谱类型管理、口味管理、资讯类型管理)、轮播图管理。

用户:注册、登录、首页、菜谱、论坛、饮食资讯、个人中心(个人中心、菜谱)

3、功能截图

3.1 前台功能

登录

首页

菜谱

 论坛

饮食资讯

个人中心

3.2 后台功能

登录

首页

菜谱管理

 论坛管理

饮食资讯管理

4、数据库表结构设计

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

USE `meishixinxituijianxitong`;

/*Table structure for table `caipu` */

DROP TABLE IF EXISTS `caipu`;

CREATE TABLE `caipu` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
  `caipu_name` varchar(200) DEFAULT NULL COMMENT '菜谱名称  Search111 ',
  `caipu_uuid_number` varchar(200) DEFAULT NULL COMMENT '菜谱编号',
  `caipu_photo` varchar(200) DEFAULT NULL COMMENT '菜谱照片',
  `caipu_weizhi` varchar(200) DEFAULT NULL COMMENT '小店位置',
  `caipu_video` varchar(200) DEFAULT NULL COMMENT '视频推荐',
  `caipu_jiage` decimal(10,2) DEFAULT NULL COMMENT '菜品价格 ',
  `caipu_types` int(11) DEFAULT NULL COMMENT '菜谱类型 Search111',
  `caipu_kouwei_types` int(11) DEFAULT NULL COMMENT '口味 Search111',
  `caipu_clicknum` int(11) DEFAULT NULL COMMENT '菜谱热度',
  `caipu_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=15 DEFAULT CHARSET=utf8 COMMENT='菜谱';

/*Data for the table `caipu` */

insert  into `caipu`(`id`,`caipu_name`,`caipu_uuid_number`,`caipu_photo`,`caipu_weizhi`,`caipu_video`,`caipu_jiage`,`caipu_types`,`caipu_kouwei_types`,`caipu_clicknum`,`caipu_content`,`insert_time`,`create_time`) values (1,'菜谱名称1','1677844866370','/upload/1677849348584.jpg','小店位置1','upload/video.mp4','787.31',1,4,309,'<p>菜品介绍1</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(2,'菜谱名称2','1677844866345','/upload/1677849334456.jpg','小店位置2','upload/video.mp4','754.58',4,2,25,'<p>菜品介绍2</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(4,'菜谱名称4','1677844866351','/upload/1677849308941.jpg','小店位置4','upload/video.mp4','544.14',1,3,105,'<p>菜品介绍4</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(5,'菜谱名称5','1677844866361','/upload/1677849293852.jpg','小店位置5','upload/video.mp4','558.14',4,2,314,'<p>菜品介绍5</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(6,'菜谱名称6','1677844866355','/upload/1677849281396.jpg','小店位置6','upload/video.mp4','65.88',3,3,385,'<p>菜品介绍6</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(7,'菜谱名称7','1677844866346','/upload/1677849269378.jpg','小店位置7','upload/video.mp4','926.45',2,1,388,'<p>菜品介绍7</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(8,'菜谱名称8','1677844866318','/upload/1677849256219.jpg','小店位置8','upload/video.mp4','378.70',4,1,148,'<p>菜品介绍8</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(9,'菜谱名称9','1677844866317','/upload/1677849239928.jpg','小店位置9','upload/video.mp4','247.47',2,2,254,'<p>菜品介绍9</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(10,'菜谱名称10','1677844866337','/upload/1677849225897.jpg','小店位置10','upload/video.mp4','425.23',2,4,86,'<p>菜品介绍10</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(11,'菜谱名称11','1677844866334','/upload/1677849214174.jpg','小店位置11','upload/video.mp4','575.76',3,4,30,'<p>菜品介绍11</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(12,'菜谱名称12','1677844866344','/upload/1677849203017.jpg','小店位置12','upload/video.mp4','331.12',1,4,405,'<p>菜品介绍12</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(13,'菜谱名称13','1677844866319','/upload/1677849191928.jpg','小店位置13','upload/video.mp4','128.45',3,1,385,'<p>菜品介绍13</p>','2023-03-03 20:01:06','2023-03-03 20:01:06'),(14,'菜谱名称14','1677844866330','/upload/1677849181906.jpg','小店位置14','upload/video.mp4','810.27',2,4,118,'<p>菜品介绍14</p>','2023-03-03 20:01:06','2023-03-03 20:01:06');

/*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','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=17 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-03 20:00:53'),(2,'sex_types','性别类型',2,'女',NULL,NULL,'2023-03-03 20:00:53'),(3,'caipu_types','菜谱类型',1,'菜谱类型1',NULL,NULL,'2023-03-03 20:00:53'),(4,'caipu_types','菜谱类型',2,'菜谱类型2',NULL,NULL,'2023-03-03 20:00:53'),(5,'caipu_types','菜谱类型',3,'菜谱类型3',NULL,NULL,'2023-03-03 20:00:53'),(6,'caipu_types','菜谱类型',4,'菜谱类型4',NULL,NULL,'2023-03-03 20:00:54'),(7,'caipu_kouwei_types','口味',1,'麻辣',NULL,NULL,'2023-03-03 20:00:54'),(8,'caipu_kouwei_types','口味',2,'鲜香',NULL,NULL,'2023-03-03 20:00:54'),(9,'caipu_kouwei_types','口味',3,'清淡',NULL,NULL,'2023-03-03 20:00:54'),(10,'caipu_kouwei_types','口味',4,'香辣',NULL,NULL,'2023-03-03 20:00:54'),(11,'forum_state_types','帖子状态',1,'发帖',NULL,NULL,'2023-03-03 20:00:54'),(12,'forum_state_types','帖子状态',2,'回帖',NULL,NULL,'2023-03-03 20:00:54'),(13,'forum_collection_types','收藏表类型',1,'收藏',NULL,NULL,'2023-03-03 20:00:54'),(14,'forum_collection_types','收藏表类型',2,'赞',NULL,NULL,'2023-03-03 20:00:54'),(15,'gonggao_types','资讯类型',1,'资讯类型1',NULL,NULL,'2023-03-03 20:00:54'),(16,'gonggao_types','资讯类型',2,'资讯类型2',NULL,NULL,'2023-03-03 20:00:54');

/*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 '发布内容',
  `zan_number` int(11) DEFAULT NULL COMMENT '赞',
  `cai_number` int(11) DEFAULT NULL 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=15 DEFAULT CHARSET=utf8 COMMENT='论坛';

/*Data for the table `forum` */

insert  into `forum`(`id`,`forum_name`,`yonghu_id`,`users_id`,`forum_content`,`zan_number`,`cai_number`,`super_ids`,`forum_state_types`,`insert_time`,`update_time`,`create_time`) values (1,'帖子标题1',1,NULL,'发布内容1',432,322,84,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(2,'帖子标题2',2,NULL,'发布内容2',343,257,420,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(3,'帖子标题3',2,NULL,'发布内容3',466,109,406,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(4,'帖子标题4',1,NULL,'发布内容4',352,219,247,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(5,'帖子标题5',2,NULL,'发布内容5',128,8,466,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(6,'帖子标题6',3,NULL,'发布内容6',253,404,144,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(7,'帖子标题7',3,NULL,'发布内容7',400,413,124,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(8,'帖子标题8',1,NULL,'发布内容8',236,411,31,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(9,'帖子标题9',3,NULL,'发布内容9',41,48,106,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(10,'帖子标题10',3,NULL,'发布内容10',242,156,145,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(11,'帖子标题11',2,NULL,'发布内容11',77,150,471,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(12,'帖子标题12',3,NULL,'发布内容12',330,195,204,1,'2023-03-03 20:01:06','2023-03-03 20:01:06','2023-03-03 20:01:06'),(13,'帖子标题13',1,NULL,'发布内容13',209,285,285,1,'2023-03-03 20:01:06','2023-03-03 21:25:48','2023-03-03 20:01:06'),(14,'帖子标题14',3,NULL,'发布内容14',206,424,36,1,'2023-03-03 20:01:06','2023-03-03 21:25:40','2023-03-03 20:01:06');

/*Table structure for table `forum_collection` */

DROP TABLE IF EXISTS `forum_collection`;

CREATE TABLE `forum_collection` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `forum_id` int(11) DEFAULT NULL COMMENT '论坛',
  `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
  `forum_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=18 DEFAULT CHARSET=utf8 COMMENT='论坛收藏';

/*Data for the table `forum_collection` */

insert  into `forum_collection`(`id`,`forum_id`,`yonghu_id`,`forum_collection_types`,`insert_time`,`create_time`) values (1,1,1,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(2,2,3,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(3,3,2,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(4,4,2,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(5,5,3,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(6,6,2,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(7,7,2,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(8,8,1,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(9,9,3,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(10,10,2,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(11,11,1,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(12,12,3,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(14,14,3,1,'2023-03-03 20:01:06','2023-03-03 20:01:06'),(17,14,1,2,'2023-03-03 21:25:40','2023-03-03 21:25:40');

/*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-03 20:01:06','资讯详情1','2023-03-03 20:01:06'),(2,'饮食资讯2','upload/gonggao2.jpg',2,'2023-03-03 20:01:06','资讯详情2','2023-03-03 20:01:06'),(3,'饮食资讯3','upload/gonggao3.jpg',2,'2023-03-03 20:01:06','资讯详情3','2023-03-03 20:01:06'),(4,'饮食资讯4','upload/gonggao4.jpg',2,'2023-03-03 20:01:06','资讯详情4','2023-03-03 20:01:06'),(5,'饮食资讯5','upload/gonggao5.jpg',1,'2023-03-03 20:01:06','资讯详情5','2023-03-03 20:01:06'),(6,'饮食资讯6','upload/gonggao6.jpg',1,'2023-03-03 20:01:06','资讯详情6','2023-03-03 20:01:06'),(7,'饮食资讯7','upload/gonggao7.jpg',2,'2023-03-03 20:01:06','资讯详情7','2023-03-03 20:01:06'),(8,'饮食资讯8','upload/gonggao8.jpg',1,'2023-03-03 20:01:06','资讯详情8','2023-03-03 20:01:06'),(9,'饮食资讯9','upload/gonggao9.jpg',1,'2023-03-03 20:01:06','资讯详情9','2023-03-03 20:01:06'),(10,'饮食资讯10','upload/gonggao10.jpg',1,'2023-03-03 20:01:06','资讯详情10','2023-03-03 20:01:06'),(11,'饮食资讯11','upload/gonggao11.jpg',1,'2023-03-03 20:01:06','资讯详情11','2023-03-03 20:01:06'),(12,'饮食资讯12','upload/gonggao12.jpg',1,'2023-03-03 20:01:06','资讯详情12','2023-03-03 20:01:06'),(13,'饮食资讯13','upload/gonggao13.jpg',2,'2023-03-03 20:01:06','资讯详情13','2023-03-03 20:01:06'),(14,'饮食资讯14','upload/gonggao14.jpg',2,'2023-03-03 20:01:06','资讯详情14','2023-03-03 20:01:06');

/*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','用户','0h4dii6p8mmxo0vz9bykwivn7mjvdbix','2023-03-03 20:02:23','2023-03-03 22:25:06'),(2,1,'admin','users','管理员','ejeuo5614pbti20vshgnx3n9tqmjtkvi','2023-03-03 20:44:05','2023-03-03 22:37:20');

/*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-03 20:00:53');

/*Table structure for table `yonghu` */

DROP TABLE IF EXISTS `yonghu`;

CREATE TABLE `yonghu` (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `username` varchar(200) DEFAULT NULL COMMENT '账户',
  `password` varchar(200) DEFAULT NULL COMMENT '密码',
  `yonghu_name` varchar(200) DEFAULT NULL COMMENT '用户姓名 Search111 ',
  `yonghu_phone` varchar(200) DEFAULT NULL COMMENT '用户手机号',
  `yonghu_id_number` varchar(200) DEFAULT NULL COMMENT '用户身份证号',
  `yonghu_photo` varchar(200) DEFAULT NULL COMMENT '用户头像',
  `sex_types` int(11) DEFAULT NULL COMMENT '性别',
  `yonghu_email` varchar(200) DEFAULT NULL COMMENT '电子邮箱',
  `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=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-03 20:01:06'),(2,'a2','123456','用户姓名2','17703786902','410224199010102002','upload/yonghu2.jpg',2,'2@qq.com','2023-03-03 20:01:06'),(3,'a3','123456','用户姓名3','17703786903','410224199010102003','upload/yonghu3.jpg',2,'3@qq.com','2023-03-03 20:01:06');

/*!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
*/
@RestController
@Controller
@RequestMapping("/caipu")
public class CaipuController {
    private static final Logger logger = LoggerFactory.getLogger(CaipuController.class);

    private static final String TABLE_NAME = "caipu";

    @Autowired
    private CaipuService caipuService;

    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表非注册的service
    //注册表service
    @Autowired
    private YonghuService yonghuService;


    /**
    * 后端列表
    */
    @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"));
        CommonUtil.checkMap(params);
        PageUtils page = caipuService.queryPage(params);

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

    }

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

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

        Wrapper<CaipuEntity> queryWrapper = new EntityWrapper<CaipuEntity>()
            .eq("caipu_name", caipu.getCaipuName())
            .eq("caipu_weizhi", caipu.getCaipuWeizhi())
            .eq("caipu_video", caipu.getCaipuVideo())
            .eq("caipu_types", caipu.getCaipuTypes())
            .eq("caipu_kouwei_types", caipu.getCaipuKouweiTypes())
            .eq("caipu_clicknum", caipu.getCaipuClicknum())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CaipuEntity caipuEntity = caipuService.selectOne(queryWrapper);
        if(caipuEntity==null){
            caipu.setCaipuClicknum(1);
            caipu.setInsertTime(new Date());
            caipu.setCreateTime(new Date());
            caipuService.insert(caipu);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

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

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        if("".equals(caipu.getCaipuPhoto()) || "null".equals(caipu.getCaipuPhoto())){
                caipu.setCaipuPhoto(null);
        }
        if("".equals(caipu.getCaipuVideo()) || "null".equals(caipu.getCaipuVideo())){
                caipu.setCaipuVideo(null);
        }

            caipuService.updateById(caipu);//根据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<CaipuEntity> oldCaipuList =caipuService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        caipuService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();
    }

    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        try {
            List<CaipuEntity> caipuList = 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){
                            //循环
                            CaipuEntity caipuEntity = new CaipuEntity();
//                            caipuEntity.setCaipuName(data.get(0));                    //菜谱名称 要改的
//                            caipuEntity.setCaipuUuidNumber(data.get(0));                    //菜谱编号 要改的
//                            caipuEntity.setCaipuPhoto("");//详情和图片
//                            caipuEntity.setCaipuWeizhi(data.get(0));                    //小店位置 要改的
//                            caipuEntity.setCaipuVideo(data.get(0));                    //视频推荐 要改的
//                            caipuEntity.setCaipuJiage(data.get(0));                    //菜品价格 要改的
//                            caipuEntity.setCaipuTypes(Integer.valueOf(data.get(0)));   //菜谱类型 要改的
//                            caipuEntity.setCaipuKouweiTypes(Integer.valueOf(data.get(0)));   //口味 要改的
//                            caipuEntity.setCaipuClicknum(Integer.valueOf(data.get(0)));   //菜谱热度 要改的
//                            caipuEntity.setCaipuContent("");//详情和图片
//                            caipuEntity.setInsertTime(date);//时间
//                            caipuEntity.setCreateTime(date);//时间
                            caipuList.add(caipuEntity);


                            //把要查询是否重复的字段放入map中
                                //菜谱编号
                                if(seachFields.containsKey("caipuUuidNumber")){
                                    List<String> caipuUuidNumber = seachFields.get("caipuUuidNumber");
                                    caipuUuidNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> caipuUuidNumber = new ArrayList<>();
                                    caipuUuidNumber.add(data.get(0));//要改的
                                    seachFields.put("caipuUuidNumber",caipuUuidNumber);
                                }
                        }

                        //查询是否重复
                         //菜谱编号
                        List<CaipuEntity> caipuEntities_caipuUuidNumber = caipuService.selectList(new EntityWrapper<CaipuEntity>().in("caipu_uuid_number", seachFields.get("caipuUuidNumber")));
                        if(caipuEntities_caipuUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(CaipuEntity s:caipuEntities_caipuUuidNumber){
                                repeatFields.add(s.getCaipuUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [菜谱编号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        caipuService.insertBatch(caipuList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }

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

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

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

                //点击数量加1
                caipu.setCaipuClicknum(caipu.getCaipuClicknum()+1);
                caipuService.updateById(caipu);

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

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


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody CaipuEntity caipu, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,caipu:{}",this.getClass().getName(),caipu.toString());
        Wrapper<CaipuEntity> queryWrapper = new EntityWrapper<CaipuEntity>()
            .eq("caipu_name", caipu.getCaipuName())
            .eq("caipu_uuid_number", caipu.getCaipuUuidNumber())
            .eq("caipu_weizhi", caipu.getCaipuWeizhi())
            .eq("caipu_video", caipu.getCaipuVideo())
            .eq("caipu_types", caipu.getCaipuTypes())
            .eq("caipu_kouwei_types", caipu.getCaipuKouweiTypes())
            .eq("caipu_clicknum", caipu.getCaipuClicknum())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        CaipuEntity caipuEntity = caipuService.selectOne(queryWrapper);
        if(caipuEntity==null){
            caipu.setInsertTime(new Date());
            caipu.setCreateTime(new Date());
        caipuService.insert(caipu);

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

/**
 * 菜谱 服务类
 */
public interface CaipuService extends IService<CaipuEntity> {

    /**
    * @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.CaipuDao;
import com.entity.CaipuEntity;
import com.service.CaipuService;
import com.entity.view.CaipuView;

/**
 * 菜谱 服务实现类
 */
@Service("caipuService")
@Transactional
public class CaipuServiceImpl extends ServiceImpl<CaipuDao, CaipuEntity> implements CaipuService {

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

}

5.4 菜谱Dao模块

package com.dao;

import com.entity.CaipuEntity;
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.CaipuView;

/**
 * 菜谱 Dao 接口
 *
 * @author  学长编程
 */
public interface CaipuDao extends BaseMapper<CaipuEntity> {

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

}

6、论文目录结构

7、源码获取

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

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

获取源码请私信

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1379249.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

openssl3.2 - 官方demo学习 - cipher - aesgcm.c

文章目录 openssl3.2 - 官方demo学习 - cipher - aesgcm.c概述笔记END openssl3.2 - 官方demo学习 - cipher - aesgcm.c 概述 AES-256-GCM 在这个实验中验证了EVP_CIPHER_fetch()中算法名称字符串的来源定位. 在工程中配置环境变量PATH, 且合并环境. 这样就不用将openSSL的D…

kubeadm安装kubernetes

基本环境配置 节点分为&#xff1a;master&#xff0c;node&#xff0c;masterlb(keepalived虚拟Ip&#xff0c;不占用机器) k8s-master01 16 k8s-node01 113 15 k8s-node02 115 进入之后直接选done done 上海 123456 设置静态ip 然后去虚拟机里面设置ens即可 查看命…

【算法与数据结构】62、LeetCode不同路径

文章目录 一、题目二、解法2.1 动态规划解法2.2 数论解法 三、完整代码 所有的LeetCode题解索引&#xff0c;可以看这篇文章——【算法和数据结构】LeetCode题解。 一、题目 二、解法 2.1 动态规划解法 思路分析&#xff1a;机器人只能向下或者向右移动&#xff0c;那么到达&a…

【金猿人物展】DataPipelineCEO陈诚:赋能数据应用,发挥未来生产力

‍ 陈诚 本文由DataPipelineCEO陈诚撰写并投递参与“数据猿年度金猿策划活动——2023大数据产业年度趋势人物榜单及奖项”评选。 大数据产业创新服务媒体 ——聚焦数据 改变商业 我们处在一个“见证奇迹”的时代。在过去的20年间&#xff0c;我们见证了大数据技术快速发展所带…

Linux中Docker数据管理的数据卷及挂载

目录 一、数据管理 1. 讲述 2. 应用场景 二、数据卷的应用 1. 命令 2. tomcat镜像 3. 挂载数据卷 4. 项目部署在数据卷 三、目录挂载 四、完善Tomcat配置 每篇一获 一、数据管理 1. 讲述 Docker 的数据管理主要涉及到两个方面&#xff1a;数据卷&#xff08;Volumes&#xff09…

AVL树(Java)

目录 一、什么是AVL树 二、AVL树的实现 AVL树的节点 AVL树的插入 AVL树的旋转 右单旋 左单旋 左右双旋 右左双旋 AVL树的验证 三、AVL树的性能分析 一、什么是AVL树 在了解什么是AVL树之前&#xff0c;我们先回顾二叉搜索树的概念 二叉搜索树&#xff08;二叉排序…

使用递归将list转换成tree

在产品研发时遇到这样一个问题&#xff0c;对于省市区县这类三级联动的数据&#xff0c;前端插件需要一次把数据全部返回&#xff0c;单纯的使用接口查询字节的没办法满足要求。 如果一次把数据全部返回&#xff0c;前端使用起来很麻烦需要一条一条的进行查找。 常规的使用方…

基于SPI的插件式开发实现方案之@AutoService+ServiceLoader介绍及Dolphinscheduler中的实际应用

1.插件化开发概述 插件化开发模式正在很多编程语言或技术框架中得以广泛的应用实践&#xff0c;比如大家熟悉的jenkins&#xff0c;docker可视化管理平台rancher&#xff0c;以及日常编码使用的编辑器idea&#xff0c;vscode等。 实现服务模块之间解耦的方式有很多&#xff0…

【漏洞复现】Apache Tomcat AJP文件包含漏洞(CVE-2020-1938)

Nx01 产品简介 Apache Tomcat 是一个免费的开源 Web 应用服务器&#xff0c;在中小型企业和个人开发用户中有着广泛的应用。 Nx02 漏洞描述 默认情况下&#xff0c;Apache Tomcat会开启AJP连接器&#xff0c;由于AJP服务&#xff08;8009端口&#xff09;存在文件包含缺陷&…

Spring Boot - Application Events 的发布顺序_AvailabilityChangeEvent

文章目录 Pre概述Code源码分析 Pre Spring Boot - Application Events 的发布顺序_ApplicationEnvironmentPreparedEvent 概述 Spring Boot 的广播机制是基于观察者模式实现的&#xff0c;它允许在 Spring 应用程序中发布和监听事件。这种机制的主要目的是为了实现解耦&#…

uniapp微信小程序投票系统实战 (SpringBoot2+vue3.2+element plus ) -投票帖子管理实现

锋哥原创的uniapp微信小程序投票系统实战&#xff1a; uniapp微信小程序投票系统实战课程 (SpringBoot2vue3.2element plus ) ( 火爆连载更新中... )_哔哩哔哩_bilibiliuniapp微信小程序投票系统实战课程 (SpringBoot2vue3.2element plus ) ( 火爆连载更新中... )共计21条视频…

数据仓库研发规范

数据仓库研发规范 本文将介绍数据仓库研发规范的阶段规划、角色职责和整体流程。 在大数据时代&#xff0c;规范地进行数据资产管理已成为推动互联网、大数据、人工智能和实体经济深度融合的必要条件。贴近业务属性、兼顾研发各阶段要点的研发规范&#xff0c;可以切实提高研…

Handsfree_ros_imu:ROS机器人IMU模块的get_imu_rpy.py文件学习记录

上一篇博客写了关于Handsfree_ros_imu&#xff1a;ROS机器人IMU模块ARHS姿态传感器&#xff08;A9&#xff09;Liunx系统Ubuntu20.04学习启动和运行教程&#xff1a; https://blog.csdn.net/qq_54900679/article/details/135539176?spm1001.2014.3001.5502 这次带来get_imu_r…

解决虚拟机的网络图标不见之问题

在WIN11中&#xff0c;启动虚拟机后&#xff0c;发现网络图标不见了&#xff0c;见下图&#xff1a; 1、打开虚拟机终端 输入“sudo server network-manager stop”&#xff0c;停止网络管理器 输入“cd /回车” &#xff0c; 切换到根目录 输入“cd var回车” &#xff0c;…

从零开始怎么做好产品宣传册

​随着市场竞争的日益激烈&#xff0c;产品宣传册作为企业与消费者之间的桥梁&#xff0c;其重要性日益凸显。一份优秀的宣传册不仅能提升企业的品牌形象&#xff0c;还能帮助企业更好地推广产品&#xff0c;吸引潜在客户。然而&#xff0c;很多企业在制作宣传册时却常常无从下…

webpack原理和逆向实战

文章目录 什么是webpackwebpack基本原理webpack代码分析webpack代码抠取webpack全模块自吐webpack自动扣取总结 什么是webpack webpack是一个现代 JavaScript 应用程序的静态模块打包器(module bundler)&#xff0c;负责分析翻译压缩打包代码。 上面的官网的一张示例图。 web…

了解及掌握二维数组

第一题: 题目&#xff08;单对角线和&#xff09;&#xff1a; 分析&#xff1a; 用结构体的话&#xff0c;太麻烦了&#xff0c;专业一点&#xff0c;用本该属于它的知识点来解决它。 代码&#xff1a; #include <iostream> using namespace std; int main() { int…

设计模式—行为型模式之状态模式

设计模式—行为型模式之状态模式 状态&#xff08;State&#xff09;模式&#xff1a;对有状态的对象&#xff0c;把复杂的“判断逻辑”提取到不同的状态对象中&#xff0c;允许状态对象在其内部状态发生改变时改变其行为。 状态模式包含以下主要角色&#xff1a; 环境类&am…

如何使用iPad通过Code App+cpolar实现公网地址远程访问vscode

&#x1f308;个人主页: Aileen_0v0 &#x1f525;热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法 ​&#x1f4ab;个人格言:“没有罗马,那就自己创造罗马~” 文章目录 1. 在iPad下载Code APP2.安装cpolar内网穿透2.1 cpolar 安装2.2 创建TCP隧道 3. iPad远程vscode4. …

基于多智能体点对点转换的分布式模型预测控制

matlab2020正常运行 基于多智能体点对点转换的分布式模型预测控制资源-CSDN文库