1. add merchant purchasing module
This commit is contained in:
2026-04-24 21:21:56 +08:00
parent 5f44987416
commit 140fb13702
45 changed files with 2602 additions and 40 deletions

View File

@@ -0,0 +1,106 @@
drop table if exists merchant_product;
create table merchant_product
(
id int8 not null primary key,
user_id int8 not null default -1,
user_account varchar(20) not null,
product_name varchar(255) not null default '',
type int4 not null,
main_image_urls text[] DEFAULT '{}' NOT NULL,
detail_image_urls text[] DEFAULT '{}' NULL,
thumb_image_url text NULL,
specs JSONB DEFAULT '[]',
cost_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
remark TEXT,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4,
is_deleted int4 default 0
);
CREATE INDEX idx_merchant_product_type ON merchant_product (type) where is_deleted = 0;
CREATE INDEX idx_merchant_product_user_id ON merchant_product (user_id) where is_deleted = 0;
CREATE INDEX idx_merchant_product_user_id_account ON merchant_product (user_account) where is_deleted = 0;
comment on table merchant_product is '自营商家商品表';
comment on column merchant_product.id is '主键';
comment on column merchant_product.user_id is '用户id';
comment on column merchant_product.user_account is '用户账号';
comment on column merchant_product.type is '商品类型: 1-平台商品, 2-商家商品';
comment on column merchant_product.product_name is '商品名称';
comment on column merchant_product.main_image_urls is '商品主图';
comment on column merchant_product.detail_image_urls is '商品详情图';
comment on column merchant_product.thumb_image_url is '商品缩略图';
comment on column merchant_product.specs is '商品型号';
comment on column merchant_product.cost_price is '成本价(进货价, 单位为现金券)';
comment on column merchant_product.remark is '备注';
comment on column merchant_product.create_user is '创建人';
comment on column merchant_product.create_dept is '创建部门';
comment on column merchant_product.create_time is '创建时间';
comment on column merchant_product.update_user is '修改人';
comment on column merchant_product.update_time is '修改时间';
comment on column merchant_product.status is '状态: 1-待审核 2-已通过 3-已拒绝';
comment on column merchant_product.is_deleted is '是否已删除';
drop table if exists merchant_product_inventory;
create table merchant_product_inventory
(
id int8 not null primary key,
user_id int8 not null default -1,
user_account varchar(20) not null,
type int4 not null,
product_name varchar(255) not null default '',
product_id int8 not null,
quantity int4 default 0 NOT NULL,
remark TEXT,
version int4 DEFAULT 0 NULL,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4,
is_deleted int4 default 0
);
CREATE INDEX idx_merchant_product_inventory_user_id ON merchant_product_inventory (user_id) where is_deleted = 0;
CREATE INDEX idx_merchant_product_inventory_user_id_account ON merchant_product_inventory (user_account) where is_deleted = 0;
comment on table merchant_product_inventory is '自营商家库存表';
comment on column merchant_product_inventory.id is '主键';
comment on column merchant_product_inventory.user_id is '用户id';
comment on column merchant_product_inventory.user_account is '用户账号';
comment on column merchant_product_inventory.type is '商品类型: 1-平台商品, 2-商家商品';
comment on column merchant_product_inventory.product_name is '商品名称';
comment on column merchant_product_inventory.product_id is '商品id';
comment on column merchant_product_inventory.quantity is '库存数量';
comment on column merchant_product_inventory.remark is '备注';
comment on column merchant_product_inventory.create_user is '创建人';
comment on column merchant_product_inventory.create_dept is '创建部门';
comment on column merchant_product_inventory.create_time is '创建时间';
comment on column merchant_product_inventory.update_user is '修改人';
comment on column merchant_product_inventory.update_time is '修改时间';
comment on column merchant_product_inventory.status is '状态';
comment on column merchant_product_inventory.is_deleted is '是否已删除';
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2047553982355394562', '1123598815738675201', 'merchantproduct', '自营商家商品表', 'menu',
'/market/merchantProduct', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2047553982355394563', '2047553982355394562', 'merchantproduct_add', '新增', 'add',
'/market/merchantProduct/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2047553982355394564', '2047553982355394562', 'merchantproduct_edit', '修改', 'edit',
'/market/merchantProduct/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2047553982355394565', '2047553982355394562', 'merchantproduct_delete', '删除', 'delete',
'/api/market/merchantProduct/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
is_deleted)
VALUES ('2047553982355394566', '2047553982355394562', 'merchantproduct_view', '查看', 'view',
'/market/merchantProduct/view', 'file-text', 4, 2, 2, 1, NULL, 0);