1. add mall product
This commit is contained in:
2026-02-06 00:22:54 +08:00
parent 4d18d698df
commit cc812cf1d3
3 changed files with 189 additions and 101 deletions

View File

@@ -1,49 +1,53 @@
CREATE TABLE user_order
(
id int8 DEFAULT 0 NOT NULL PRIMARY KEY,
user_id int8 DEFAULT 0 NOT NULL,
user_phone int8,
user_name varchar(128),
order_type int4 DEFAULT 0 NOT NULL,
order_id int8 DEFAULT 0 NOT NULL,
title VARCHAR(256) DEFAULT '' NOT NULL,
images VARCHAR(512) NULL,
quantity int4 NULL,
description VARCHAR(200) DEFAULT '' NOT NULL,
order_status int4 DEFAULT 0 NOT NULL,
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
payment_type int4 DEFAULT 0 NOT NULL,
payment_time TIMESTAMP NULL,
payment_track VARCHAR(255) DEFAULT '' NOT NULL,
payment_status int4 DEFAULT 1 NOT NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP(6) NULL,
update_user int8 NULL,
update_time TIMESTAMP(6) NULL,
status int4 NULL,
is_deleted int4 DEFAULT 0 NULL
id int8 NOT NULL PRIMARY KEY,
user_id int8 NOT NULL,
consignee_phone varchar(128) NOT NULL,
consignee varchar(128) NOT NULL,
order_type varchar(128) NOT NULL,
item_code varchar(128) NOT NULL,
item_name varchar(128) NOT NULL,
image_url VARCHAR(512) NULL,
quantity int4 DEFAULT 1 NOT NULL,
delivery_address text NULL,
express_company VARCHAR(100) NULL,
express_no VARCHAR(100) NULL,
order_status int4 DEFAULT 0 NOT NULL,
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
payment_type int4 DEFAULT 0 NOT NULL,
payment_time TIMESTAMP NULL,
payment_status int4 DEFAULT 0 NOT NULL,
payment_track VARCHAR(255) DEFAULT '' NOT NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP(6) NULL,
update_user int8 NULL,
update_time TIMESTAMP(6) NULL,
status int4 NULL,
is_deleted int4 DEFAULT 0 NULL
);
COMMENT ON TABLE user_order IS '用户订单';
COMMENT ON COLUMN user_order.id IS '主键';
COMMENT ON COLUMN user_order.user_id IS '用户id';
COMMENT ON COLUMN user_order.user_phone IS '用户手机号';
COMMENT ON COLUMN user_order.user_name IS '用户名称';
COMMENT ON COLUMN user_order.consignee_phone IS '收件人手机号';
COMMENT ON COLUMN user_order.consignee IS '收件人';
COMMENT ON COLUMN user_order.order_type IS '订单类型';
COMMENT ON COLUMN user_order.order_id IS '订单id';
COMMENT ON COLUMN user_order.title IS '订单名称';
COMMENT ON COLUMN user_order.images IS '图片';
COMMENT ON COLUMN user_order.item_code IS '商品编号';
COMMENT ON COLUMN user_order.item_name IS '商品名称';
COMMENT ON COLUMN user_order.image_url IS '图片';
COMMENT ON COLUMN user_order.quantity IS '数量';
COMMENT ON COLUMN user_order.description IS '订单描述';
COMMENT ON COLUMN user_order.order_status IS '订单状态';
COMMENT ON COLUMN user_order.delivery_address IS '收货地址(实物商品必填,虚拟商品可为空)';
COMMENT ON COLUMN user_order.order_status IS '订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款';
COMMENT ON COLUMN user_order.total_amount IS '订单金额';
COMMENT ON COLUMN user_order.actual_amount IS '实际支付金额';
COMMENT ON COLUMN user_order.payment_type IS '支付方式';
COMMENT ON COLUMN user_order.payment_time IS '支付时间';
COMMENT ON COLUMN user_order.payment_track IS '支付凭证编号';
COMMENT ON COLUMN user_order.payment_status IS '支付状态';
COMMENT ON COLUMN user_order.payment_status IS '支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)';
COMMENT ON COLUMN user_order.express_company IS '快递公司名称';
COMMENT ON COLUMN user_order.express_no IS '快递单号(物流单号)';
COMMENT ON COLUMN user_order.create_user IS '创建人';
COMMENT ON COLUMN user_order.create_dept IS '创建部门';
COMMENT ON COLUMN user_order.create_time IS '创建时间';
@@ -51,7 +55,9 @@ COMMENT ON COLUMN user_order.update_user IS '修改人';
COMMENT ON COLUMN user_order.update_time IS '修改时间';
COMMENT ON COLUMN user_order.status IS '状态';
CREATE INDEX user_order_index ON user_order (user_id, order_type);
CREATE INDEX idx_user_order_user_status_time ON user_order (user_id, order_status, create_time DESC);
CREATE INDEX idx_user_order_status_time ON user_order (order_status, create_time DESC);
alter table user_order
owner to yicha1lu;
@@ -62,12 +68,12 @@ CREATE TABLE mall_summary_order
user_id int8 DEFAULT 0 NOT NULL,
user_phone int8,
user_name varchar(128),
products_info text NULL,
order_info text NULL,
confirm_info text NULL,
products_info text NULL,
order_info text NULL,
confirm_info text NULL,
vendor_regions_id int8 NOT NULL,
address_id int8 NOT NULL,
delivery_info text NULL,
delivery_info text NULL,
freight_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
order_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
@@ -78,20 +84,20 @@ CREATE TABLE mall_summary_order
extra_type int4 DEFAULT 0 NOT NULL,
payment_status int4 DEFAULT 0 NOT NULL,
order_status int4 DEFAULT 0 NOT NULL,
payment_completed_time TIMESTAMP NULL,
payment_completed_time TIMESTAMP NULL,
payment_track VARCHAR(200) DEFAULT '' NOT NULL,
expire_time TIMESTAMP NULL,
is_recorded int4 DEFAULT 0 NULL,
is_statistics int4 DEFAULT 0 NULL,
expire_time TIMESTAMP NULL,
is_recorded int4 DEFAULT 0 NULL,
is_statistics int4 DEFAULT 0 NULL,
remarks VARCHAR(200) DEFAULT '' NOT NULL,
version int8 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT 0 NULL,
is_deleted int4 DEFAULT 0 NULL
version int8 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT 0 NULL,
is_deleted int4 DEFAULT 0 NULL
);
@@ -148,10 +154,10 @@ CREATE TABLE mall_detail_order
summary_order_id int8 DEFAULT 0 NOT NULL,
spu_id int8 DEFAULT 0 NOT NULL,
quantity int4 DEFAULT 0 NOT NULL,
sku_snapshot text NULL,
sku_snapshot text NULL,
freight_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
actual_cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
order_amount DECIMAL(10, 2) NULL,
order_amount DECIMAL(10, 2) NULL,
cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
remarks VARCHAR(200) DEFAULT '' NOT NULL,
@@ -159,15 +165,15 @@ CREATE TABLE mall_detail_order
freight VARCHAR(200) DEFAULT 0.00 NOT NULL,
logistics VARCHAR(200) DEFAULT 0.00 NOT NULL,
delivery_time timestamp(6),
products_info text NULL,
version int4 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT -1 NULL,
is_deleted int4 DEFAULT 0 NULL
products_info text NULL,
version int4 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT -1 NULL,
is_deleted int4 DEFAULT 0 NULL
);
COMMENT ON TABLE mall_detail_order IS '商城详情订单';
@@ -211,27 +217,27 @@ CREATE TABLE mall_summary_order_after
goods_id int8 DEFAULT -1 NOT NULL,
sku_id int8 NOT NULL,
goods_name VARCHAR(256) NOT NULL,
quantity int4 DEFAULT -1 NULL,
apply_type int4 NULL,
quantity int4 DEFAULT -1 NULL,
apply_type int4 NULL,
apply_reason VARCHAR(100) DEFAULT '-1' NULL,
apply_pic_urls TEXT NULL,
apply_pic_urls TEXT NULL,
refund_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
refund_status int4 DEFAULT 0 NULL,
refund_reason VARCHAR(255) NULL,
receiver VARCHAR(125) NULL,
receiver_phone VARCHAR(255) NULL,
receiver_addr VARCHAR(255) NULL,
receiver_delivery_no VARCHAR(255) NULL,
remarks VARCHAR(200) DEFAULT '' NULL,
version int4 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT 0 NULL,
is_deleted int4 DEFAULT 0 NULL,
after_info JSON NULL
refund_status int4 DEFAULT 0 NULL,
refund_reason VARCHAR(255) NULL,
receiver VARCHAR(125) NULL,
receiver_phone VARCHAR(255) NULL,
receiver_addr VARCHAR(255) NULL,
receiver_delivery_no VARCHAR(255) NULL,
remarks VARCHAR(200) DEFAULT '' NULL,
version int4 DEFAULT 0 NULL,
create_user int8 NULL,
create_dept int8 NULL,
create_time TIMESTAMP NULL,
update_user int8 NULL,
update_time TIMESTAMP NULL,
status int4 DEFAULT 0 NULL,
is_deleted int4 DEFAULT 0 NULL,
after_info JSON NULL
);
COMMENT ON TABLE mall_summary_order_after IS '商品售后订单表';