1. 新增平台商品库存
This commit is contained in:
2026-05-20 15:38:06 +08:00
parent 0d6a254661
commit 7e2f759bd4
22 changed files with 992 additions and 3 deletions

View File

@@ -1,4 +0,0 @@
alter table merchant_catalog
add sale_price decimal(10, 2) default 0 not null;
comment on column public.merchant_catalog.sale_price is '销售价格';

View File

@@ -0,0 +1,57 @@
alter table merchant_catalog
add stock int4 default 0 not null;
comment on column public.merchant_catalog.stock is '库存';
alter table merchant_catalog
add version int4 default 0 not null;
comment on column public.merchant_catalog.version is '乐观锁';
DROP TABLE IF EXISTS merchant_catalog_operate_log;
create table merchant_catalog_operate_log
(
id int8 not null primary key,
merchant_id int8 not null default -1,
merchant_account varchar(20) not null default '',
product_id int8 not null,
product_name varchar(255) not null default '',
type int4 default 1, -- 1-扣减 2-增加 3-下架
affected_stock int4 not null,
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1,
is_deleted int4 default 0
);
CREATE INDEX idx_merchant_catalog_log_merchant_id_create_time
ON merchant_catalog_operate_log (merchant_id, create_time DESC) WHERE is_deleted = 0;
CREATE INDEX idx_merchant_catalog_log_product_id_create_time
ON merchant_catalog_operate_log (product_id, create_time DESC) WHERE is_deleted = 0;
CREATE INDEX idx_merchant_catalog_log_create_time
ON merchant_catalog_operate_log (create_time DESC) WHERE is_deleted = 0;
COMMENT ON TABLE merchant_catalog_operate_log IS '自营商家产品目录操作日志';
COMMENT ON COLUMN merchant_catalog_operate_log.id IS '主键';
COMMENT ON COLUMN merchant_catalog_operate_log.merchant_id IS '商家id';
COMMENT ON COLUMN merchant_catalog_operate_log.merchant_account IS '商家账号';
COMMENT ON COLUMN merchant_catalog_operate_log.product_id IS '商品id';
COMMENT ON COLUMN merchant_catalog_operate_log.product_name IS '商品名称';
COMMENT ON COLUMN merchant_catalog_operate_log.type IS '操作类型:1-扣减 2-增加 3-下架';
COMMENT ON COLUMN merchant_catalog_operate_log.affected_stock IS '受影响数量';
COMMENT ON COLUMN merchant_catalog_operate_log.remark IS '备注';
comment on column merchant_catalog_operate_log.create_user is '创建人';
comment on column merchant_catalog_operate_log.create_dept is '创建部门';
comment on column merchant_catalog_operate_log.create_time is '创建时间';
comment on column merchant_catalog_operate_log.update_user is '修改人';
comment on column merchant_catalog_operate_log.update_time is '修改时间';
comment on column merchant_catalog_operate_log.status is '状态';
comment on column merchant_catalog_operate_log.is_deleted is '是否已删除';