• 计算机毕业设计 基于SpringBoot餐厅点餐系统的设计与实现 Java实战项目 附源码+文档+视频讲解


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

    🍅文末获取源码联系🍅

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

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

    目录

    一.前言介绍

    二.功能设计

    三.功能截图

    3.1前台功能模块

    3.2管理员功能模块

    3.3用户功能模块

    四.数据库表结构设计

    五.关键代码

    六.论文目录参考

    七.源码获取

    一.前言介绍

     以往的餐厅点餐系统相关信息管理,都是工作人员手工统计。这种方式不但时效性低,而且需要查找和变更的时候很不方便。随着现代网络技术发展,对于餐厅点餐系统的设计现在正处于发展的阶段,所以对的要求也是比较严格的,要从系统的功能和用户实际需求来进行对系统制定开发的发展方式,依靠网络技术的的快速发展和现代通讯技术的结合为人们带来方便,可以方便用户网上查看,还可以通过这些技术实现在线餐厅点餐系统等过程。

    二.功能设计

     本餐厅点餐系统主要包括三大功能模块,即用户功能模块、前台功能模块和管理员功能模块。

    管理员模块:系统中的核心用户是管理员,管理员登录后,通过管理员功能来管理后台系统。主要功能有:首页、个人中心、用户管理、餐桌信息管理、菜品分类管理、菜品信息管理、菜品评价管理、系统管理、菜品订单管理等功能。

    用户:首页、个人中心、菜品评价管理、我的收藏管理、菜品订单管理等功能。

    前台首页:首页、餐厅信息、菜品信息、菜品资讯、个人中心、后台管理等功能。

    三.功能截图

    3.1前台功能模块

    餐厅点餐系统 ,在前台首页可以查看首页、菜品信息、菜品资讯、个人中心、后台管理等内容。

     个人信息:用户进入个人信息可以对用户名、密码、姓名、性别、头像、手机、等可以进行查看、修复等操作。

     菜品信息,在菜品信息页面通过查看菜品名称、菜品分类、图片、材料、分量、点击次数、价格、菜品介绍等信息进行下单。

     菜品资讯,在菜品资讯页面通过查看菜品资讯内容等等查看。

    3.2管理员功能模块

    管理员登录,通过填写注册时输入的用户名、密码、角色进行登录。

     管理员登录进入餐厅点餐系统可以查看首页、个人中心、用户管理、餐桌管理、菜品分类管理、菜品信息管理、菜品订单管理、菜品评价管理、系统管理等信息。

     个人中心,管理员对个人中心进行操作填写原密码、新密码、确认密码并进行添加、删除、修改以及查看。

     用户管理:管理员进入系统可以对用户进行编辑用户名、密码、姓名、性别、头像、手机进行添加、修改、删除等操作。

     餐桌信息管理,在餐厅信息管理页面中可以填写餐桌号、位置卓位数信息,并可根据需要对已有餐厅信息管理进行修改或删除等操作。

     菜品信息管理,在菜品信息管理页面中可以查看菜品名称、菜品分类、图片、材料、分量、价格、菜品介绍等内容,并且根据需要对已有菜品信息管理进行添加,修改或删除等详细操作。

     系统管理:管理员通过系统管理页面查看轮播图/菜品资讯信息进行上传图片、发布菜品资讯,进行添加、删除、修改以及查看并对整个系统进行维护等操作。

     订单管理,在订单管理页面中可以查看订单编号、商品名称、商品图片、购买数量、价格、折扣价格、总价格、餐桌号、支付状态、审核状态等内容,并且根据需要对已有订单管理进行添加,修改或删除等详细操作。

    3.3用户功能模块

    订单评价管理,在订单评价管理页面中通过填写订单编号、商品名称、菜品分类、评分、评价日期、用户名、评价内容等内容进行查看添加、删除。

     订单管理,在订单管理页面中可以查看订单编号、商品名称、商品图片、购买数量、价格、总价格、下单时间、支付状态、审核状态等内容,并且根据需要对已有订单管理进行详情、删除等详细操作。

     收藏管理:在收藏管理页面可以查看收藏ID 表名 收藏名称、收藏图片等等内容,并进行详情,删除或查看等操作。

    四.数据库表结构设计

    1. CREATE TABLE `caipindingdan` (
    2. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    3. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    4. `dingdanbianhao` varchar(200) DEFAULT NULL COMMENT '订单编号',
    5. `caipinmingcheng` varchar(200) DEFAULT NULL COMMENT '菜品名称',
    6. `caipinfenlei` varchar(200) DEFAULT NULL COMMENT '菜品分类',
    7. `tupian` varchar(200) DEFAULT NULL COMMENT '图片',
    8. `caipinjiage` int(11) DEFAULT NULL COMMENT '菜品价格',
    9. `xiadanshuliang` int(11) NOT NULL COMMENT '下单数量',
    10. `zongjine` varchar(200) DEFAULT NULL COMMENT '总金额',
    11. `xiadanshijian` datetime NOT NULL COMMENT '下单时间',
    12. `canzhuohao` varchar(200) DEFAULT NULL COMMENT '餐桌号',
    13. `yonghuming` varchar(200) DEFAULT NULL COMMENT '用户名',
    14. `lianxidianhua` varchar(200) DEFAULT NULL COMMENT '联系电话',
    15. `sfsh` varchar(200) DEFAULT '否' COMMENT '是否审核',
    16. `shhf` longtext COMMENT '审核回复',
    17. `ispay` varchar(200) DEFAULT '未支付' COMMENT '是否支付',
    18. PRIMARY KEY (`id`),
    19. UNIQUE KEY `dingdanbianhao` (`dingdanbianhao`)
    20. ) ENGINE=InnoDB AUTO_INCREMENT=1616249516189 DEFAULT CHARSET=utf8 COMMENT='菜品订单';
    21. /*!40101 SET character_set_client = @saved_cs_client */;
    22. --
    23. -- Dumping data for table `caipindingdan`
    24. --
    25. LOCK TABLES `caipindingdan` WRITE;
    26. /*!40000 ALTER TABLE `caipindingdan` DISABLE KEYS */;
    27. INSERT INTO `caipindingdan` VALUES (51,'2021-03-20 13:36:16','订单编号1','菜品名称1','菜品分类1','http://localhost:8080/springboot1mi5m/upload/1616248880993.jpg',1,1,'1','2021-03-20 21:36:16','餐桌号1','用户名1','联系电话1','是','','未支付'),(52,'2021-03-20 13:36:16','订单编号2','菜品名称2','菜品分类2','http://localhost:8080/springboot1mi5m/upload/1616248890558.jpg',2,2,'4','2021-03-20 21:36:16','餐桌号2','用户名2','联系电话2','是','','未支付'),(53,'2021-03-20 13:36:16','订单编号3','菜品名称3','菜品分类3','http://localhost:8080/springboot1mi5m/upload/1616248899214.jpg',3,3,'9','2021-03-20 21:36:16','餐桌号3','用户名3','联系电话3','是','','未支付'),(54,'2021-03-20 13:36:16','订单编号4','菜品名称4','菜品分类4','http://localhost:8080/springboot1mi5m/upload/1616248937789.jpg',4,4,'16','2021-03-20 21:36:16','餐桌号4','用户名4','联系电话4','是','','未支付'),(55,'2021-03-20 13:36:16','订单编号5','菜品名称5','菜品分类5','http://localhost:8080/springboot1mi5m/upload/1616248947898.jpg',5,5,'25','2021-03-20 21:36:16','餐桌号5','用户名5','联系电话5','是','','未支付'),(56,'2021-03-20 13:36:16','订单编号6','菜品名称6','菜品分类6','http://localhost:8080/springboot1mi5m/upload/1616248958216.jpg',6,6,'36','2021-03-20 21:36:16','餐桌号6','用户名6','联系电话6','是','','未支付'),(1616249516188,'2021-03-20 14:11:55','202132022113612448606','麻辣小龙虾','川菜','http://localhost:8080/springboot1mi5m/upload/1616249301862.jpg',88,2,'176','2021-03-20 18:00:00','1号桌','1','12312312312','是','ok','已支付');
    28. /*!40000 ALTER TABLE `caipindingdan` ENABLE KEYS */;
    29. UNLOCK TABLES;
    30. --
    31. -- Table structure for table `caipinfenlei`
    32. --
    33. DROP TABLE IF EXISTS `caipinfenlei`;
    34. /*!40101 SET @saved_cs_client = @@character_set_client */;
    35. /*!40101 SET character_set_client = utf8 */;
    36. CREATE TABLE `caipinfenlei` (
    37. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    38. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    39. `caipinfenlei` varchar(200) NOT NULL COMMENT '菜品分类',
    40. PRIMARY KEY (`id`),
    41. UNIQUE KEY `caipinfenlei` (`caipinfenlei`)
    42. ) ENGINE=InnoDB AUTO_INCREMENT=1616249288843 DEFAULT CHARSET=utf8 COMMENT='菜品分类';
    43. /*!40101 SET character_set_client = @saved_cs_client */;
    44. --
    45. -- Dumping data for table `caipinfenlei`
    46. --
    47. LOCK TABLES `caipinfenlei` WRITE;
    48. /*!40000 ALTER TABLE `caipinfenlei` DISABLE KEYS */;
    49. INSERT INTO `caipinfenlei` VALUES (21,'2021-03-20 13:36:15','菜品分类1'),(22,'2021-03-20 13:36:15','菜品分类2'),(23,'2021-03-20 13:36:15','菜品分类3'),(24,'2021-03-20 13:36:15','菜品分类4'),(25,'2021-03-20 13:36:15','菜品分类5'),(26,'2021-03-20 13:36:15','菜品分类6'),(1616249288842,'2021-03-20 14:08:08','川菜');
    50. /*!40000 ALTER TABLE `caipinfenlei` ENABLE KEYS */;
    51. UNLOCK TABLES;
    52. --
    53. -- Table structure for table `caipinpingjia`
    54. --
    55. DROP TABLE IF EXISTS `caipinpingjia`;
    56. /*!40101 SET @saved_cs_client = @@character_set_client */;
    57. /*!40101 SET character_set_client = utf8 */;
    58. CREATE TABLE `caipinpingjia` (
    59. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    60. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    61. `dingdanbianhao` varchar(200) DEFAULT NULL COMMENT '订单编号',
    62. `caipinmingcheng` varchar(200) DEFAULT NULL COMMENT '菜品名称',
    63. `caipinfenlei` varchar(200) DEFAULT NULL COMMENT '菜品分类',
    64. `pingfen` varchar(200) DEFAULT NULL COMMENT '评分',
    65. `tianjiatupian` varchar(200) DEFAULT NULL COMMENT '添加图片',
    66. `pingjianeirong` longtext COMMENT '评价内容',
    67. `pingjiariqi` date DEFAULT NULL COMMENT '评价日期',
    68. `yonghuming` varchar(200) DEFAULT NULL COMMENT '用户名',
    69. `sfsh` varchar(200) DEFAULT '否' COMMENT '是否审核',
    70. `shhf` longtext COMMENT '审核回复',
    71. PRIMARY KEY (`id`)
    72. ) ENGINE=InnoDB AUTO_INCREMENT=1616249594957 DEFAULT CHARSET=utf8 COMMENT='菜品评价';
    73. /*!40101 SET character_set_client = @saved_cs_client */;
    74. --
    75. -- Dumping data for table `caipinpingjia`
    76. --
    77. LOCK TABLES `caipinpingjia` WRITE;
    78. /*!40000 ALTER TABLE `caipinpingjia` DISABLE KEYS */;
    79. INSERT INTO `caipinpingjia` VALUES (61,'2021-03-20 13:36:16','订单编号1','菜品名称1','菜品分类1','1','http://localhost:8080/springboot1mi5m/upload/1616248967287.jpg','评价内容1','2021-03-20','用户名1','是',''),(62,'2021-03-20 13:36:16','订单编号2','菜品名称2','菜品分类2','1','http://localhost:8080/springboot1mi5m/upload/1616248976742.jpg','评价内容2','2021-03-20','用户名2','是',''),(63,'2021-03-20 13:36:16','订单编号3','菜品名称3','菜品分类3','1','http://localhost:8080/springboot1mi5m/upload/1616248986791.jpg','评价内容3','2021-03-20','用户名3','是',''),(64,'2021-03-20 13:36:16','订单编号4','菜品名称4','菜品分类4','1','http://localhost:8080/springboot1mi5m/upload/1616248995687.jpg','评价内容4','2021-03-20','用户名4','是',''),(65,'2021-03-20 13:36:16','订单编号5','菜品名称5','菜品分类5','1','http://localhost:8080/springboot1mi5m/upload/1616249139876.jpg','评价内容5','2021-03-20','用户名5','是',''),(66,'2021-03-20 13:36:16','订单编号6','菜品名称6','菜品分类6','1','http://localhost:8080/springboot1mi5m/upload/1616249148803.jpg','评价内容6','2021-03-20','用户名6','是',''),(1616249594956,'2021-03-20 14:13:14','202132022113612448606','麻辣小龙虾','川菜','5','http://localhost:8080/springboot1mi5m/upload/1616249582492.jpg','小龙虾口感不错','2021-03-20','1','是','感谢支持');
    80. /*!40000 ALTER TABLE `caipinpingjia` ENABLE KEYS */;
    81. UNLOCK TABLES;
    82. --
    83. -- Table structure for table `caipinxinxi`
    84. --
    85. DROP TABLE IF EXISTS `caipinxinxi`;
    86. /*!40101 SET @saved_cs_client = @@character_set_client */;
    87. /*!40101 SET character_set_client = utf8 */;
    88. CREATE TABLE `caipinxinxi` (
    89. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    90. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    91. `caipinmingcheng` varchar(200) NOT NULL COMMENT '菜品名称',
    92. `caipinfenlei` varchar(200) NOT NULL COMMENT '菜品分类',
    93. `tupian` varchar(200) NOT NULL COMMENT '图片',
    94. `caipinjiage` int(11) NOT NULL COMMENT '菜品价格',
    95. `cailiao` varchar(200) DEFAULT NULL COMMENT '材料',
    96. `fenliang` varchar(200) DEFAULT NULL COMMENT '份量',
    97. `caipinjieshao` longtext COMMENT '菜品介绍',
    98. `clicktime` datetime DEFAULT NULL COMMENT '最近点击时间',
    99. `clicknum` int(11) DEFAULT '0' COMMENT '点击次数',
    100. PRIMARY KEY (`id`)
    101. ) ENGINE=InnoDB AUTO_INCREMENT=1616249319881 DEFAULT CHARSET=utf8 COMMENT='菜品信息';
    102. /*!40101 SET character_set_client = @saved_cs_client */;
    103. --
    104. -- Dumping data for table `caipinxinxi`
    105. --
    106. LOCK TABLES `caipinxinxi` WRITE;
    107. /*!40000 ALTER TABLE `caipinxinxi` DISABLE KEYS */;
    108. INSERT INTO `caipinxinxi` VALUES (31,'2021-03-20 13:36:15','菜品名称1','菜品分类1','http://localhost:8080/springboot1mi5m/upload/1616248788098.jpg',1,'材料1','份量1','

      菜品介绍1

      '
      ,'2021-03-20 21:59:34',2),(32,'2021-03-20 13:36:15','菜品名称2','菜品分类2','http://localhost:8080/springboot1mi5m/upload/1616248800548.jpg',2,'材料2','份量2','

      菜品介绍2

      '
      ,'2021-03-20 22:10:38',4),(33,'2021-03-20 13:36:15','菜品名称3','菜品分类3','http://localhost:8080/springboot1mi5m/upload/1616248810527.jpg',3,'材料3','份量3','

      菜品介绍3

      '
      ,'2021-03-20 22:00:05',4),(34,'2021-03-20 13:36:15','菜品名称4','菜品分类4','http://localhost:8080/springboot1mi5m/upload/1616248825918.jpg',4,'材料4','份量4','

      菜品介绍4

      '
      ,'2021-03-20 22:00:14',5),(35,'2021-03-20 13:36:15','菜品名称5','菜品分类5','http://localhost:8080/springboot1mi5m/upload/1616248857719.jpg',5,'材料5','份量5','

      菜品介绍5

      '
      ,'2021-03-20 22:10:53',12),(36,'2021-03-20 13:36:15','菜品名称6','菜品分类6','http://localhost:8080/springboot1mi5m/upload/1616248867781.jpg',6,'材料6','份量6','

      菜品介绍6

      '
      ,'2021-03-20 22:10:14',9),(1616249319880,'2021-03-20 14:08:39','麻辣小龙虾','川菜','http://localhost:8080/springboot1mi5m/upload/1616249301862.jpg',88,'小龙虾','约450g','

      花式麻辣小龙虾是一道色香味俱全的名肴,属于川菜系。肉香味美,色泽诱人,滋补强壮,口感甚佳,令人垂涎的现代菜肴。

      '
      ,'2021-03-20 22:11:58',3);
    109. /*!40000 ALTER TABLE `caipinxinxi` ENABLE KEYS */;
    110. UNLOCK TABLES;
    111. --
    112. -- Table structure for table `canzhuo`
    113. --
    114. DROP TABLE IF EXISTS `canzhuo`;
    115. /*!40101 SET @saved_cs_client = @@character_set_client */;
    116. /*!40101 SET character_set_client = utf8 */;
    117. CREATE TABLE `canzhuo` (
    118. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    119. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    120. `canzhuohao` varchar(200) NOT NULL COMMENT '餐桌号',
    121. `weizhi` varchar(200) DEFAULT NULL COMMENT '位置',
    122. `zuoweishu` int(11) DEFAULT NULL COMMENT '座位数',
    123. PRIMARY KEY (`id`),
    124. UNIQUE KEY `canzhuohao` (`canzhuohao`)
    125. ) ENGINE=InnoDB AUTO_INCREMENT=1616249337286 DEFAULT CHARSET=utf8 COMMENT='餐桌';
    126. /*!40101 SET character_set_client = @saved_cs_client */;
    127. --
    128. -- Dumping data for table `canzhuo`
    129. --
    130. LOCK TABLES `canzhuo` WRITE;
    131. /*!40000 ALTER TABLE `canzhuo` DISABLE KEYS */;
    132. INSERT INTO `canzhuo` VALUES (41,'2021-03-20 13:36:16','餐桌号1','位置1',1),(42,'2021-03-20 13:36:16','餐桌号2','位置2',2),(43,'2021-03-20 13:36:16','餐桌号3','位置3',3),(44,'2021-03-20 13:36:16','餐桌号4','位置4',4),(45,'2021-03-20 13:36:16','餐桌号5','位置5',5),(46,'2021-03-20 13:36:16','餐桌号6','位置6',6),(1616249337285,'2021-03-20 14:08:56','1号桌','东区',4);
    133. /*!40000 ALTER TABLE `canzhuo` ENABLE KEYS */;
    134. UNLOCK TABLES;
    135. --
    136. -- Table structure for table `config`
    137. --
    138. DROP TABLE IF EXISTS `config`;
    139. /*!40101 SET @saved_cs_client = @@character_set_client */;
    140. /*!40101 SET character_set_client = utf8 */;
    141. CREATE TABLE `config` (
    142. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    143. `name` varchar(100) NOT NULL COMMENT '配置参数名称',
    144. `value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
    145. PRIMARY KEY (`id`)
    146. ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='配置文件';
    147. /*!40101 SET character_set_client = @saved_cs_client */;
    148. --
    149. -- Dumping data for table `config`
    150. --
    151. LOCK TABLES `config` WRITE;
    152. /*!40000 ALTER TABLE `config` DISABLE KEYS */;
    153. INSERT INTO `config` VALUES (1,'picture1','http://localhost:8080/springboot1mi5m/upload/1616249372486.jpg'),(2,'picture2','http://localhost:8080/springboot1mi5m/upload/1616249379543.jpg'),(3,'picture3','http://localhost:8080/springboot1mi5m/upload/1616249387359.jpg'),(6,'homepage',NULL);
    154. /*!40000 ALTER TABLE `config` ENABLE KEYS */;
    155. UNLOCK TABLES;
    156. --
    157. -- Table structure for table `discusscaipinxinxi`
    158. --
    159. DROP TABLE IF EXISTS `discusscaipinxinxi`;
    160. /*!40101 SET @saved_cs_client = @@character_set_client */;
    161. /*!40101 SET character_set_client = utf8 */;
    162. CREATE TABLE `discusscaipinxinxi` (
    163. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    164. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    165. `refid` bigint(20) NOT NULL COMMENT '关联表id',
    166. `userid` bigint(20) NOT NULL COMMENT '用户id',
    167. `nickname` varchar(200) DEFAULT NULL COMMENT '用户名',
    168. `content` longtext NOT NULL COMMENT '评论内容',
    169. `reply` longtext COMMENT '回复内容',
    170. PRIMARY KEY (`id`)
    171. ) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=utf8 COMMENT='菜品信息评论表';
    172. /*!40101 SET character_set_client = @saved_cs_client */;
    173. --
    174. -- Dumping data for table `discusscaipinxinxi`
    175. --
    176. LOCK TABLES `discusscaipinxinxi` WRITE;
    177. /*!40000 ALTER TABLE `discusscaipinxinxi` DISABLE KEYS */;
    178. INSERT INTO `discusscaipinxinxi` VALUES (91,'2021-03-20 13:36:16',1,1,'用户名1','评论内容1','回复内容1'),(92,'2021-03-20 13:36:16',2,2,'用户名2','评论内容2','回复内容2'),(93,'2021-03-20 13:36:16',3,3,'用户名3','评论内容3','回复内容3'),(94,'2021-03-20 13:36:16',4,4,'用户名4','评论内容4','回复内容4'),(95,'2021-03-20 13:36:16',5,5,'用户名5','评论内容5','回复内容5'),(96,'2021-03-20 13:36:16',6,6,'用户名6','评论内容6','回复内容6');
    179. /*!40000 ALTER TABLE `discusscaipinxinxi` ENABLE KEYS */;
    180. UNLOCK TABLES;
    181. --
    182. -- Table structure for table `news`
    183. --
    184. DROP TABLE IF EXISTS `news`;
    185. /*!40101 SET @saved_cs_client = @@character_set_client */;
    186. /*!40101 SET character_set_client = utf8 */;
    187. CREATE TABLE `news` (
    188. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    189. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    190. `title` varchar(200) NOT NULL COMMENT '标题',
    191. `introduction` longtext COMMENT '简介',
    192. `picture` varchar(200) NOT NULL COMMENT '图片',
    193. `content` longtext NOT NULL COMMENT '内容',
    194. PRIMARY KEY (`id`)
    195. ) ENGINE=InnoDB AUTO_INCREMENT=1616249364832 DEFAULT CHARSET=utf8 COMMENT='菜品资讯';
    196. /*!40101 SET character_set_client = @saved_cs_client */;
    197. --
    198. -- Dumping data for table `news`
    199. --
    200. LOCK TABLES `news` WRITE;
    201. /*!40000 ALTER TABLE `news` DISABLE KEYS */;
    202. INSERT INTO `news` VALUES (81,'2021-03-20 13:36:16','标题1','简介1','http://localhost:8080/springboot1mi5m/upload/news_picture1.jpg','内容1'),(82,'2021-03-20 13:36:16','标题2','简介2','http://localhost:8080/springboot1mi5m/upload/news_picture2.jpg','内容2'),(83,'2021-03-20 13:36:16','标题3','简介3','http://localhost:8080/springboot1mi5m/upload/news_picture3.jpg','内容3'),(84,'2021-03-20 13:36:16','标题4','简介4','http://localhost:8080/springboot1mi5m/upload/1616249188131.jpg','

      内容4

      '
      ),(85,'2021-03-20 13:36:16','标题5','简介5','http://localhost:8080/springboot1mi5m/upload/1616249159122.jpg','

      内容5

      '
      ),(86,'2021-03-20 13:36:16','标题6','简介6','http://localhost:8080/springboot1mi5m/upload/1616249178914.jpg','

      内容6

      '
      ),(1616249364831,'2021-03-20 14:09:24','新菜品','新菜品','http://localhost:8080/springboot1mi5m/upload/1616249350632.jpg','

      推出新菜品

      '
      );
    203. /*!40000 ALTER TABLE `news` ENABLE KEYS */;
    204. UNLOCK TABLES;
    205. --
    206. -- Table structure for table `storeup`
    207. --
    208. DROP TABLE IF EXISTS `storeup`;
    209. /*!40101 SET @saved_cs_client = @@character_set_client */;
    210. /*!40101 SET character_set_client = utf8 */;
    211. CREATE TABLE `storeup` (
    212. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    213. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    214. `userid` bigint(20) NOT NULL COMMENT '用户id',
    215. `refid` bigint(20) DEFAULT NULL COMMENT '收藏id',
    216. `tablename` varchar(200) DEFAULT NULL COMMENT '表名',
    217. `name` varchar(200) NOT NULL COMMENT '收藏名称',
    218. `picture` varchar(200) NOT NULL COMMENT '收藏图片',
    219. PRIMARY KEY (`id`)
    220. ) ENGINE=InnoDB AUTO_INCREMENT=1616249493766 DEFAULT CHARSET=utf8 COMMENT='收藏表';
    221. /*!40101 SET character_set_client = @saved_cs_client */;
    222. --
    223. -- Dumping data for table `storeup`
    224. --
    225. LOCK TABLES `storeup` WRITE;
    226. /*!40000 ALTER TABLE `storeup` DISABLE KEYS */;
    227. /*!40000 ALTER TABLE `storeup` ENABLE KEYS */;
    228. UNLOCK TABLES;
    229. --
    230. -- Table structure for table `token`
    231. --
    232. DROP TABLE IF EXISTS `token`;
    233. /*!40101 SET @saved_cs_client = @@character_set_client */;
    234. /*!40101 SET character_set_client = utf8 */;
    235. CREATE TABLE `token` (
    236. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    237. `userid` bigint(20) NOT NULL COMMENT '用户id',
    238. `username` varchar(100) NOT NULL COMMENT '用户名',
    239. `tablename` varchar(100) DEFAULT NULL COMMENT '表名',
    240. `role` varchar(100) DEFAULT NULL COMMENT '角色',
    241. `token` varchar(200) NOT NULL COMMENT '密码',
    242. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
    243. `expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
    244. PRIMARY KEY (`id`)
    245. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='token表';
    246. /*!40101 SET character_set_client = @saved_cs_client */;
    247. --
    248. -- Dumping data for table `token`
    249. --
    250. LOCK TABLES `token` WRITE;
    251. /*!40000 ALTER TABLE `token` DISABLE KEYS */;
    252. INSERT INTO `token` VALUES (1,1,'abo','users','管理员','jzctq6s7zl154dik4w9cigr36yicc8b0','2021-03-20 13:57:31','2021-03-20 15:13:24'),(2,1616249408344,'1','yonghu','用户','28fb7bldmdtbcwjctuxmq9rx3owzfcao','2021-03-20 14:10:13','2021-03-20 15:12:46');
    253. /*!40000 ALTER TABLE `token` ENABLE KEYS */;
    254. UNLOCK TABLES;
    255. --
    256. -- Table structure for table `users`
    257. --
    258. DROP TABLE IF EXISTS `users`;
    259. /*!40101 SET @saved_cs_client = @@character_set_client */;
    260. /*!40101 SET character_set_client = utf8 */;
    261. CREATE TABLE `users` (
    262. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    263. `username` varchar(100) NOT NULL COMMENT '用户名',
    264. `password` varchar(100) NOT NULL COMMENT '密码',
    265. `role` varchar(100) DEFAULT '管理员' COMMENT '角色',
    266. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
    267. PRIMARY KEY (`id`)
    268. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='用户表';
    269. /*!40101 SET character_set_client = @saved_cs_client */;
    270. --
    271. -- Dumping data for table `users`
    272. --
    273. LOCK TABLES `users` WRITE;
    274. /*!40000 ALTER TABLE `users` DISABLE KEYS */;
    275. INSERT INTO `users` VALUES (1,'abo','abo','管理员','2021-03-20 13:36:16');
    276. /*!40000 ALTER TABLE `users` ENABLE KEYS */;
    277. UNLOCK TABLES;
    278. --
    279. -- Table structure for table `yonghu`
    280. --
    281. DROP TABLE IF EXISTS `yonghu`;
    282. /*!40101 SET @saved_cs_client = @@character_set_client */;
    283. /*!40101 SET character_set_client = utf8 */;
    284. CREATE TABLE `yonghu` (
    285. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
    286. `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
    287. `yonghuming` varchar(200) NOT NULL COMMENT '用户名',
    288. `mima` varchar(200) NOT NULL COMMENT '密码',
    289. `xingming` varchar(200) DEFAULT NULL COMMENT '姓名',
    290. `touxiang` varchar(200) DEFAULT NULL COMMENT '头像',
    291. `xingbie` varchar(200) DEFAULT NULL COMMENT '性别',
    292. `lianxidianhua` varchar(200) DEFAULT NULL COMMENT '联系电话',
    293. PRIMARY KEY (`id`),
    294. UNIQUE KEY `yonghuming` (`yonghuming`)
    295. ) ENGINE=InnoDB AUTO_INCREMENT=1616249408345 DEFAULT CHARSET=utf8 COMMENT='用户';
    296. /*!40101 SET character_set_client = @saved_cs_client */;
    297. --
    298. -- Dumping data for table `yonghu`
    299. --
    300. LOCK TABLES `yonghu` WRITE;
    301. /*!40000 ALTER TABLE `yonghu` DISABLE KEYS */;
    302. INSERT INTO `yonghu` VALUES (11,'2021-03-20 13:36:15','用户1','123456','姓名1','http://localhost:8080/springboot1mi5m/upload/yonghu_touxiang1.jpg','男','13823888881'),(12,'2021-03-20 13:36:15','用户2','123456','姓名2','http://localhost:8080/springboot1mi5m/upload/yonghu_touxiang2.jpg','男','13823888882'),(13,'2021-03-20 13:36:15','用户3','123456','姓名3','http://localhost:8080/springboot1mi5m/upload/yonghu_touxiang3.jpg','男','13823888883'),(14,'2021-03-20 13:36:15','用户4','123456','姓名4','http://localhost:8080/springboot1mi5m/upload/yonghu_touxiang4.jpg','男','13823888884'),(15,'2021-03-20 13:36:15','用户5','123456','姓名5','http://localhost:8080/springboot1mi5m/upload/yonghu_touxiang5.jpg','男','13823888885'),(16,'2021-03-20 13:36:15','用户6','123456','姓名6','http://localhost:8080/springboot1mi5m/upload/yonghu_touxiang6.jpg','男','13823888886'),(1616249408344,'2021-03-20 14:10:08','1','1','陈一','http://localhost:8080/springboot1mi5m/upload/1616249426524.jpg','女','12312312312');
    303. /*!40000 ALTER TABLE `yonghu` ENABLE KEYS */;
    304. UNLOCK TABLES;
    305. /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
    306. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
    307. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
    308. /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
    309. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    310. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    311. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    312. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
    313. -- Dump completed on 2021-03-23 15:02:40

    五.关键代码

    1. package com.controller;
    2. import java.util.Arrays;
    3. import java.util.Calendar;
    4. import java.util.Date;
    5. import java.util.Map;
    6. import javax.servlet.http.HttpServletRequest;
    7. import org.springframework.beans.factory.annotation.Autowired;
    8. import org.springframework.stereotype.Controller;
    9. import org.springframework.web.bind.annotation.GetMapping;
    10. import org.springframework.web.bind.annotation.PathVariable;
    11. import org.springframework.web.bind.annotation.PostMapping;
    12. import org.springframework.web.bind.annotation.RequestBody;
    13. import org.springframework.web.bind.annotation.RequestMapping;
    14. import org.springframework.web.bind.annotation.RequestParam;
    15. import org.springframework.web.bind.annotation.ResponseBody;
    16. import org.springframework.web.bind.annotation.RestController;
    17. import com.annotation.IgnoreAuth;
    18. import com.baomidou.mybatisplus.mapper.EntityWrapper;
    19. import com.entity.TokenEntity;
    20. import com.entity.UserEntity;
    21. import com.service.TokenService;
    22. import com.service.UserService;
    23. import com.utils.CommonUtil;
    24. import com.utils.MD5Util;
    25. import com.utils.MPUtil;
    26. import com.utils.PageUtils;
    27. import com.utils.R;
    28. import com.utils.ValidatorUtils;
    29. /**
    30. * 登录相关
    31. */
    32. @RequestMapping("users")
    33. @RestController
    34. public class UserController{
    35. @Autowired
    36. private UserService userService;
    37. @Autowired
    38. private TokenService tokenService;
    39. /**
    40. * 登录
    41. */
    42. @IgnoreAuth
    43. @PostMapping(value = "/login")
    44. public R login(String username, String password, String captcha, HttpServletRequest request) {
    45. UserEntity user = userService.selectOne(new EntityWrapper().eq("username", username));
    46. if(user==null || !user.getPassword().equals(password)) {
    47. return R.error("账号或密码不正确");
    48. }
    49. String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
    50. return R.ok().put("token", token);
    51. }
    52. /**
    53. * 注册
    54. */
    55. @IgnoreAuth
    56. @PostMapping(value = "/register")
    57. public R register(@RequestBody UserEntity user){
    58. // ValidatorUtils.validateEntity(user);
    59. if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) {
    60. return R.error("用户已存在");
    61. }
    62. userService.insert(user);
    63. return R.ok();
    64. }
    65. /**
    66. * 退出
    67. */
    68. @GetMapping(value = "logout")
    69. public R logout(HttpServletRequest request) {
    70. request.getSession().invalidate();
    71. return R.ok("退出成功");
    72. }
    73. /**
    74. * 密码重置
    75. */
    76. @IgnoreAuth
    77. @RequestMapping(value = "/resetPass")
    78. public R resetPass(String username, HttpServletRequest request){
    79. UserEntity user = userService.selectOne(new EntityWrapper().eq("username", username));
    80. if(user==null) {
    81. return R.error("账号不存在");
    82. }
    83. user.setPassword("123456");
    84. userService.update(user,null);
    85. return R.ok("密码已重置为:123456");
    86. }
    87. /**
    88. * 列表
    89. */
    90. @RequestMapping("/page")
    91. public R page(@RequestParam Map params,UserEntity user){
    92. EntityWrapper ew = new EntityWrapper();
    93. PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
    94. return R.ok().put("data", page);
    95. }
    96. /**
    97. * 列表
    98. */
    99. @RequestMapping("/list")
    100. public R list( UserEntity user){
    101. EntityWrapper ew = new EntityWrapper();
    102. ew.allEq(MPUtil.allEQMapPre( user, "user"));
    103. return R.ok().put("data", userService.selectListView(ew));
    104. }
    105. /**
    106. * 信息
    107. */
    108. @RequestMapping("/info/{id}")
    109. public R info(@PathVariable("id") String id){
    110. UserEntity user = userService.selectById(id);
    111. return R.ok().put("data", user);
    112. }
    113. /**
    114. * 获取用户的session用户信息
    115. */
    116. @RequestMapping("/session")
    117. public R getCurrUser(HttpServletRequest request){
    118. Long id = (Long)request.getSession().getAttribute("userId");
    119. UserEntity user = userService.selectById(id);
    120. return R.ok().put("data", user);
    121. }
    122. /**
    123. * 保存
    124. */
    125. @PostMapping("/save")
    126. public R save(@RequestBody UserEntity user){
    127. // ValidatorUtils.validateEntity(user);
    128. if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) {
    129. return R.error("用户已存在");
    130. }
    131. userService.insert(user);
    132. return R.ok();
    133. }
    134. /**
    135. * 修改
    136. */
    137. @RequestMapping("/update")
    138. public R update(@RequestBody UserEntity user){
    139. // ValidatorUtils.validateEntity(user);
    140. UserEntity u = userService.selectOne(new EntityWrapper().eq("username", user.getUsername()));
    141. if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) {
    142. return R.error("用户名已存在。");
    143. }
    144. userService.updateById(user);//全部更新
    145. return R.ok();
    146. }
    147. /**
    148. * 删除
    149. */
    150. @RequestMapping("/delete")
    151. public R delete(@RequestBody Long[] ids){
    152. userService.deleteBatchIds(Arrays.asList(ids));
    153. return R.ok();
    154. }
    155. }

    六.论文目录参考

    七.源码获取

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

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

    获取源码请私信

  • 相关阅读:
    Sublime Text如何安装Package Control
    如何进行企业设备管理?
    9.FPN网络代码实现
    基于SSM实现手机销售商城系统
    剑指 Offer II 014. 字符串中的变位词
    DataFrame与DataSet的互操作_大数据培训
    十五、ECharts可视化库的使⽤
    Java进阶篇之泛型
    谱定理等周边定理
    设计模式之外观模式
  • 原文地址:https://blog.csdn.net/qq_35219282/article/details/133096654