Lin 2 days ago
parent ad3796b17e
commit 21cf165ac6

@ -0,0 +1,101 @@
/*
Navicat Premium Data Transfer
Source Server : tencent
Source Server Type : MySQL
Source Server Version : 80039
Source Host : localhost:8989
Source Schema : fly_ticket
Target Server Type : MySQL
Target Server Version : 80039
File Encoding : 65001
Date: 24/11/2024 16:07:53
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for admin_user
-- ----------------------------
DROP TABLE IF EXISTS `admin_user`;
CREATE TABLE `admin_user` (
`user` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '管理员用户名',
`pwd` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '管理员密码',
PRIMARY KEY (`user`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '管理员用户表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for flight
-- ----------------------------
DROP TABLE IF EXISTS `flight`;
CREATE TABLE `flight` (
`f_n` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '航班号',
`f_s_p` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '航班起点',
`f_a_p` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '航班终点',
`f_s_a` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '航班起飞机场',
`f_a_a` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL COMMENT '航班到达机场',
`f_s_t` time(6) NOT NULL COMMENT '起飞时间',
`f_a_t` time(6) NOT NULL COMMENT '到达时间',
`f_p` double(50, 0) NULL DEFAULT NULL COMMENT '票价',
`f_Date` date NOT NULL,
`f_delay` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
`f_food` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
`f_wide` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
`f_depcode` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
`f_dstcode` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`f_n`, `f_Date`, `f_s_a`) USING BTREE,
INDEX `f_n`(`f_n`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci COMMENT = '航班信息' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for p_inf
-- ----------------------------
DROP TABLE IF EXISTS `p_inf`;
CREATE TABLE `p_inf` (
`p_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
`p_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`p_tel` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`p_sex` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
`p_work` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '',
`p_pwd` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '账号密码',
PRIMARY KEY (`p_tel`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for ptp
-- ----------------------------
DROP TABLE IF EXISTS `ptp`;
CREATE TABLE `ptp` (
`p_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '关联者身份证号',
`p_id2` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '被关联者身份证号',
PRIMARY KEY (`p_id`, `p_id2`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for ticket
-- ----------------------------
DROP TABLE IF EXISTS `ticket`;
CREATE TABLE `ticket` (
`t_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'ticket_id 机票编号',
`f_n` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT 'flight_num 航班号',
`t_d` date NULL DEFAULT NULL COMMENT 'ticket_day 机票日期',
`t_s` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'ticket_seat 座位号',
`t_b` tinyint(1) NULL DEFAULT NULL COMMENT 'ticket_buy 0代表已被购买1代表没有被购买',
`p_id` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'passenger_id 持票人身份证号',
`p_id2` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL COMMENT 'passenger_id2 订票人身份证号',
`t_pay` tinyint(1) NULL DEFAULT NULL COMMENT 'ticket_pay 0代表未付款1代表已付款',
PRIMARY KEY (`t_id`) USING BTREE,
INDEX `f_n`(`f_n`) USING BTREE,
CONSTRAINT `ticket_ibfk_1` FOREIGN KEY (`f_n`) REFERENCES `flight` (`f_n`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- View structure for ticket_view
-- ----------------------------
DROP VIEW IF EXISTS `ticket_view`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `ticket_view` AS select `ticket`.`t_id` AS `t_id`,`ticket`.`f_n` AS `f_n`,`ticket`.`t_d` AS `t_d`,`ticket`.`p_id` AS `p_id`,`ticket`.`p_id2` AS `p_id2`,`ticket`.`t_s` AS `t_s`,`flight`.`f_s_p` AS `f_s_p`,`flight`.`f_a_p` AS `f_a_p`,`flight`.`f_s_a` AS `f_s_a`,`flight`.`f_a_a` AS `f_a_a`,`flight`.`f_s_t` AS `f_s_t`,`flight`.`f_a_t` AS `f_a_t`,`flight`.`f_p` AS `f_p`,`p_inf`.`p_name` AS `p_name`,`p_inf`.`p_tel` AS `p_tel`,`p_inf`.`p_sex` AS `p_sex`,`p_inf`.`p_work` AS `p_work`,`ticket`.`t_pay` AS `t_pay` from ((`ticket` join `flight` on((`ticket`.`f_n` = `flight`.`f_n`))) join `p_inf` on((`ticket`.`p_id` = `p_inf`.`p_id`))) where ((`ticket`.`p_id` is not null) and (`ticket`.`p_id2` is not null));
SET FOREIGN_KEY_CHECKS = 1;
Loading…
Cancel
Save