旅游团sql-update

This commit is contained in:
2026-03-20 18:15:00 +08:00
parent e04672fbeb
commit e8573b90db

View File

@@ -16,11 +16,13 @@ CREATE TABLE tour_product
elderly_price decimal(10, 2) DEFAULT NULL, -- 老年人单价
min_people int4 DEFAULT 1, -- 最小成团人数
max_people int4 DEFAULT 9999, -- 最大接待人数
is_recommended int4 DEFAULT 0, -- 是否推荐
require_id_card int4 DEFAULT 0, -- 是否强制身份证
require_passport int4 DEFAULT 0, -- 是否强制护照
require_hk_macau_pass int4 DEFAULT 0, -- 是否强制港澳通行证
description text DEFAULT NULL, -- 产品详情描述
visit_count int4 DEFAULT 0, -- 已成团次数/销量
rating decimal(3, 2) DEFAULT 0.00, -- 用户评分
create_user int8 NULL, -- 创建人ID
create_dept int8 NULL, -- 创建部门ID
create_time timestamp(6) NULL, -- 创建时间
@@ -49,11 +51,13 @@ COMMENT ON COLUMN tour_product.child_price IS '儿童单价';
COMMENT ON COLUMN tour_product.elderly_price IS '老年人单价';
COMMENT ON COLUMN tour_product.min_people IS '最小成团人数';
COMMENT ON COLUMN tour_product.max_people IS '最大接待人数';
COMMENT ON COLUMN tour_product.is_recommended IS '是否推荐:0=否,1=是';
COMMENT ON COLUMN tour_product.require_id_card IS '是否强制身份证:0=否,1=是';
COMMENT ON COLUMN tour_product.require_passport IS '是否强制护照:0=否,1=是';
COMMENT ON COLUMN tour_product.require_hk_macau_pass IS '是否强制港澳通行证:0=否,1=是';
COMMENT ON COLUMN tour_product.description IS '产品详情描述';
COMMENT ON COLUMN tour_product.visit_count IS '已成团次数/销量';
COMMENT ON COLUMN tour_product.rating IS '用户评分';
COMMENT ON COLUMN tour_product.create_user IS '创建人ID';
COMMENT ON COLUMN tour_product.create_dept IS '创建部门ID';
COMMENT ON COLUMN tour_product.create_time IS '创建时间';
@@ -69,13 +73,8 @@ CREATE TABLE tour_order_traveler
(
id int8 NOT NULL PRIMARY KEY, -- 主键ID
order_id int8 NOT NULL, -- 关联订单ID
traveler_type int4 NOT NULL, -- 人员类型:1=成人,2=儿童,3=老人
user_name varchar(50) NOT NULL, -- 姓名
id_card_no varchar(20) DEFAULT NULL, -- 身份证号
passport_no varchar(20) DEFAULT NULL, -- 护照号码
hk_macau_pass_no varchar(20) DEFAULT NULL, -- 港澳通行证号码
gender int4 DEFAULT NULL, -- 性别:1=男,2=女
contact_phone varchar(20) DEFAULT NULL, -- 出行人本人手机
user_id int8 NOT NULL,
traveler_detail text DEFAULT NULL, -- 出行信息快照
start_date timestamp(6) DEFAULT NULL, -- 出行日期
end_date timestamp(6) DEFAULT NULL, -- 预计返回日期
create_user int8 NULL, -- 创建人ID
@@ -90,13 +89,8 @@ CREATE TABLE tour_order_traveler
COMMENT ON TABLE tour_order_traveler IS '订单出行人明细表';
COMMENT ON COLUMN tour_order_traveler.id IS '主键ID';
COMMENT ON COLUMN tour_order_traveler.order_id IS '关联订单ID';
COMMENT ON COLUMN tour_order_traveler.traveler_type IS '人员类型:1=成人,2=儿童,3=老人';
COMMENT ON COLUMN tour_order_traveler.user_name IS '姓名';
COMMENT ON COLUMN tour_order_traveler.id_card_no IS '身份证号';
COMMENT ON COLUMN tour_order_traveler.passport_no IS '护照号码';
COMMENT ON COLUMN tour_order_traveler.hk_macau_pass_no IS '港澳通行证号码';
COMMENT ON COLUMN tour_order_traveler.gender IS '性别:1=男,2=女';
COMMENT ON COLUMN tour_order_traveler.contact_phone IS '出行人本人手机';
COMMENT ON COLUMN tour_user_profile.user_id IS '关联系统用户ID (所属人)';
COMMENT ON COLUMN tour_order_traveler.traveler_detail IS '出行信息快照';
COMMENT ON COLUMN tour_order_traveler.start_date IS '出行日期';
COMMENT ON COLUMN tour_order_traveler.end_date IS '预计返回日期';
COMMENT ON COLUMN tour_order_traveler.create_user IS '创建人ID';
@@ -107,4 +101,49 @@ COMMENT ON COLUMN tour_order_traveler.update_time IS '修改时间';
COMMENT ON COLUMN tour_order_traveler.status IS '状态:0=无效,1=有效';
COMMENT ON COLUMN tour_order_traveler.is_deleted IS '是否已删除:0=未删除,1=已删除';
CREATE INDEX idx_order_id ON tour_order_traveler (order_id);
CREATE INDEX idx_tot_oid ON tour_order_traveler (order_id);
CREATE INDEX idx_tot_uid ON tour_order_traveler (user_id);
DROP TABLE IF EXISTS tour_user_profile;
CREATE TABLE tour_user_profile
(
id int8 NOT NULL PRIMARY KEY, -- 主键ID
user_id int8 NOT NULL, -- 关联系统用户ID
id_card_no varchar(20) DEFAULT NULL, -- 身份证号
passport_no varchar(30) DEFAULT NULL, -- 护照号码
hk_macau_pass_no varchar(20) DEFAULT NULL, -- 港澳通行证号码
user_name varchar(50) NOT NULL, -- 姓名
gender int4 DEFAULT NULL,
contact_phone varchar(20) DEFAULT NULL, -- 本人手机号
traveler_type int4 DEFAULT 1, -- 默认人员类型:1=成人,2=儿童,3=老人 (系统可根据生日自动算,但允许用户手动修正)
remark varchar(255) DEFAULT NULL, -- 备注 (如:晕车、素食、靠窗座位等偏好)
create_user int8 NULL, -- 创建人ID (通常同 user_id)
create_dept int8 NULL, -- 创建部门ID (若为B2B2C模式可能需要)
create_time timestamp(6) NULL, -- 创建时间
update_user int8 NULL, -- 修改人ID
update_time timestamp(6) NULL, -- 修改时间
status int4 NULL DEFAULT 1,
is_deleted int4 NOT NULL DEFAULT 0 -- 逻辑删除:0=未删除,1=已删除
);
-- 表注释
COMMENT ON TABLE tour_user_profile IS '基础出行人档案表';
COMMENT ON COLUMN tour_user_profile.id IS '主键ID';
COMMENT ON COLUMN tour_user_profile.user_id IS '关联系统用户ID (所属人)';
COMMENT ON COLUMN tour_user_profile.id_card_no IS '身份证号';
COMMENT ON COLUMN tour_user_profile.passport_no IS '护照号码';
COMMENT ON COLUMN tour_user_profile.hk_macau_pass_no IS '港澳通行证号码';
COMMENT ON COLUMN tour_user_profile.user_name IS '姓名';
COMMENT ON COLUMN tour_user_profile.gender IS '性别:1=男,2=女';
COMMENT ON COLUMN tour_user_profile.contact_phone IS '本人手机号';
COMMENT ON COLUMN tour_user_profile.traveler_type IS '默认人员类型:1=成人,2=儿童,3=老人';
COMMENT ON COLUMN tour_user_profile.remark IS '备注偏好';
COMMENT ON COLUMN tour_user_profile.create_user IS '创建人ID';
COMMENT ON COLUMN tour_user_profile.create_dept IS '创建部门ID';
COMMENT ON COLUMN tour_user_profile.create_time IS '创建时间';
COMMENT ON COLUMN tour_user_profile.update_user IS '修改人ID';
COMMENT ON COLUMN tour_user_profile.update_time IS '修改时间';
COMMENT ON COLUMN tour_user_profile.is_deleted IS '是否已删除:0=未删除,1=已删除';
CREATE INDEX idx_tup_uid ON tour_user_profile (user_id);