旅游团sql-update
This commit is contained in:
@@ -1,48 +1,59 @@
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS tour_product;
|
DROP TABLE IF EXISTS tour_product;
|
||||||
CREATE TABLE tour_product
|
CREATE TABLE tour_product
|
||||||
(
|
(
|
||||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||||
product_name varchar(100) NOT NULL, -- 产品名称 (如:恩施硒茶文化之旅)
|
product_name varchar(100) NOT NULL, -- 产品名称 (如:恩施硒茶文化之旅)
|
||||||
sub_title varchar(255) DEFAULT NULL, -- 副标题/亮点 (如:4天3晚 | 研学之旅)
|
sub_title varchar(255) DEFAULT NULL, -- 副标题/亮点 (如:4天3晚 | 研学之旅)
|
||||||
thumbnail_url text, -- 缩略图
|
thumbnail_url text DEFAULT NULL, -- 缩略图
|
||||||
main_image_url text[] default '{}'::text[], -- 商家主图
|
main_image_url text[] DEFAULT '{}'::text[], -- 商家主图 (数组)
|
||||||
detail_images text[] default '{}'::text[], -- 详情展示多图
|
detail_images text[] DEFAULT '{}'::text[], -- 详情展示多图 (数组)
|
||||||
city_code varchar(20) DEFAULT NULL, -- 目的地城市编码
|
city_name varchar(50) DEFAULT NULL, -- 目的地城市名称
|
||||||
duration_days int4 DEFAULT NULL, -- 行程天数
|
duration_days int4 DEFAULT NULL, -- 行程天数
|
||||||
duration_nights int4 DEFAULT NULL, -- 住宿晚数
|
duration_nights int4 DEFAULT NULL, -- 住宿晚数
|
||||||
base_price decimal(10, 2) NOT NULL, -- 基础起售价
|
base_price decimal(10, 2) NOT NULL, -- 基础起售价
|
||||||
adult_price decimal(10, 2) DEFAULT NULL, -- 成人单价
|
adult_price decimal(10, 2) DEFAULT NULL, -- 成人单价
|
||||||
child_price decimal(10, 2) DEFAULT NULL, -- 儿童单价
|
child_price decimal(10, 2) DEFAULT NULL, -- 儿童单价
|
||||||
description text DEFAULT NULL, -- 产品详情描述
|
elderly_price decimal(10, 2) DEFAULT NULL, -- 老年人单价
|
||||||
visit_count int4 DEFAULT 0, -- 已成团次数
|
min_people int4 DEFAULT 1, -- 最小成团人数
|
||||||
create_user int8 NULL, -- 创建人ID
|
max_people int4 DEFAULT 9999, -- 最大接待人数
|
||||||
create_dept int8 NULL, -- 创建部门ID
|
require_id_card int4 DEFAULT 0, -- 是否强制身份证
|
||||||
create_time timestamp(6) NULL, -- 创建时间
|
require_passport int4 DEFAULT 0, -- 是否强制护照
|
||||||
update_user int8 NULL, -- 修改人ID
|
require_hk_macau_pass int4 DEFAULT 0, -- 是否强制港澳通行证
|
||||||
update_time timestamp(6) NULL, -- 修改时间
|
description text DEFAULT NULL, -- 产品详情描述
|
||||||
status int4 NULL DEFAULT 1, -- 状态:0=下架,1=上架
|
visit_count int4 DEFAULT 0, -- 已成团次数/销量
|
||||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除:0=未删除,1=已删除
|
create_user int8 NULL, -- 创建人ID
|
||||||
|
create_dept int8 NULL, -- 创建部门ID
|
||||||
|
create_time timestamp(6) NULL, -- 创建时间
|
||||||
|
update_user int8 NULL, -- 修改人ID
|
||||||
|
update_time timestamp(6) NULL, -- 修改时间
|
||||||
|
status int4 NULL DEFAULT 1, -- 状态:0=下架,1=上架
|
||||||
|
is_deleted int4 DEFAULT 0 NULL -- 是否已删除:0=未删除,1=已删除
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- 添加表注释
|
||||||
COMMENT ON TABLE tour_product IS '旅游产品表';
|
COMMENT ON TABLE tour_product IS '旅游产品表';
|
||||||
|
|
||||||
|
-- 添加列注释
|
||||||
COMMENT ON COLUMN tour_product.id IS '主键ID';
|
COMMENT ON COLUMN tour_product.id IS '主键ID';
|
||||||
COMMENT ON COLUMN tour_product.product_name IS '产品名称 (如:恩施硒茶文化之旅)';
|
COMMENT ON COLUMN tour_product.product_name IS '产品名称 (如:恩施硒茶文化之旅)';
|
||||||
COMMENT ON COLUMN tour_product.sub_title IS '副标题/亮点 (如:4天3晚 | 研学之旅)';
|
COMMENT ON COLUMN tour_product.sub_title IS '副标题/亮点 (如:4天3晚 | 研学之旅)';
|
||||||
COMMENT ON COLUMN tour_product.thumbnail_url IS '缩略图';
|
COMMENT ON COLUMN tour_product.thumbnail_url IS '缩略图';
|
||||||
COMMENT ON COLUMN tour_product.main_image_url IS '商家主图';
|
COMMENT ON COLUMN tour_product.main_image_url IS '商家主图 (数组)';
|
||||||
COMMENT ON COLUMN tour_product.detail_images IS '详情图';
|
COMMENT ON COLUMN tour_product.detail_images IS '详情展示多图 (数组)';
|
||||||
COMMENT ON COLUMN tour_product.city_code IS '目的地城市编码';
|
COMMENT ON COLUMN tour_product.city_name IS '目的地城市名称';
|
||||||
COMMENT ON COLUMN tour_product.duration_days IS '行程天数';
|
COMMENT ON COLUMN tour_product.duration_days IS '行程天数';
|
||||||
COMMENT ON COLUMN tour_product.duration_nights IS '住宿晚数';
|
COMMENT ON COLUMN tour_product.duration_nights IS '住宿晚数';
|
||||||
COMMENT ON COLUMN tour_product.base_price IS '基础起售价';
|
COMMENT ON COLUMN tour_product.base_price IS '基础起售价';
|
||||||
COMMENT ON COLUMN tour_product.adult_price IS '成人单价';
|
COMMENT ON COLUMN tour_product.adult_price IS '成人单价';
|
||||||
COMMENT ON COLUMN tour_product.child_price IS '儿童单价';
|
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.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.description IS '产品详情描述';
|
||||||
COMMENT ON COLUMN tour_product.visit_count IS '已成团次数';
|
COMMENT ON COLUMN tour_product.visit_count IS '已成团次数/销量';
|
||||||
COMMENT ON COLUMN tour_product.create_user IS '创建人ID';
|
COMMENT ON COLUMN tour_product.create_user IS '创建人ID';
|
||||||
COMMENT ON COLUMN tour_product.create_dept IS '创建部门ID';
|
COMMENT ON COLUMN tour_product.create_dept IS '创建部门ID';
|
||||||
COMMENT ON COLUMN tour_product.create_time IS '创建时间';
|
COMMENT ON COLUMN tour_product.create_time IS '创建时间';
|
||||||
@@ -56,35 +67,38 @@ COMMENT ON COLUMN tour_product.is_deleted IS '是否已删除:0=未删除,1=
|
|||||||
DROP TABLE IF EXISTS tour_order_traveler;
|
DROP TABLE IF EXISTS tour_order_traveler;
|
||||||
CREATE TABLE tour_order_traveler
|
CREATE TABLE tour_order_traveler
|
||||||
(
|
(
|
||||||
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
id int8 NOT NULL PRIMARY KEY, -- 主键ID
|
||||||
order_id int8 NOT NULL, -- 关联订单ID
|
order_id int8 NOT NULL, -- 关联订单ID
|
||||||
traveler_type int4 NOT NULL, -- 人员类型:1=成人,2=儿童
|
traveler_type int4 NOT NULL, -- 人员类型:1=成人,2=儿童,3=老人
|
||||||
user_name varchar(50) NOT NULL, -- 姓名
|
user_name varchar(50) NOT NULL, -- 姓名
|
||||||
id_card_no varchar(20) DEFAULT NULL, -- 身份证号
|
id_card_no varchar(20) DEFAULT NULL, -- 身份证号
|
||||||
passport_no varchar(20) DEFAULT NULL, -- 护照号码(证件预留)
|
passport_no varchar(20) DEFAULT NULL, -- 护照号码
|
||||||
hk_macau_pass_no varchar(20) DEFAULT NULL, -- 港澳通行证号码
|
hk_macau_pass_no varchar(20) DEFAULT NULL, -- 港澳通行证号码
|
||||||
gender int4 DEFAULT NULL, -- 性别:1=男,2=女
|
gender int4 DEFAULT NULL, -- 性别:1=男,2=女
|
||||||
contact_phone varchar(20) DEFAULT NULL, -- 出行人本人手机
|
contact_phone varchar(20) DEFAULT NULL, -- 出行人本人手机
|
||||||
create_user int8 NULL, -- 创建人ID
|
start_date timestamp(6) DEFAULT NULL, -- 出行日期
|
||||||
create_dept int8 NULL, -- 创建部门ID
|
end_date timestamp(6) DEFAULT NULL, -- 预计返回日期
|
||||||
create_time timestamp(6) NULL, -- 创建时间
|
create_user int8 NULL, -- 创建人ID
|
||||||
update_user int8 NULL, -- 修改人ID
|
create_dept int8 NULL, -- 创建部门ID
|
||||||
update_time timestamp(6) NULL, -- 修改时间
|
create_time timestamp(6) NULL, -- 创建时间
|
||||||
status int4 NULL DEFAULT 1, -- 状态:0=无效,1=有效
|
update_user int8 NULL, -- 修改人ID
|
||||||
is_deleted int4 DEFAULT 0 NULL -- 是否已删除:0=未删除,1=已删除
|
update_time timestamp(6) NULL, -- 修改时间
|
||||||
|
status int4 NULL DEFAULT 1, -- 状态:0=无效,1=有效
|
||||||
|
is_deleted int4 DEFAULT 0 NULL -- 是否已删除:0=未删除,1=已删除
|
||||||
);
|
);
|
||||||
|
|
||||||
COMMENT ON TABLE tour_order_traveler IS '订单出行人明细表';
|
COMMENT ON TABLE tour_order_traveler IS '订单出行人明细表';
|
||||||
COMMENT ON COLUMN tour_order_traveler.id IS '主键ID';
|
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.order_id IS '关联订单ID';
|
||||||
COMMENT ON COLUMN tour_order_traveler.traveler_type IS '人员类型:1=成人,2=儿童';
|
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.user_name IS '姓名';
|
||||||
COMMENT ON COLUMN tour_order_traveler.id_card_no 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.passport_no IS '护照号码';
|
||||||
COMMENT ON COLUMN tour_order_traveler.hk_macau_pass_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.gender IS '性别:1=男,2=女';
|
||||||
COMMENT ON COLUMN tour_order_traveler.contact_phone IS '出行人本人手机';
|
COMMENT ON COLUMN tour_order_traveler.contact_phone 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';
|
COMMENT ON COLUMN tour_order_traveler.create_user IS '创建人ID';
|
||||||
COMMENT ON COLUMN tour_order_traveler.create_dept IS '创建部门ID';
|
COMMENT ON COLUMN tour_order_traveler.create_dept IS '创建部门ID';
|
||||||
COMMENT ON COLUMN tour_order_traveler.create_time IS '创建时间';
|
COMMENT ON COLUMN tour_order_traveler.create_time IS '创建时间';
|
||||||
@@ -93,7 +107,4 @@ 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.status IS '状态:0=无效,1=有效';
|
||||||
COMMENT ON COLUMN tour_order_traveler.is_deleted 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_order_id ON tour_order_traveler (order_id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user