Files
yichayilu_boot/doc/sql/executed/20260520.sql
RayL 51eac66a6d update:
1. fix
2026-05-25 00:58:32 +08:00

114 lines
6.4 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- merchant_catalog
alter table merchant_catalog add stock int4 default 0 not null;
alter table merchant_catalog add version int4 default 0 not null;
comment on column merchant_catalog.stock is '库存';
comment on column merchant_catalog.version is '乐观锁';
-- merchant_catalog_operate_log
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 '是否已删除';
-- market_daily_summary
alter table market_daily_summary rename column personal_benefits_level to personal_benefits_level_id;
alter table market_daily_summary rename column personal_cash_level to personal_cash_level_id;
alter table market_daily_summary add personal_benefits_level_name varchar(255);
alter table market_daily_summary add personal_cash_level_name varchar(255);
comment on column market_daily_summary.personal_benefits_level_name is '福利等级名称';
comment on column market_daily_summary.personal_cash_level_name is '现金等级名称';
-- market_upgrade_config
alter table market_upgrade_config add level integer default 0 not null;
comment on column market_upgrade_config.level is '等级';
-- merchant_whitelist
DROP TABLE IF EXISTS merchant_whitelist;
create table merchant_whitelist
(
id int8 not null primary key,
user_id int8 not null default -1,
user_account varchar(20) not null default '',
type int4 default 1, -- 1-自营商家
remark text,
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 null,
is_deleted int4 default 0
);
CREATE INDEX idx_merchant_whitelist_user_id_type ON merchant_whitelist (user_id, type) WHERE is_deleted = 0;
CREATE INDEX idx_merchant_whitelist_user_account_type ON merchant_whitelist (user_account, type) WHERE is_deleted = 0;
COMMENT ON TABLE merchant_whitelist IS '自营商家白名单';
COMMENT ON COLUMN merchant_whitelist.id IS '主键';
COMMENT ON COLUMN merchant_whitelist.user_id IS '用户id';
COMMENT ON COLUMN merchant_whitelist.user_account IS '用户账号';
COMMENT ON COLUMN merchant_whitelist.type IS '作用类型:1-自营商家';
COMMENT ON COLUMN merchant_whitelist.remark IS '备注';
comment on column merchant_whitelist.create_user is '创建人';
comment on column merchant_whitelist.create_dept is '创建部门';
comment on column merchant_whitelist.create_time is '创建时间';
comment on column merchant_whitelist.update_user is '修改人';
comment on column merchant_whitelist.update_time is '修改时间';
comment on column merchant_whitelist.status is '状态';
comment on column merchant_whitelist.is_deleted is '是否已删除';
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2058049305280409601', '1123598815738675201', 'whitelist', '自营商家白名单', 'menu', '/market/whitelist', 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 ('2058049305280409602', '2058049305280409601', 'whitelist_add', '新增', 'add', '/market/whitelist/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 ('2058049305280409603', '2058049305280409601', 'whitelist_edit', '修改', 'edit', '/market/whitelist/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 ('2058049305280409604', '2058049305280409601', 'whitelist_delete', '删除', 'delete', '/api/market/merchant-whitelist/whitelist/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 ('2058049305280409605', '2058049305280409601', 'whitelist_view', '查看', 'view', '/market/whitelist/view', 'file-text', 4, 2, 2, 1, NULL, 0);