基于微信小程序的食堂窗口自助點餐系統(tǒng)設(shè)計與實現(xiàn)-計算機(jī)畢業(yè)設(shè)計源碼和lw文檔
開發(fā)語言:Java
框架:ssm
JDK版本:JDK1.8
服務(wù)器:tomcat7
數(shù)據(jù)庫:mysql 5.7(一定要5.7版本)
數(shù)據(jù)庫工具:Navicat11
開發(fā)軟件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
瀏覽器:谷歌瀏覽器
安卓框架:uniapp
安卓開發(fā)軟件:HBuilder X
開發(fā)模式:混合開發(fā)
數(shù)據(jù)庫:
DROP TABLE IF EXISTS `address`;
/*!40101 SET @saved_cs_client? ? ?= @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `address` (
? `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
? `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創(chuàng)建時間',
? `userid` bigint(20) NOT NULL COMMENT '用戶id',
? `address` varchar(200) NOT NULL COMMENT '地址',
? `name` varchar(200) NOT NULL COMMENT '收貨人',
? `phone` varchar(200) NOT NULL COMMENT '電話',
? `isdefault` varchar(200) NOT NULL COMMENT '是否默認(rèn)地址[是/否]',
? PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='地址';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `address`
--
LOCK TABLES `address` WRITE;
/*!40000 ALTER TABLE `address` DISABLE KEYS */;
INSERT INTO `address` VALUES (1,'2022-04-13 07:00:47',11,'宇宙銀河系金星1號','金某','13823888881','是'),(2,'2022-04-13 07:00:47',12,'宇宙銀河系木星1號','木某','13823888882','是'),(3,'2022-04-13 07:00:47',13,'宇宙銀河系水星1號','水某','13823888883','是'),(4,'2022-04-13 07:00:47',14,'宇宙銀河系火星1號','火某','13823888884','是'),(5,'2022-04-13 07:00:47',15,'宇宙銀河系土星1號','土某','13823888885','是'),(6,'2022-04-13 07:00:47',16,'宇宙銀河系月球1號','月某','13823888886','是');
/*!40000 ALTER TABLE `address` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `caipinfenlei`
--
DROP TABLE IF EXISTS `caipinfenlei`;
/*!40101 SET @saved_cs_client? ? ?= @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `caipinfenlei` (
? `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
? `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創(chuàng)建時間',
? `caipinfenlei` varchar(200) NOT NULL COMMENT '菜品分類',
? PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1649833643836 DEFAULT CHARSET=utf8 COMMENT='菜品分類';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `caipinfenlei`
--
LOCK TABLES `caipinfenlei` WRITE;
/*!40000 ALTER TABLE `caipinfenlei` DISABLE KEYS */;
INSERT INTO `caipinfenlei` VALUES (41,'2022-04-13 07:00:47','菜品分類1'),(42,'2022-04-13 07:00:47','菜品分類2'),(43,'2022-04-13 07:00:47','菜品分類3'),(44,'2022-04-13 07:00:47','菜品分類4'),(45,'2022-04-13 07:00:47','菜品分類5'),(46,'2022-04-13 07:00:47','菜品分類6'),(1649833643835,'2022-04-13 07:07:23','西餐');
/*!40000 ALTER TABLE `caipinfenlei` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `caipinxinxi`
--
DROP TABLE IF EXISTS `caipinxinxi`;
/*!40101 SET @saved_cs_client? ? ?= @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `caipinxinxi` (
? `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
? `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創(chuàng)建時間',
? `caipinbianhao` varchar(200) DEFAULT NULL COMMENT '菜品編號',
? `dianpuxinxi` varchar(200) DEFAULT NULL COMMENT '店鋪信息',
? `caipinmingcheng` varchar(200) NOT NULL COMMENT '菜品名稱',
? `caipinfenlei` varchar(200) NOT NULL COMMENT '菜品分類',
? `kouwei` varchar(200) DEFAULT NULL COMMENT '口味',
? `fenliang` varchar(200) DEFAULT NULL COMMENT '份量',
? `tupian` varchar(200) DEFAULT NULL COMMENT '圖片',
? `shangjiariqi` date DEFAULT NULL COMMENT '上架日期',
? `caipinjieshao` longtext COMMENT '菜品介紹',
? `shangjiazhanghao` varchar(200) DEFAULT NULL COMMENT '商家賬號',
? `shangjiaxingming` varchar(200) DEFAULT NULL COMMENT '商家姓名',
? `price` float DEFAULT NULL COMMENT '價格',
? `onelimittimes` int(11) DEFAULT '-1' COMMENT '單限',
? `alllimittimes` int(11) DEFAULT '-1' COMMENT '庫存',
? PRIMARY KEY (`id`),
? UNIQUE KEY `caipinbianhao` (`caipinbianhao`)
) ENGINE=InnoDB AUTO_INCREMENT=1649833735169 DEFAULT CHARSET=utf8 COMMENT='菜品信息';
/*!40101 SET character_set_client = @saved_cs_client */;
業(yè)務(wù)邏輯代碼:
@Autowired
private TokenService tokenService;
/**
* 登錄
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("賬號或密碼不正確");
}
String token = tokenService.generateToken(user.getId(), username,"yonghu",? "用戶" );
return R.ok().put("token", token);
}
/**
? ? ?* 注冊
? ? ?*/
@IgnoreAuth
? ? @RequestMapping("/register")
? ? public R register(@RequestBody YonghuEntity yonghu){
? ? //ValidatorUtils.validateEntity(yonghu);
? ? YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao()));
if(user!=null) {
return R.error("注冊用戶已存在");
}
Long uId = new Date().getTime();
yonghu.setId(uId);
? ? ? ? yonghuService.insert(yonghu);
? ? ? ? return R.ok();
? ? }
/**
* 退出
*/
@RequestMapping("/logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
? ? ?* 獲取用戶的session用戶信息
? ? ?*/
? ? @RequestMapping("/session")
? ? public R getCurrUser(HttpServletRequest request){
? ? Long id = (Long)request.getSession().getAttribute("userId");
? ? ? ? YonghuEntity user = yonghuService.selectById(id);
? ? ? ? return R.ok().put("data", user);
? ? }
? ??
? ? /**
? ? ?* 密碼重置
? ? ?*/
? ? @IgnoreAuth
@RequestMapping(value = "/resetPass")
? ? public R resetPass(String username, HttpServletRequest request){
? ? YonghuEntity user = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", username));
? ? if(user==null) {
? ? return R.error("賬號不存在");
? ? }
? ? user.setMima("123456");
? ? ? ? yonghuService.updateById(user);
? ? ? ? return R.ok("密碼已重置為:123456");
? ? }
? ? /**
? ? ?* 后端列表
? ? ?*/
? ? @RequestMapping("/page")
? ? public R page(@RequestParam Map<String, Object> params,YonghuEntity yonghu,?
HttpServletRequest request){
? ? ? ? EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
? ? ? ? return R.ok().put("data", page);
? ? }
? ??
? ? /**
? ? ?* 前端列表
? ? ?*/
@IgnoreAuth
? ? @RequestMapping("/list")
? ? public R list(@RequestParam Map<String, Object> params,YonghuEntity yonghu,?
HttpServletRequest request){
? ? ? ? EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
? ? ? ? return R.ok().put("data", page);
? ? }


