基于ssm的機(jī)場(chǎng)網(wǎng)上訂票系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)-計(jì)算機(jī)畢業(yè)設(shè)計(jì)源碼+LW文檔
開發(fā)語(yǔ)言:Java
框架:ssm
JDK版本:JDK1.8
服務(wù)器:tomcat7
數(shù)據(jù)庫(kù):mysql 5.7(一定要5.7版本)
數(shù)據(jù)庫(kù)工具:Navicat11
開發(fā)軟件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
瀏覽器:谷歌瀏覽器
數(shù)據(jù)庫(kù)腳本:
DROP TABLE IF EXISTS `chat`;
/*!40101 SET @saved_cs_client? ? ?= @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `chat` (
? `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
? `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創(chuàng)建時(shí)間',
? `userid` bigint(20) NOT NULL COMMENT '用戶id',
? `adminid` bigint(20) DEFAULT NULL COMMENT '管理員id',
? `ask` longtext COMMENT '提問(wèn)',
? `reply` longtext COMMENT '回復(fù)',
? `isreply` int(11) DEFAULT NULL COMMENT '是否回復(fù)',
? PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8 COMMENT='在線留言';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `chat`
--
LOCK TABLES `chat` WRITE;
/*!40000 ALTER TABLE `chat` DISABLE KEYS */;
INSERT INTO `chat` VALUES (51,'2022-02-27 13:29:35',1,1,'提問(wèn)1','回復(fù)1',1),(52,'2022-02-27 13:29:35',2,2,'提問(wèn)2','回復(fù)2',2),(53,'2022-02-27 13:29:35',3,3,'提問(wèn)3','回復(fù)3',3),(54,'2022-02-27 13:29:35',4,4,'提問(wèn)4','回復(fù)4',4),(55,'2022-02-27 13:29:35',5,5,'提問(wèn)5','回復(fù)5',5),(56,'2022-02-27 13:29:35',6,6,'提問(wèn)6','回復(fù)6',6);
/*!40000 ALTER TABLE `chat` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `config`
--
DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client? ? ?= @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
? `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
? `name` varchar(100) NOT NULL COMMENT '配置參數(shù)名稱',
? `value` varchar(100) DEFAULT NULL COMMENT '配置參數(shù)值',
? PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `config`
--
LOCK TABLES `config` WRITE;
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
INSERT INTO `config` VALUES (1,'picture1','upload/picture1.jpg'),(2,'picture2','upload/picture2.jpg'),(3,'picture3','upload/picture3.jpg');
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `dingpiaoxinxi`
--
DROP TABLE IF EXISTS `dingpiaoxinxi`;
/*!40101 SET @saved_cs_client? ? ?= @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dingpiaoxinxi` (
? `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
? `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創(chuàng)建時(shí)間',
? `dingdanbianhao` varchar(200) DEFAULT NULL COMMENT '訂單編號(hào)',
? `hangbanbianhao` varchar(200) DEFAULT NULL COMMENT '航班編號(hào)',
? `hangkonggongsi` varchar(200) DEFAULT NULL COMMENT '航空公司',
? `chufadi` varchar(200) DEFAULT NULL COMMENT '出發(fā)地',
? `mudedi` varchar(200) DEFAULT NULL COMMENT '目的地',
? `feixingfangshi` varchar(200) DEFAULT NULL COMMENT '飛行方式',
? `chufashijian` datetime DEFAULT NULL COMMENT '出發(fā)時(shí)間',
? `piaojia` float DEFAULT NULL COMMENT '票價(jià)',
? `shuliang` int(11) NOT NULL COMMENT '數(shù)量',
? `zongjine` float DEFAULT NULL COMMENT '總金額',
? `yonghuzhanghao` varchar(200) DEFAULT NULL COMMENT '用戶賬號(hào)',
? `yonghuxingming` varchar(200) DEFAULT NULL COMMENT '用戶姓名',
? `lianxidianhua` varchar(200) DEFAULT NULL COMMENT '聯(lián)系電話',
? `shenfenzhenghao` varchar(200) DEFAULT NULL COMMENT '身份證號(hào)',
? `goupiaoriqi` date DEFAULT NULL COMMENT '購(gòu)票日期',
? `ispay` varchar(200) DEFAULT '未支付' COMMENT '是否支付',
? PRIMARY KEY (`id`),
? UNIQUE KEY `dingdanbianhao` (`dingdanbianhao`)
) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 COMMENT='訂票信息';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `dingpiaoxinxi`
--
LOCK TABLES `dingpiaoxinxi` WRITE;
/*!40000 ALTER TABLE `dingpiaoxinxi` DISABLE KEYS */;
INSERT INTO `dingpiaoxinxi` VALUES (31,'2022-02-27 13:29:35','1111111111','航班編號(hào)1','航空公司1','出發(fā)地1','目的地1','飛行方式1','2022-02-27 21:29:35',1,1,1,'用戶賬號(hào)1','用戶姓名1','聯(lián)系電話1','身份證號(hào)1','2022-02-27','未支付'),(32,'2022-02-27 13:29:35','2222222222','航班編號(hào)2','航空公司2','出發(fā)地2','目的地2','飛行方式2','2022-02-27 21:29:35',2,2,2,'用戶賬號(hào)2','用戶姓名2','聯(lián)系電話2','身份證號(hào)2','2022-02-27','未支付'),(33,'2022-02-27 13:29:35','3333333333','航班編號(hào)3','航空公司3','出發(fā)地3','目的地3','飛行方式3','2022-02-27 21:29:35',3,3,3,'用戶賬號(hào)3','用戶姓名3','聯(lián)系電話3','身份證號(hào)3','2022-02-27','未支付'),(34,'2022-02-27 13:29:35','4444444444','航班編號(hào)4','航空公司4','出發(fā)地4','目的地4','飛行方式4','2022-02-27 21:29:35',4,4,4,'用戶賬號(hào)4','用戶姓名4','聯(lián)系電話4','身份證號(hào)4','2022-02-27','未支付'),(35,'2022-02-27 13:29:35','5555555555','航班編號(hào)5','航空公司5','出發(fā)地5','目的地5','飛行方式5','2022-02-27 21:29:35',5,5,5,'用戶賬號(hào)5','用戶姓名5','聯(lián)系電話5','身份證號(hào)5','2022-02-27','未支付'),(36,'2022-02-27 13:29:35','6666666666','航班編號(hào)6','航空公司6','出發(fā)地6','目的地6','飛行方式6','2022-02-27 21:29:35',6,6,6,'用戶賬號(hào)6','用戶姓名6','聯(lián)系電話6','身份證號(hào)6','2022-02-27','未支付');
/*!40000 ALTER TABLE `dingpiaoxinxi` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `discussjipiaoxinxi`
--
DROP TABLE IF EXISTS `discussjipiaoxinxi`;
/*!40101 SET @saved_cs_client? ? ?= @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `discussjipiaoxinxi` (
? `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主鍵',
? `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '創(chuàng)建時(shí)間',
? `refid` bigint(20) NOT NULL COMMENT '關(guān)聯(lián)表id',
? `userid` bigint(20) NOT NULL COMMENT '用戶id',
? `nickname` varchar(200) DEFAULT NULL COMMENT '用戶名',
? `content` longtext NOT NULL COMMENT '評(píng)論內(nèi)容',
? `reply` longtext COMMENT '回復(fù)內(nèi)容',
? PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=87 DEFAULT CHARSET=utf8 COMMENT='機(jī)票信息評(píng)論表';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `discussjipiaoxinxi`
--
LOCK TABLES `discussjipiaoxinxi` WRITE;
/*!40000 ALTER TABLE `discussjipiaoxinxi` DISABLE KEYS */;
INSERT INTO `discussjipiaoxinxi` VALUES (81,'2022-02-27 13:29:36',1,1,'用戶名1','評(píng)論內(nèi)容1','回復(fù)內(nèi)容1'),(82,'2022-02-27 13:29:36',2,2,'用戶名2','評(píng)論內(nèi)容2','回復(fù)內(nèi)容2'),(83,'2022-02-27 13:29:36',3,3,'用戶名3','評(píng)論內(nèi)容3','回復(fù)內(nèi)容3'),(84,'2022-02-27 13:29:36',4,4,'用戶名4','評(píng)論內(nèi)容4','回復(fù)內(nèi)容4'),(85,'2022-02-27 13:29:36',5,5,'用戶名5','評(píng)論內(nèi)容5','回復(fù)內(nèi)容5'),(86,'2022-02-27 13:29:36',6,6,'用戶名6','評(píng)論內(nèi)容6','回復(fù)內(nèi)容6');
/*!40000 ALTER TABLE `discussjipiaoxinxi` ENABLE KEYS */;
UNLOCK TABLES;
業(yè)務(wù)邏輯代碼:
/**
?* 用戶
?* 后端接口
?* @author?
?* @email?
?* @date 2022-02-27 21:28:50
?*/
@RestController
@RequestMapping("/yonghu")
public class YonghuController {
? ? @Autowired
? ? private YonghuService yonghuService;
? ??
@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("賬號(hào)或密碼不正確");
}
String token = tokenService.generateToken(user.getId(), username,"yonghu",? "用戶" );
return R.ok().put("token", token);
}
/**
? ? ?* 注冊(cè)
? ? ?*/
@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("注冊(cè)用戶已存在");
}
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("賬號(hào)不存在");
? ? }
? ? 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);
? ? }
/**
? ? ?* 列表
? ? ?*/
? ? @RequestMapping("/lists")
? ? public R list( YonghuEntity yonghu){
? ? ? ? EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
? ? ? ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));?
? ? ? ? return R.ok().put("data", yonghuService.selectListView(ew));
? ? }
/**
? ? ?* 查詢
? ? ?*/
? ? @RequestMapping("/query")
? ? public R query(YonghuEntity yonghu){
? ? ? ? EntityWrapper< YonghuEntity> ew = new EntityWrapper< YonghuEntity>();
? ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu"));?
YonghuView yonghuView =? yonghuService.selectView(ew);
return R.ok("查詢用戶成功").put("data", yonghuView);
? ? }
? ? /**
? ? ?* 后端詳情
? ? ?*/
? ? @RequestMapping("/info/{id}")
? ? public R info(@PathVariable("id") Long id){
? ? ? ? YonghuEntity yonghu = yonghuService.selectById(id);
? ? ? ? return R.ok().put("data", yonghu);
? ? }


