Compare commits
No commits in common. 'master' and 'develop' have entirely different histories.
|
Before Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 799 KiB |
|
Before Width: | Height: | Size: 559 KiB |
|
Before Width: | Height: | Size: 219 KiB |
|
Before Width: | Height: | Size: 202 KiB |
|
Before Width: | Height: | Size: 865 KiB |
@ -1,283 +0,0 @@
|
|||||||
# 航班表
|
|
||||||
use air_data;
|
|
||||||
|
|
||||||
CREATE TABLE flights
|
|
||||||
(
|
|
||||||
flight_id VARCHAR(20) PRIMARY KEY, # 航班号
|
|
||||||
airline_company VARCHAR(100) NOT NULL, # 航空公司
|
|
||||||
departure_location VARCHAR(100) NOT NULL, # 出发地点
|
|
||||||
destination_location VARCHAR(100) NOT NULL, # 目的地位置
|
|
||||||
departure_time DATETIME NOT NULL, # 出发时间
|
|
||||||
arrival_time DATETIME NOT NULL, # 到达时间
|
|
||||||
boarding_time DATETIME NOT NULL, # 登机时间
|
|
||||||
gate VARCHAR(20), # 登机口
|
|
||||||
delay_status ENUM ('on_time', 'delayed',
|
|
||||||
'cancelled') DEFAULT 'on_time', # 延迟状态
|
|
||||||
destination_image VARCHAR(255), # 目的地图片
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP # 创建时间
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO flights (flight_id, airline_company, departure_location, destination_location, departure_time, arrival_time, boarding_time, gate, delay_status, destination_image) VALUES
|
|
||||||
('CA123', 'Air China', 'Beijing (PEK)', 'Tokyo (NRT)', '2024-03-20 08:30:00', '2024-03-20 12:45:00', '2024-03-20 07:45:00', 'A12', 'on_time', '/images/tokyo.jpg'),
|
|
||||||
('UA789', 'United Airlines', 'New York (JFK)', 'London (LHR)', '2024-03-20 14:15:00', '2024-03-20 23:30:00', '2024-03-20 13:30:00', 'B7', 'on_time', '/images/london.jpg'),
|
|
||||||
('EK521', 'Emirates', 'Dubai (DXB)', 'Singapore (SIN)', '2024-03-20 09:45:00', '2024-03-20 17:20:00', '2024-03-20 09:00:00', 'C15', 'delayed', '/images/singapore.jpg'),
|
|
||||||
('LH430', 'Lufthansa', 'Frankfurt (FRA)', 'New York (JFK)', '2024-03-20 11:20:00', '2024-03-20 14:35:00', '2024-03-20 10:35:00', 'D22', 'on_time', '/images/newyork.jpg'),
|
|
||||||
('SQ305', 'Singapore Airlines', 'Singapore (SIN)', 'Sydney (SYD)', '2024-03-20 16:40:00', '2024-03-20 22:15:00', '2024-03-20 15:55:00', 'E8', 'on_time', '/images/sydney.jpg'),
|
|
||||||
('BA117', 'British Airways', 'London (LHR)', 'Dubai (DXB)', '2024-03-20 13:10:00', '2024-03-20 22:45:00', '2024-03-20 12:25:00', 'F3', 'on_time', '/images/dubai.jpg'),
|
|
||||||
('AF385', 'Air France', 'Paris (CDG)', 'Tokyo (NRT)', '2024-03-20 10:50:00', '2024-03-21 06:20:00', '2024-03-20 10:05:00', 'G11', 'on_time', '/images/tokyo.jpg'),
|
|
||||||
('JL065', 'Japan Airlines', 'Tokyo (NRT)', 'Los Angeles (LAX)', '2024-03-20 15:30:00', '2024-03-20 09:15:00', '2024-03-20 14:45:00', 'H5', 'on_time', '/images/losangeles.jpg'),
|
|
||||||
('DL289', 'Delta Air Lines', 'Atlanta (ATL)', 'Paris (CDG)', '2024-03-20 18:25:00', '2024-03-21 08:10:00', '2024-03-20 17:40:00', 'A9', 'delayed', '/images/paris.jpg'),
|
|
||||||
('CX831', 'Cathay Pacific', 'Hong Kong (HKG)', 'Vancouver (YVR)', '2024-03-20 12:05:00', '2024-03-20 08:50:00', '2024-03-20 11:20:00', 'B14', 'on_time', '/images/vancouver.jpg'),
|
|
||||||
('QF2', 'Qantas', 'London (LHR)', 'Singapore (SIN)', '2024-03-20 19:40:00', '2024-03-21 17:25:00', '2024-03-20 18:55:00', 'C6', 'on_time', '/images/singapore.jpg'),
|
|
||||||
('KL887', 'KLM', 'Amsterdam (AMS)', 'New York (JFK)', '2024-03-20 14:55:00', '2024-03-20 17:20:00', '2024-03-20 14:10:00', 'D18', 'on_time', '/images/newyork.jpg'),
|
|
||||||
('EY451', 'Etihad Airways', 'Abu Dhabi (AUH)', 'Sydney (SYD)', '2024-03-20 21:15:00', '2024-03-21 17:40:00', '2024-03-20 20:30:00', 'E4', 'on_time', '/images/sydney.jpg'),
|
|
||||||
('TK15', 'Turkish Airlines', 'Istanbul (IST)', 'Tokyo (NRT)', '2024-03-20 08:10:00', '2024-03-20 23:45:00', '2024-03-20 07:25:00', 'F9', 'cancelled', '/images/tokyo.jpg'),
|
|
||||||
('AA125', 'American Airlines', 'Chicago (ORD)', 'London (LHR)', '2024-03-20 16:50:00', '2024-03-21 06:25:00', '2024-03-20 16:05:00', 'G13', 'on_time', '/images/london.jpg'),
|
|
||||||
('NZ5', 'Air New Zealand', 'Auckland (AKL)', 'Los Angeles (LAX)', '2024-03-20 13:35:00', '2024-03-20 05:20:00', '2024-03-20 12:50:00', 'H7', 'on_time', '/images/losangeles.jpg'),
|
|
||||||
('BR87', 'EVA Air', 'Taipei (TPE)', 'Vancouver (YVR)', '2024-03-20 11:45:00', '2024-03-20 06:30:00', '2024-03-20 11:00:00', 'A3', 'delayed', '/images/vancouver.jpg'),
|
|
||||||
('LH730', 'Lufthansa', 'Munich (MUC)', 'Dubai (DXB)', '2024-03-20 09:20:00', '2024-03-20 15:55:00', '2024-03-20 08:35:00', 'B10', 'on_time', '/images/dubai.jpg'),
|
|
||||||
('SQ25', 'Singapore Airlines', 'Frankfurt (FRA)', 'New York (JFK)', '2024-03-20 17:30:00', '2024-03-20 20:15:00', '2024-03-20 16:45:00', 'C8', 'on_time', '/images/newyork.jpg'),
|
|
||||||
('UA863', 'United Airlines', 'San Francisco (SFO)', 'Sydney (SYD)', '2024-03-20 22:05:00', '2024-03-22 06:40:00', '2024-03-20 21:20:00', 'D5', 'on_time', '/images/sydney.jpg');
|
|
||||||
|
|
||||||
|
|
||||||
# 乘客表
|
|
||||||
CREATE TABLE passengers
|
|
||||||
(
|
|
||||||
id_card VARCHAR(18) PRIMARY KEY, #身份证号
|
|
||||||
name VARCHAR(100) NOT NULL, # 姓名
|
|
||||||
is_vip BOOLEAN DEFAULT FALSE, # 是否是VIP
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP # 创建时间
|
|
||||||
);
|
|
||||||
|
|
||||||
-- 插入测试数据到 passengers 表
|
|
||||||
INSERT INTO passengers (id_card, name, is_vip) VALUES
|
|
||||||
('110101199001011234', '张三', TRUE),
|
|
||||||
('110101199002022345', '李四', FALSE),
|
|
||||||
('110101199003033456', '王五', TRUE),
|
|
||||||
('110101199004044567', '赵六', FALSE),
|
|
||||||
('110101199005055678', '钱七', TRUE),
|
|
||||||
('110101199006066789', '孙八', FALSE),
|
|
||||||
('110101199007077890', '周九', TRUE),
|
|
||||||
('110101199008088901', '吴十', FALSE),
|
|
||||||
('110101199009099012', '郑十一', TRUE),
|
|
||||||
('110101199010101123', '王十二', FALSE);
|
|
||||||
|
|
||||||
update passengers set name = 'ZHANG' where id_card = '110101199001011234';
|
|
||||||
|
|
||||||
|
|
||||||
# 管理员表
|
|
||||||
CREATE TABLE admins
|
|
||||||
(
|
|
||||||
admin_id VARCHAR(18) PRIMARY KEY, # 管理员id
|
|
||||||
username VARCHAR(50) UNIQUE NOT NULL, # 账号
|
|
||||||
password_hash VARCHAR(255) NOT NULL, # 密码
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP # 创建时间
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO admins (admin_id, username, password_hash) VALUES
|
|
||||||
('100000000000000001', 'admin01', '100001'),
|
|
||||||
('100000000000000002', 'admin02', '100002'),
|
|
||||||
('100000000000000003', 'admin03', '100003'),
|
|
||||||
('100000000000000004', 'admin04', '100004'),
|
|
||||||
('100000000000000005', 'admin05', '100005'),
|
|
||||||
('100000000000000006', 'superadmin', '100006'),
|
|
||||||
('100000000000000007', 'sysadmin', '100007'),
|
|
||||||
('100000000000000008', 'webmaster', '100008'),
|
|
||||||
('100000000000000009', 'rootadmin', '100009'),
|
|
||||||
('100000000000000010', 'masteradmin', '100010');
|
|
||||||
|
|
||||||
|
|
||||||
# 飞机座位
|
|
||||||
CREATE TABLE flight_seats
|
|
||||||
(
|
|
||||||
seat_id INT PRIMARY KEY AUTO_INCREMENT, # 座位号
|
|
||||||
flight_id VARCHAR(20) NOT NULL, # 航班号
|
|
||||||
seat_number VARCHAR(10) NOT NULL, # 座位
|
|
||||||
seat_row INT NOT NULL, # 行号
|
|
||||||
seat_column CHAR(1) NOT NULL, # 列号
|
|
||||||
seat_class ENUM ('economy', 'business', 'first') DEFAULT 'economy', # 座位类型
|
|
||||||
is_available BOOLEAN DEFAULT TRUE, # 是否可用
|
|
||||||
UNIQUE KEY unique_flight_seat (flight_id, seat_number),
|
|
||||||
FOREIGN KEY (flight_id) REFERENCES flights (flight_id)
|
|
||||||
);
|
|
||||||
|
|
||||||
delete from flight_seats;
|
|
||||||
|
|
||||||
INSERT INTO flight_seats (flight_id, seat_number, seat_row, seat_column, seat_class, is_available) VALUES
|
|
||||||
-- 航班 CA123 (Air China) - 假设 A330 布局
|
|
||||||
|
|
||||||
|
|
||||||
('CA123', '1A', 1, 'A', 'first', TRUE),
|
|
||||||
('CA123', '1B', 1, 'B', 'first', TRUE),
|
|
||||||
('CA123', '1C', 1, 'C', 'first', TRUE),
|
|
||||||
('CA123', '1D', 1, 'D', 'first', TRUE),
|
|
||||||
('CA123', '2A', 2, 'A', 'first', TRUE),
|
|
||||||
('CA123', '2B', 2, 'B', 'first', TRUE),
|
|
||||||
('CA123', '2C', 2, 'C', 'first', TRUE),
|
|
||||||
('CA123', '2D', 2, 'D', 'first', TRUE),
|
|
||||||
('CA123', '5A', 5, 'A', 'business', TRUE),
|
|
||||||
('CA123', '5B', 5, 'B', 'business', TRUE),
|
|
||||||
('CA123', '5C', 5, 'C', 'business', TRUE),
|
|
||||||
('CA123', '5D', 5, 'D', 'business', TRUE),
|
|
||||||
('CA123', '5E', 5, 'E', 'business', TRUE),
|
|
||||||
('CA123', '5F', 5, 'F', 'business', TRUE),
|
|
||||||
('CA123', '10A', 10, 'A', 'economy', TRUE),
|
|
||||||
('CA123', '10B', 10, 'B', 'economy', TRUE),
|
|
||||||
('CA123', '10C', 10, 'C', 'economy', TRUE),
|
|
||||||
('CA123', '10D', 10, 'D', 'economy', TRUE),
|
|
||||||
('CA123', '10E', 10, 'E', 'economy', TRUE),
|
|
||||||
('CA123', '10F', 10, 'F', 'economy', TRUE),
|
|
||||||
|
|
||||||
-- 航班 UA789 (United Airlines) - 假设 777 布局
|
|
||||||
('UA789', '1A', 1, 'A', 'first', TRUE),
|
|
||||||
('UA789', '1B', 1, 'B', 'first', TRUE),
|
|
||||||
('UA789', '1C', 1, 'C', 'first', TRUE),
|
|
||||||
('UA789', '1D', 1, 'D', 'first', TRUE),
|
|
||||||
('UA789', '4A', 4, 'A', 'business', TRUE),
|
|
||||||
('UA789', '4B', 4, 'B', 'business', TRUE),
|
|
||||||
('UA789', '4C', 4, 'C', 'business', TRUE),
|
|
||||||
('UA789', '4D', 4, 'D', 'business', TRUE),
|
|
||||||
('UA789', '4E', 4, 'E', 'business', TRUE),
|
|
||||||
('UA789', '4F', 4, 'F', 'business', TRUE),
|
|
||||||
('UA789', '8A', 8, 'A', 'economy', TRUE),
|
|
||||||
('UA789', '8B', 8, 'B', 'economy', TRUE),
|
|
||||||
('UA789', '8C', 8, 'C', 'economy', TRUE),
|
|
||||||
('UA789', '8D', 8, 'D', 'economy', TRUE),
|
|
||||||
('UA789', '8E', 8, 'E', 'economy', TRUE),
|
|
||||||
('UA789', '8F', 8, 'F', 'economy', TRUE),
|
|
||||||
|
|
||||||
-- 航班 EK521 (Emirates) - 假设 A380 布局
|
|
||||||
('EK521', '1A', 1, 'A', 'first', TRUE),
|
|
||||||
('EK521', '1B', 1, 'B', 'first', TRUE),
|
|
||||||
('EK521', '2A', 2, 'A', 'first', TRUE),
|
|
||||||
('EK521', '2B', 2, 'B', 'first', TRUE),
|
|
||||||
('EK521', '5A', 5, 'A', 'business', TRUE),
|
|
||||||
('EK521', '5B', 5, 'B', 'business', TRUE),
|
|
||||||
('EK521', '5C', 5, 'C', 'business', TRUE),
|
|
||||||
('EK521', '5D', 5, 'D', 'business', TRUE),
|
|
||||||
('EK521', '6A', 6, 'A', 'business', TRUE),
|
|
||||||
('EK521', '6B', 6, 'B', 'business', TRUE),
|
|
||||||
('EK521', '6C', 6, 'C', 'business', TRUE),
|
|
||||||
('EK521', '6D', 6, 'D', 'business', TRUE),
|
|
||||||
('EK521', '15A', 15, 'A', 'economy', TRUE),
|
|
||||||
('EK521', '15B', 15, 'B', 'economy', TRUE),
|
|
||||||
('EK521', '15C', 15, 'C', 'economy', TRUE),
|
|
||||||
('EK521', '15D', 15, 'D', 'economy', TRUE),
|
|
||||||
('EK521', '15E', 15, 'E', 'economy', TRUE),
|
|
||||||
('EK521', '15F', 15, 'F', 'economy', TRUE),
|
|
||||||
|
|
||||||
-- 继续为其他航班添加座位数据...
|
|
||||||
-- 航班 LH430 (Lufthansa)
|
|
||||||
('LH430', '1A', 1, 'A', 'first', TRUE),
|
|
||||||
('LH430', '1B', 1, 'B', 'first', TRUE),
|
|
||||||
('LH430', '1C', 1, 'C', 'first', TRUE),
|
|
||||||
('LH430', '1D', 1, 'D', 'first', TRUE),
|
|
||||||
('LH430', '4A', 4, 'A', 'business', TRUE),
|
|
||||||
('LH430', '4B', 4, 'B', 'business', TRUE),
|
|
||||||
('LH430', '4C', 4, 'C', 'business', TRUE),
|
|
||||||
('LH430', '4D', 4, 'D', 'business', TRUE),
|
|
||||||
('LH430', '8A', 8, 'A', 'economy', TRUE),
|
|
||||||
('LH430', '8B', 8, 'B', 'economy', TRUE),
|
|
||||||
('LH430', '8C', 8, 'C', 'economy', TRUE),
|
|
||||||
('LH430', '8D', 8, 'D', 'economy', TRUE),
|
|
||||||
('LH430', '8E', 8, 'E', 'economy', TRUE),
|
|
||||||
('LH430', '8F', 8, 'F', 'economy', TRUE),
|
|
||||||
|
|
||||||
-- 航班 SQ305 (Singapore Airlines)
|
|
||||||
('SQ305', '1A', 1, 'A', 'first', TRUE),
|
|
||||||
('SQ305', '1B', 1, 'B', 'first', TRUE),
|
|
||||||
('SQ305', '2A', 2, 'A', 'first', TRUE),
|
|
||||||
('SQ305', '2B', 2, 'B', 'first', TRUE),
|
|
||||||
('SQ305', '5A', 5, 'A', 'business', TRUE),
|
|
||||||
('SQ305', '5B', 5, 'B', 'business', TRUE),
|
|
||||||
('SQ305', '5C', 5, 'C', 'business', TRUE),
|
|
||||||
('SQ305', '5D', 5, 'D', 'business', TRUE),
|
|
||||||
('SQ305', '10A', 10, 'A', 'economy', TRUE),
|
|
||||||
('SQ305', '10B', 10, 'B', 'economy', TRUE),
|
|
||||||
('SQ305', '10C', 10, 'C', 'economy', TRUE),
|
|
||||||
('SQ305', '10D', 10, 'D', 'economy', TRUE),
|
|
||||||
('SQ305', '10E', 10, 'E', 'economy', TRUE),
|
|
||||||
('SQ305', '10F', 10, 'F', 'economy', TRUE);
|
|
||||||
|
|
||||||
|
|
||||||
# 订单表
|
|
||||||
CREATE TABLE orders
|
|
||||||
(
|
|
||||||
order_id VARCHAR(50) PRIMARY KEY, # 订单号
|
|
||||||
passenger_id VARCHAR(18) NOT NULL, # 乘客id
|
|
||||||
flight_id VARCHAR(20) NOT NULL, # 航班号
|
|
||||||
seat_id INT NOT NULL, # 关联座位表
|
|
||||||
food_name VARCHAR(100), # 食物名称
|
|
||||||
notes TEXT, # 备注信息
|
|
||||||
boarding_status BOOLEAN DEFAULT FALSE, # 登机状态
|
|
||||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, # 创建时间
|
|
||||||
FOREIGN KEY (passenger_id) REFERENCES passengers (id_card), # 外键
|
|
||||||
FOREIGN KEY (flight_id) REFERENCES flights (flight_id), # 外键
|
|
||||||
FOREIGN KEY (seat_id) REFERENCES flight_seats (seat_id) # 外键
|
|
||||||
);
|
|
||||||
|
|
||||||
-- 初始化所有乘客均未登机
|
|
||||||
update orders set boarding_status = FALSE;
|
|
||||||
|
|
||||||
-- 删除座位外键约束
|
|
||||||
alter table orders drop foreign key orders_ibfk_3;
|
|
||||||
|
|
||||||
-- 修改座位可为null值
|
|
||||||
alter table orders modify seat_id int NULL;
|
|
||||||
|
|
||||||
-- 重新添加外键
|
|
||||||
alter table orders add constraint fk_orders_seat foreign key (seat_id) references flight_seats(seat_id);
|
|
||||||
|
|
||||||
update orders set seat_id = null;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
INSERT INTO orders (order_id, passenger_id, flight_id, seat_id, food_name, notes, boarding_status) VALUES
|
|
||||||
-- 张三的订单
|
|
||||||
('ORD20240320001', '110101199001011234', 'CA123', 1, '牛肉饭', '需要毛毯', TRUE),
|
|
||||||
('ORD20240320002', '110101199001011234', 'UA789', 2, '素食餐', '靠窗座位偏好', FALSE),
|
|
||||||
|
|
||||||
-- 李四的订单
|
|
||||||
('ORD20240320003', '110101199002022345', 'EK521', 3, '鸡肉面', '生日特别服务', FALSE),
|
|
||||||
('ORD20240320004', '110101199002022345', 'LH430', 4, '海鲜餐', '过敏:花生', TRUE),
|
|
||||||
|
|
||||||
-- 王五的订单
|
|
||||||
('ORD20240320005', '110101199003033456', 'SQ305', 5, '儿童餐', '带婴儿旅行', TRUE),
|
|
||||||
('ORD20240320006', '110101199003033456', 'BA117', 6, '糖尿病餐', '需要胰岛素冷藏', FALSE),
|
|
||||||
|
|
||||||
-- 赵六的订单
|
|
||||||
('ORD20240320007', '110101199004044567', 'AF385', 10, '普通餐', '第一次飞行', TRUE),
|
|
||||||
('ORD20240320008', '110101199004044567', 'JL065', 15, '牛肉饭', '无特殊要求', FALSE),
|
|
||||||
|
|
||||||
-- 钱七的订单
|
|
||||||
('ORD20240320009', '110101199005055678', 'DL289', 20, '素食餐', 'VIP服务', TRUE),
|
|
||||||
('ORD20240320010', '110101199005055678', 'CX831', 21, '低盐餐', '心脏病人', TRUE),
|
|
||||||
|
|
||||||
-- 孙八的订单
|
|
||||||
('ORD20240320011', '110101199006066789', 'QF2', 22, '海鲜餐', '庆祝纪念日', FALSE),
|
|
||||||
('ORD20240320012', '110101199006066789', 'KL887', 33, '鸡肉面', '中转航班', TRUE),
|
|
||||||
|
|
||||||
-- 周九的订单
|
|
||||||
('ORD20240320013', '110101199007077890', 'EY451', 43, '水果拼盘', '减肥餐', FALSE),
|
|
||||||
('ORD20240320014', '110101199007077890', 'TK15', 44, '牛肉饭', '商务会议材料', TRUE),
|
|
||||||
|
|
||||||
-- 吴十的订单
|
|
||||||
('ORD20240320015', '110101199008088901', 'AA125', 56, '普通餐', '无特殊要求', FALSE),
|
|
||||||
('ORD20240320016', '110101199008088901', 'NZ5', 57, '儿童餐', '带儿童旅行', TRUE),
|
|
||||||
|
|
||||||
-- 郑十一的订单
|
|
||||||
('ORD20240320017', '110101199009099012', 'BR87', 58, '糖尿病餐', '需要医疗协助', TRUE),
|
|
||||||
('ORD20240320018', '110101199009099012', 'LH730', 59, '素食餐', 'VIP通道', TRUE),
|
|
||||||
|
|
||||||
-- 王十二的订单
|
|
||||||
('ORD20240320019', '110101199010101123', 'SQ25', 60, '低脂餐', '健身饮食', FALSE),
|
|
||||||
('ORD20240320020', '110101199010101123', 'UA863', 61, '海鲜餐', '过敏:贝类', TRUE),
|
|
||||||
|
|
||||||
-- 额外的订单,展示更多航班组合
|
|
||||||
('ORD20240320021', '110101199001011234', 'EK521', 62, '牛肉饭', '回程航班', FALSE),
|
|
||||||
('ORD20240320022', '110101199003033456', 'UA789', 63, '普通餐', '公司出差', TRUE),
|
|
||||||
('ORD20240320023', '110101199005055678', 'CA123', 71, '素食餐', '环保旅行', TRUE),
|
|
||||||
('ORD20240320024', '110101199007077890', 'SQ305', 72, '糖尿病餐', '定期检查', FALSE),
|
|
||||||
('ORD20240320025', '110101199009099012', 'LH430', 73, '海鲜餐', '蜜月旅行', TRUE);
|
|
||||||
|
Before Width: | Height: | Size: 243 KiB |
|
Before Width: | Height: | Size: 335 KiB |
|
Before Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 500 KiB After Width: | Height: | Size: 500 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 263 KiB After Width: | Height: | Size: 263 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 189 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 491 KiB After Width: | Height: | Size: 491 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 808 B After Width: | Height: | Size: 808 B |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 561 KiB After Width: | Height: | Size: 561 KiB |
|
Before Width: | Height: | Size: 245 KiB After Width: | Height: | Size: 245 KiB |
|
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 180 KiB |
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
|
Before Width: | Height: | Size: 220 KiB After Width: | Height: | Size: 220 KiB |
|
Before Width: | Height: | Size: 510 KiB After Width: | Height: | Size: 510 KiB |
|
Before Width: | Height: | Size: 266 KiB After Width: | Height: | Size: 266 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
|
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
@ -1 +1 @@
|
|||||||
1326854870744 1327854870744 1326854870743 1326854870745 1326854870746 1326854870747 1326854870748 1326854870749 1316854870545 1316854870544 123
|
1326854870744 1327854870744 1326854870743 1326854870745 1326854870746 1326854870747 1326854870748 1326854870749 1316854870545 1316854870544
|
||||||
|
Before Width: | Height: | Size: 349 KiB After Width: | Height: | Size: 349 KiB |
|
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 566 KiB After Width: | Height: | Size: 566 KiB |
|
Before Width: | Height: | Size: 493 KiB After Width: | Height: | Size: 493 KiB |
|
Before Width: | Height: | Size: 306 KiB After Width: | Height: | Size: 306 KiB |
|
Before Width: | Height: | Size: 189 KiB After Width: | Height: | Size: 189 KiB |
@ -1,13 +0,0 @@
|
|||||||
db.url=jdbc:mysql://localhost:3306/air_data?useSSL=false&serverTimezone=UTC&characterEncoding=utf8
|
|
||||||
|
|
||||||
db.username=root
|
|
||||||
|
|
||||||
db.password=830729tjf
|
|
||||||
|
|
||||||
db.driver=com.mysql.cj.jdbc.Driver
|
|
||||||
|
|
||||||
db.pool.maximumPoolSize=20
|
|
||||||
db.pool.minimumIdle=5
|
|
||||||
db.pool.connectionTimeout=30000
|
|
||||||
db.pool.idleTimeout=300000
|
|
||||||
db.pool.maxLifetime=1800000
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
package dao;
|
|
||||||
|
|
||||||
import model_new.Admin;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
public interface AdminDao {
|
|
||||||
|
|
||||||
Optional<Admin> findById(String id); // 根据ID查找管理员对象
|
|
||||||
|
|
||||||
List<Admin> findAll(); // 获取所有管理员对象
|
|
||||||
|
|
||||||
boolean save(Admin admin); // 保存管理员信息
|
|
||||||
|
|
||||||
boolean update(Admin admin); // 修改管理员信息
|
|
||||||
|
|
||||||
boolean delete(String id); // 删除管理员信息
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
package dao;
|
|
||||||
|
|
||||||
import model_new.Flight;
|
|
||||||
import model_new.User;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface FlightDao {
|
|
||||||
|
|
||||||
// 按航班号查找航班
|
|
||||||
Optional<Flight> findByFlightId(String FlightId);
|
|
||||||
|
|
||||||
// 查找所有航班
|
|
||||||
List<Flight> findAll();
|
|
||||||
|
|
||||||
// 增加航班信息
|
|
||||||
boolean save(Flight flight);
|
|
||||||
|
|
||||||
// 修改航班信息
|
|
||||||
boolean update(Flight flight);
|
|
||||||
|
|
||||||
// 删除某个航班
|
|
||||||
boolean delete(String FlightId);
|
|
||||||
|
|
||||||
// 检查某个航班是否存在
|
|
||||||
boolean existsByFlightId(String flightId);
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
package dao;
|
|
||||||
|
|
||||||
import model_new.FlightSeat;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
* 航班座位数据访问接口
|
|
||||||
*/
|
|
||||||
public interface FlightSeatDao {
|
|
||||||
|
|
||||||
// 基本CRUD操作
|
|
||||||
Optional<FlightSeat> findById(Integer seatId);
|
|
||||||
List<FlightSeat> findAll();
|
|
||||||
boolean save(FlightSeat seat);
|
|
||||||
boolean update(FlightSeat seat);
|
|
||||||
boolean delete(Integer seatId);
|
|
||||||
|
|
||||||
// 特定查询方法
|
|
||||||
List<FlightSeat> findByFlightId(String flightId);
|
|
||||||
List<FlightSeat> findAvailableSeatsByFlightId(String flightId);
|
|
||||||
// 根据航班和舱位等级查找
|
|
||||||
List<FlightSeat> findByFlightIdAndClass(String flightId, String seatClass);
|
|
||||||
// 根据航班ID和座位号查找
|
|
||||||
Optional<FlightSeat> findByFlightIdAndSeatNumber(String flightId, String seatNumber);
|
|
||||||
|
|
||||||
// 检查方法 - 检查航班ID和座位号存在性
|
|
||||||
boolean existsByFlightIdAndSeatNumber(String flightId, String seatNumber);
|
|
||||||
|
|
||||||
// 统计方法
|
|
||||||
// 根据航班ID统计可用座位
|
|
||||||
int countAvailableSeatsByFlightId(String flightId);
|
|
||||||
// 按航班ID统计总座位数
|
|
||||||
int countTotalSeatsByFlightId(String flightId);
|
|
||||||
|
|
||||||
// 批量操作方法
|
|
||||||
// 批量更新可用性
|
|
||||||
boolean batchUpdateAvailability(List<Integer> seatIds, Boolean isAvailable);
|
|
||||||
// 批量更新座位
|
|
||||||
boolean batchInsertSeats(List<FlightSeat> seats);
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
package dao;
|
|
||||||
|
|
||||||
import model_new.Order;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
public interface OrderDao {
|
|
||||||
|
|
||||||
// 1. 创建新订单
|
|
||||||
boolean save(Order order);
|
|
||||||
|
|
||||||
List<Order> findAll();
|
|
||||||
|
|
||||||
// 2. 根据订单ID查询订单
|
|
||||||
Optional<Order> findOrderById(String orderId);
|
|
||||||
|
|
||||||
// 3. 根据乘客身份证号查询所有订单
|
|
||||||
List<Order> findOrdersByPassengerId(String passengerId);
|
|
||||||
|
|
||||||
// 4. 根据航班号查询所有订单
|
|
||||||
List<Order> findOrdersByFlightId(String flightId);
|
|
||||||
|
|
||||||
// 5. 更新订单信息(食物、备注等)
|
|
||||||
int updateOrder(Order order);
|
|
||||||
|
|
||||||
// 6. 更新登机状态
|
|
||||||
int updateBoardingStatus(String orderId, boolean boardingStatus);
|
|
||||||
|
|
||||||
// 7. 删除订单
|
|
||||||
int deleteOrder(String orderId);
|
|
||||||
|
|
||||||
// 8. 根据座位号和航班号查询订单(检查座位是否被占用)
|
|
||||||
Order findOrderBySeatAndFlight(int seatId, String flightId);
|
|
||||||
|
|
||||||
// 9. 统计某个航班的订单数量
|
|
||||||
int countOrdersByFlightId(String flightId);
|
|
||||||
|
|
||||||
// 10. 获取某个乘客的VIP订单
|
|
||||||
List<Order> findVipOrdersByPassengerId(String passengerId);
|
|
||||||
|
|
||||||
// 12. 根据创建时间范围查询订单
|
|
||||||
List<Order> findOrdersByCreateTimeRange(Date startTime, Date endTime);
|
|
||||||
}
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
package dao;
|
|
||||||
|
|
||||||
import model_new.Passenger;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface PassengerDao {
|
|
||||||
|
|
||||||
// 根据身份证号查找乘客
|
|
||||||
Optional<Passenger> findById(String id_card); // 根据ID查找管理员对象
|
|
||||||
|
|
||||||
// 查找所有乘客对象
|
|
||||||
List<Passenger> findAll(); // 获取所有管理员对象
|
|
||||||
|
|
||||||
// 添加乘客
|
|
||||||
boolean save(Passenger passenger); // 保存管理员信息
|
|
||||||
|
|
||||||
// 修改乘客信息
|
|
||||||
boolean update(Passenger passenger); // 修改管理员信息
|
|
||||||
|
|
||||||
// 删除乘客
|
|
||||||
boolean delete(String id_card); // 删除管理员信息
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
package dao;
|
|
||||||
|
|
||||||
import model_new.User;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface UserDao {
|
|
||||||
Optional<User> findById(Integer id);
|
|
||||||
List<User> findAll();
|
|
||||||
boolean save(User user);
|
|
||||||
boolean update(User user);
|
|
||||||
boolean delete(Integer id);
|
|
||||||
Optional<User> findByUsername(String username);
|
|
||||||
boolean existsByUsername(String username);
|
|
||||||
}
|
|
||||||
@ -1,377 +0,0 @@
|
|||||||
package dao.impl;
|
|
||||||
|
|
||||||
import dao.FlightSeatDao;
|
|
||||||
import model_new.FlightSeat;
|
|
||||||
import utils.DatabaseUtil;
|
|
||||||
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
* 航班座位数据访问实现类
|
|
||||||
*/
|
|
||||||
public class FlightSeatDaoImpl implements FlightSeatDao {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<FlightSeat> findById(Integer seatId) {
|
|
||||||
String sql = "SELECT * FROM flight_seats WHERE seat_id = ?";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
||||||
|
|
||||||
stmt.setInt(1, seatId);
|
|
||||||
ResultSet rs = stmt.executeQuery();
|
|
||||||
|
|
||||||
if (rs.next()) {
|
|
||||||
return Optional.of(mapResultSetToFlightSeat(rs));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<FlightSeat> findAll() {
|
|
||||||
List<FlightSeat> seats = new ArrayList<>();
|
|
||||||
String sql = "SELECT * FROM flight_seats ORDER BY seat_id";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
Statement stmt = conn.createStatement();
|
|
||||||
ResultSet rs = stmt.executeQuery(sql)) {
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
seats.add(mapResultSetToFlightSeat(rs));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return seats;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean save(FlightSeat seat) {
|
|
||||||
String sql = "INSERT INTO flight_seats (flight_id, seat_number, seat_row, seat_column, seat_class, is_available) " +
|
|
||||||
"VALUES (?, ?, ?, ?, ?, ?)";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
|
|
||||||
|
|
||||||
stmt.setString(1, seat.getFlight_id());
|
|
||||||
stmt.setString(2, seat.getSeat_number());
|
|
||||||
stmt.setInt(3, seat.getSeat_row());
|
|
||||||
stmt.setString(4, String.valueOf(seat.getSeat_column()));
|
|
||||||
stmt.setString(5, seat.getSeat_class());
|
|
||||||
stmt.setBoolean(6, seat.isIs_available());
|
|
||||||
|
|
||||||
int affectedRows = stmt.executeUpdate();
|
|
||||||
|
|
||||||
// 获取自增主键
|
|
||||||
if (affectedRows > 0) {
|
|
||||||
try (ResultSet generatedKeys = stmt.getGeneratedKeys()) {
|
|
||||||
if (generatedKeys.next()) {
|
|
||||||
seat.setSeat_id(generatedKeys.getInt(1)); // 将座位编号传回座位对象
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return affectedRows > 0;
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean update(FlightSeat seat) {
|
|
||||||
String sql = "UPDATE flight_seats SET flight_id = ?, seat_number = ?, seat_row = ?, " +
|
|
||||||
"seat_column = ?, seat_class = ?, is_available = ? WHERE seat_id = ?";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
||||||
|
|
||||||
stmt.setString(1, seat.getFlight_id());
|
|
||||||
stmt.setString(2, seat.getSeat_number());
|
|
||||||
stmt.setInt(3, seat.getSeat_row());
|
|
||||||
stmt.setString(4, String.valueOf(seat.getSeat_column()));
|
|
||||||
stmt.setString(5, seat.getSeat_class());
|
|
||||||
stmt.setBoolean(6, seat.isIs_available());
|
|
||||||
stmt.setInt(7, seat.getSeat_id());
|
|
||||||
|
|
||||||
// 获取修改的行数
|
|
||||||
int affectedRows = stmt.executeUpdate();
|
|
||||||
return affectedRows > 0;
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean delete(Integer seatId) {
|
|
||||||
String sql = "DELETE FROM flight_seats WHERE seat_id = ?";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
||||||
|
|
||||||
stmt.setInt(1, seatId);
|
|
||||||
int affectedRows = stmt.executeUpdate();
|
|
||||||
return affectedRows > 0;
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<FlightSeat> findByFlightId(String flightId) {
|
|
||||||
List<FlightSeat> seats = new ArrayList<>();
|
|
||||||
String sql = "SELECT * FROM flight_seats WHERE flight_id = ? ORDER BY seat_row, seat_column";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
||||||
|
|
||||||
stmt.setString(1, flightId);
|
|
||||||
ResultSet rs = stmt.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
seats.add(mapResultSetToFlightSeat(rs));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return seats;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<FlightSeat> findAvailableSeatsByFlightId(String flightId) {
|
|
||||||
List<FlightSeat> seats = new ArrayList<>();
|
|
||||||
String sql = "SELECT * FROM flight_seats WHERE flight_id = ? AND is_available = TRUE ORDER BY seat_row, seat_column";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
||||||
|
|
||||||
stmt.setString(1, flightId);
|
|
||||||
ResultSet rs = stmt.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
seats.add(mapResultSetToFlightSeat(rs));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return seats;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<FlightSeat> findByFlightIdAndClass(String flightId, String seatClass) {
|
|
||||||
List<FlightSeat> seats = new ArrayList<>();
|
|
||||||
String sql = "SELECT * FROM flight_seats WHERE flight_id = ? AND seat_class = ? ORDER BY seat_row, seat_column";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
||||||
|
|
||||||
stmt.setString(1, flightId);
|
|
||||||
stmt.setString(2, seatClass);
|
|
||||||
ResultSet rs = stmt.executeQuery();
|
|
||||||
|
|
||||||
while (rs.next()) {
|
|
||||||
seats.add(mapResultSetToFlightSeat(rs));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return seats;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Optional<FlightSeat> findByFlightIdAndSeatNumber(String flightId, String seatNumber) {
|
|
||||||
String sql = "SELECT * FROM flight_seats WHERE flight_id = ? AND seat_number = ?";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
||||||
|
|
||||||
stmt.setString(1, flightId);
|
|
||||||
stmt.setString(2, seatNumber);
|
|
||||||
ResultSet rs = stmt.executeQuery();
|
|
||||||
|
|
||||||
if (rs.next()) {
|
|
||||||
return Optional.of(mapResultSetToFlightSeat(rs));
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean existsByFlightIdAndSeatNumber(String flightId, String seatNumber) {
|
|
||||||
String sql = "SELECT 1 FROM flight_seats WHERE flight_id = ? AND seat_number = ?";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
||||||
|
|
||||||
stmt.setString(1, flightId);
|
|
||||||
stmt.setString(2, seatNumber);
|
|
||||||
ResultSet rs = stmt.executeQuery();
|
|
||||||
|
|
||||||
return rs.next();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int countAvailableSeatsByFlightId(String flightId) {
|
|
||||||
String sql = "SELECT COUNT(*) FROM flight_seats WHERE flight_id = ? AND is_available = TRUE";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
||||||
|
|
||||||
stmt.setString(1, flightId);
|
|
||||||
ResultSet rs = stmt.executeQuery();
|
|
||||||
|
|
||||||
if (rs.next()) {
|
|
||||||
return rs.getInt(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int countTotalSeatsByFlightId(String flightId) {
|
|
||||||
String sql = "SELECT COUNT(*) FROM flight_seats WHERE flight_id = ?";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
||||||
|
|
||||||
stmt.setString(1, flightId);
|
|
||||||
ResultSet rs = stmt.executeQuery();
|
|
||||||
|
|
||||||
if (rs.next()) {
|
|
||||||
return rs.getInt(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean batchUpdateAvailability(List<Integer> seatIds, Boolean isAvailable) {
|
|
||||||
if (seatIds == null || seatIds.isEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 构建IN子句的占位符
|
|
||||||
StringBuilder placeholders = new StringBuilder();
|
|
||||||
for (int i = 0; i < seatIds.size(); i++) {
|
|
||||||
placeholders.append("?");
|
|
||||||
if (i < seatIds.size() - 1) {
|
|
||||||
placeholders.append(",");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String sql = "UPDATE flight_seats SET is_available = ? WHERE seat_id IN (" + placeholders + ")";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
||||||
|
|
||||||
stmt.setBoolean(1, isAvailable);
|
|
||||||
for (int i = 0; i < seatIds.size(); i++) {
|
|
||||||
stmt.setInt(i + 2, seatIds.get(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
int affectedRows = stmt.executeUpdate();
|
|
||||||
return affectedRows > 0;
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean batchInsertSeats(List<FlightSeat> seats) {
|
|
||||||
if (seats == null || seats.isEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
String sql = "INSERT INTO flight_seats (flight_id, seat_number, seat_row, seat_column, seat_class, is_available) " +
|
|
||||||
"VALUES (?, ?, ?, ?, ?, ?)";
|
|
||||||
|
|
||||||
try (Connection conn = DatabaseUtil.getConnection();
|
|
||||||
PreparedStatement stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) {
|
|
||||||
|
|
||||||
for (FlightSeat seat : seats) {
|
|
||||||
stmt.setString(1, seat.getFlight_id());
|
|
||||||
stmt.setString(2, seat.getSeat_number());
|
|
||||||
stmt.setInt(3, seat.getSeat_row());
|
|
||||||
stmt.setString(4, String.valueOf(seat.getSeat_column()));
|
|
||||||
stmt.setString(5, seat.getSeat_class());
|
|
||||||
stmt.setBoolean(6, seat.isIs_available());
|
|
||||||
stmt.addBatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
int[] results = stmt.executeBatch();
|
|
||||||
|
|
||||||
// 获取生成的主键
|
|
||||||
try (ResultSet generatedKeys = stmt.getGeneratedKeys()) {
|
|
||||||
int index = 0;
|
|
||||||
while (generatedKeys.next() && index < seats.size()) {
|
|
||||||
seats.get(index).setSeat_id(generatedKeys.getInt(1));
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return results.length == seats.size();
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将ResultSet映射为FlightSeat对象
|
|
||||||
*/
|
|
||||||
private FlightSeat mapResultSetToFlightSeat(ResultSet rs) throws SQLException {
|
|
||||||
FlightSeat seat = new FlightSeat();
|
|
||||||
|
|
||||||
seat.setSeat_id(rs.getInt("seat_id"));
|
|
||||||
seat.setFlight_id(rs.getString("flight_id"));
|
|
||||||
seat.setSeat_number(rs.getString("seat_number"));
|
|
||||||
seat.setSeat_row(rs.getInt("seat_row"));
|
|
||||||
seat.setSeat_column(rs.getString("seat_column").charAt(0)); // 获取第一个字符即可
|
|
||||||
seat.setSeat_class(rs.getString("seat_class"));
|
|
||||||
seat.setIs_available(rs.getBoolean("is_available"));
|
|
||||||
|
|
||||||
return seat;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
package model_new;
|
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class Admin {
|
|
||||||
|
|
||||||
private String admin_id; // 管理员身份号
|
|
||||||
private String username; // 账号
|
|
||||||
private String password;
|
|
||||||
private Timestamp created_at;
|
|
||||||
|
|
||||||
public Admin(String admin_id, String username, String password, Timestamp created_at) {
|
|
||||||
this.admin_id = admin_id;
|
|
||||||
this.username = username;
|
|
||||||
this.password = password;
|
|
||||||
this.created_at = created_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Admin() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAdmin_id() {
|
|
||||||
return admin_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdmin_id(String admin_id) {
|
|
||||||
this.admin_id = admin_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getCreated_at() {
|
|
||||||
return created_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreated_at(Timestamp created_at) {
|
|
||||||
this.created_at = created_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Admin{" +
|
|
||||||
"admin_id='" + admin_id + '\'' +
|
|
||||||
", username='" + username + '\'' +
|
|
||||||
", password='" + password + '\'' +
|
|
||||||
", created_at=" + created_at +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,153 +0,0 @@
|
|||||||
package model_new;
|
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
|
|
||||||
// 用于格式化Timestamp类型
|
|
||||||
//import java.text.SimpleDateFormat;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
public class Flight {
|
|
||||||
|
|
||||||
private String flight_id; // 航班号
|
|
||||||
private String airline_company; // 航空公司
|
|
||||||
private String departure_location; // 出发地点
|
|
||||||
private String destination_location; // 目的地位置
|
|
||||||
|
|
||||||
private Timestamp departure_time; // 出发时间
|
|
||||||
private Timestamp arrival_time; // 到达时间
|
|
||||||
private Timestamp boarding_time; // 登机时间
|
|
||||||
private String gate; // 登机口
|
|
||||||
private String delay_status; // 延误状态
|
|
||||||
private String destination_image; // 目的地照片
|
|
||||||
private Timestamp created_at; // 创建时间
|
|
||||||
|
|
||||||
// 构造函数
|
|
||||||
public Flight(Timestamp created_at, String destination_image,
|
|
||||||
String delay_status, String gate, Timestamp boarding_time,
|
|
||||||
Timestamp arrival_time, Timestamp departure_time,
|
|
||||||
String destination_location, String departure_location,
|
|
||||||
String airline_company, String flight_id) {
|
|
||||||
this.created_at = created_at;
|
|
||||||
this.destination_image = destination_image;
|
|
||||||
this.delay_status = delay_status;
|
|
||||||
this.gate = gate;
|
|
||||||
this.boarding_time = boarding_time;
|
|
||||||
this.arrival_time = arrival_time;
|
|
||||||
this.departure_time = departure_time;
|
|
||||||
this.destination_location = destination_location;
|
|
||||||
this.departure_location = departure_location;
|
|
||||||
this.airline_company = airline_company;
|
|
||||||
this.flight_id = flight_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Flight() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFlight_id() {
|
|
||||||
return flight_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlight_id(String flight_id) {
|
|
||||||
this.flight_id = flight_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAirline_company() {
|
|
||||||
return airline_company;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAirline_company(String airline_company) {
|
|
||||||
this.airline_company = airline_company;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeparture_location() {
|
|
||||||
return departure_location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeparture_location(String departure_location) {
|
|
||||||
this.departure_location = departure_location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDestination_location() {
|
|
||||||
return destination_location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDestination_location(String destination_location) {
|
|
||||||
this.destination_location = destination_location;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getDeparture_time() {
|
|
||||||
return departure_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeparture_time(Timestamp departure_time) {
|
|
||||||
this.departure_time = departure_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getArrival_time() {
|
|
||||||
return arrival_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArrival_time(Timestamp arrival_time) {
|
|
||||||
this.arrival_time = arrival_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getBoarding_time() {
|
|
||||||
return boarding_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBoarding_time(Timestamp boarding_time) {
|
|
||||||
this.boarding_time = boarding_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDelay_status() {
|
|
||||||
return delay_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDelay_status(String delay_status) {
|
|
||||||
this.delay_status = delay_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGate() {
|
|
||||||
return gate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGate(String gate) {
|
|
||||||
this.gate = gate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDestination_image() {
|
|
||||||
return destination_image;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDestination_image(String destination_image) {
|
|
||||||
this.destination_image = destination_image;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getCreated_at() {
|
|
||||||
return created_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreated_at(Timestamp created_at) {
|
|
||||||
this.created_at = created_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Flight{" +
|
|
||||||
"flight_id='" + flight_id + '\'' +
|
|
||||||
", airline_company='" + airline_company + '\'' +
|
|
||||||
", departure_location='" + departure_location + '\'' +
|
|
||||||
", destination_location='" + destination_location + '\'' +
|
|
||||||
", departure_time=" + departure_time +
|
|
||||||
", arrival_time=" + arrival_time +
|
|
||||||
", boarding_time=" + boarding_time +
|
|
||||||
", gate='" + gate + '\'' +
|
|
||||||
", delay_status='" + delay_status + '\'' +
|
|
||||||
", destination_image='" + destination_image + '\'' +
|
|
||||||
", created_at='" + created_at + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,110 +0,0 @@
|
|||||||
package model_new;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class FlightSeat {
|
|
||||||
|
|
||||||
private int seat_id; // 座位号
|
|
||||||
private String flight_id; // 航班号
|
|
||||||
private String seat_number; // 座位编号
|
|
||||||
|
|
||||||
private int seat_row; // 行
|
|
||||||
private char seat_column; // 列
|
|
||||||
private String seat_class; // 座位类型
|
|
||||||
private boolean is_available; // 座位是否可用
|
|
||||||
|
|
||||||
public FlightSeat(int seat_id, String flight_id, String seat_number, int seat_row,
|
|
||||||
char seat_column, String seat_class, boolean is_available) {
|
|
||||||
this.seat_id = seat_id;
|
|
||||||
this.flight_id = flight_id;
|
|
||||||
this.seat_number = seat_number;
|
|
||||||
this.seat_row = seat_row;
|
|
||||||
this.seat_column = seat_column;
|
|
||||||
this.seat_class = seat_class;
|
|
||||||
this.is_available = is_available;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FlightSeat() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public FlightSeat(String flightId, String seatNumber, int row, String columnLetter, String seatClass, boolean b) {
|
|
||||||
this.flight_id = flightId;
|
|
||||||
this.seat_number = seatNumber;
|
|
||||||
this.seat_row = row;
|
|
||||||
this.seat_column = columnLetter.charAt(0);
|
|
||||||
this.seat_class = seatClass;
|
|
||||||
this.is_available = b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSeat_id() {
|
|
||||||
return seat_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeat_id(int seat_id) {
|
|
||||||
this.seat_id = seat_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFlight_id() {
|
|
||||||
return flight_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlight_id(String flight_id) {
|
|
||||||
this.flight_id = flight_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSeat_number() {
|
|
||||||
return seat_number;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeat_number(String seat_number) {
|
|
||||||
this.seat_number = seat_number;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSeat_row() {
|
|
||||||
return seat_row;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeat_row(int seat_row) {
|
|
||||||
this.seat_row = seat_row;
|
|
||||||
}
|
|
||||||
|
|
||||||
public char getSeat_column() {
|
|
||||||
return seat_column;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeat_column(char seat_column) {
|
|
||||||
this.seat_column = seat_column;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSeat_class() {
|
|
||||||
return seat_class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeat_class(String seat_class) {
|
|
||||||
this.seat_class = seat_class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isIs_available() {
|
|
||||||
return is_available;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIs_available(boolean is_available) {
|
|
||||||
this.is_available = is_available;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "FlightSeat{" +
|
|
||||||
"seat_id=" + seat_id +
|
|
||||||
", flight_id='" + flight_id + '\'' +
|
|
||||||
", seat_number='" + seat_number + '\'' +
|
|
||||||
", seat_row=" + seat_row +
|
|
||||||
", seat_column=" + seat_column +
|
|
||||||
", seat_class='" + seat_class + '\'' +
|
|
||||||
", is_available=" + is_available +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,114 +0,0 @@
|
|||||||
package model_new;
|
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class Order {
|
|
||||||
|
|
||||||
private String order_id; // 订单号
|
|
||||||
private String passenger_id; // 用户ID
|
|
||||||
private String flight_id; // 飞机ID
|
|
||||||
|
|
||||||
private int seat_id; // 关联座位表
|
|
||||||
private String food_name; // 食物名称
|
|
||||||
private String notes;
|
|
||||||
private boolean boarding_status; // 登机状态
|
|
||||||
private Timestamp created_at;
|
|
||||||
|
|
||||||
public Order(String order_id, String passenger_id, String flight_id, int seat_id,
|
|
||||||
String food_name, String notes, boolean boarding_status, Timestamp created_at) {
|
|
||||||
this.order_id = order_id;
|
|
||||||
this.passenger_id = passenger_id;
|
|
||||||
this.flight_id = flight_id;
|
|
||||||
this.seat_id = seat_id;
|
|
||||||
this.food_name = food_name;
|
|
||||||
this.notes = notes;
|
|
||||||
this.boarding_status = boarding_status;
|
|
||||||
this.created_at = created_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Order() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOrder_id() {
|
|
||||||
return order_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrder_id(String order_id) {
|
|
||||||
this.order_id = order_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassenger_id() {
|
|
||||||
return passenger_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassenger_id(String passenger_id) {
|
|
||||||
this.passenger_id = passenger_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFlight_id() {
|
|
||||||
return flight_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlight_id(String flight_id) {
|
|
||||||
this.flight_id = flight_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSeat_id() {
|
|
||||||
return seat_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSeat_id(int seat_id) {
|
|
||||||
this.seat_id = seat_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFood_name() {
|
|
||||||
return food_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFood_name(String food_name) {
|
|
||||||
this.food_name = food_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNotes() {
|
|
||||||
return notes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNotes(String notes) {
|
|
||||||
this.notes = notes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBoarding_status() {
|
|
||||||
return boarding_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBoarding_status(boolean boarding_status) {
|
|
||||||
this.boarding_status = boarding_status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getCreated_at() {
|
|
||||||
return created_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreated_at(Timestamp created_at) {
|
|
||||||
this.created_at = created_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Order{" +
|
|
||||||
"order_id='" + order_id + '\'' +
|
|
||||||
", passenger_id='" + passenger_id + '\'' +
|
|
||||||
", flight_id='" + flight_id + '\'' +
|
|
||||||
", seat_id=" + seat_id +
|
|
||||||
", food_name='" + food_name + '\'' +
|
|
||||||
", notes='" + notes + '\'' +
|
|
||||||
", boarding_status=" + boarding_status +
|
|
||||||
", created_at=" + created_at +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
package model_new;
|
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class Passenger {
|
|
||||||
|
|
||||||
private String id_card;
|
|
||||||
private String name;
|
|
||||||
private boolean is_vip;
|
|
||||||
private Timestamp created_at;
|
|
||||||
|
|
||||||
public Passenger(String id_card, String name, boolean is_vip, Timestamp created_at) {
|
|
||||||
this.id_card = id_card;
|
|
||||||
this.name = name;
|
|
||||||
this.is_vip = is_vip;
|
|
||||||
this.created_at = created_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Passenger() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId_card() {
|
|
||||||
return id_card;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId_card(String id_card) {
|
|
||||||
this.id_card = id_card;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean Get_is_vip() {
|
|
||||||
return is_vip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIs_vip(boolean is_vip) {
|
|
||||||
this.is_vip = is_vip;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Timestamp getCreated_at() {
|
|
||||||
return created_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreated_at(Timestamp created_at) {
|
|
||||||
this.created_at = created_at;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Passenger{" +
|
|
||||||
"id_card='" + id_card + '\'' +
|
|
||||||
", name='" + name + '\'' +
|
|
||||||
", is_vip=" + is_vip +
|
|
||||||
", created_at=" + created_at +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
package model_new;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author 陶锦锋
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public class User {
|
|
||||||
private Integer id;
|
|
||||||
private String username;
|
|
||||||
private String password;
|
|
||||||
private String email;
|
|
||||||
private String phone;
|
|
||||||
private Date createTime;
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
// 构造方法
|
|
||||||
public User() {}
|
|
||||||
|
|
||||||
public User(String username, String password, String email) {
|
|
||||||
this.username = username;
|
|
||||||
this.password = password;
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
// getters and setters
|
|
||||||
public Integer getId() { return id; }
|
|
||||||
public void setId(Integer id) { this.id = id; }
|
|
||||||
|
|
||||||
public String getUsername() { return username; }
|
|
||||||
public void setUsername(String username) { this.username = username; }
|
|
||||||
|
|
||||||
public String getPassword() { return password; }
|
|
||||||
public void setPassword(String password) { this.password = password; }
|
|
||||||
|
|
||||||
public String getEmail() { return email; }
|
|
||||||
public void setEmail(String email) { this.email = email; }
|
|
||||||
|
|
||||||
public String getPhone() { return phone; }
|
|
||||||
public void setPhone(String phone) { this.phone = phone; }
|
|
||||||
|
|
||||||
public Date getCreateTime() { return createTime; }
|
|
||||||
public void setCreateTime(Date createTime) { this.createTime = createTime; }
|
|
||||||
|
|
||||||
public Date getUpdateTime() { return updateTime; }
|
|
||||||
public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return username + " (" + email + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||