Files
yichayilu_boot/doc/sql/pending/20260209_increase.sql
RayL e1105dae89 feat:
1. add lottery
2026-02-14 16:31:51 +08:00

1073 lines
59 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.

DROP TABLE IF EXISTS user_notice;
CREATE TABLE user_notice
(
id int8 NOT NULL PRIMARY KEY, -- 主键
user_id int8 DEFAULT 0 NOT NULL, -- 用户id
notice_type int4 DEFAULT 0 NOT NULL, -- 通知类型 0-系统通知 1-app通知 2-market通知
module_type varchar(256) NULL, -- 业务模块
has_read int4 DEFAULT 0 NOT NULL, -- 是否已读 0-否 1-是
title VARCHAR(100) NULL, -- 标题
content TEXT NULL, -- 内容
remarks varchar(200) 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_notice IS '用户通知';
COMMENT ON COLUMN user_notice.id IS '主键';
COMMENT ON COLUMN user_notice.user_id IS '用户id';
COMMENT ON COLUMN user_notice.notice_type IS '通知类型 0-系统通知 1-app通知 2-market通知';
COMMENT ON COLUMN user_notice.module_type IS '业务模块类型';
COMMENT ON COLUMN user_notice.has_read IS '是否已读 0-否 1-是';
COMMENT ON COLUMN user_notice.title IS '标题';
COMMENT ON COLUMN user_notice.content IS '内容';
COMMENT ON COLUMN user_notice.remarks IS '备注';
COMMENT ON COLUMN user_notice.create_user IS '创建人';
COMMENT ON COLUMN user_notice.create_dept IS '创建部门';
COMMENT ON COLUMN user_notice.create_time IS '创建时间';
COMMENT ON COLUMN user_notice.update_user IS '修改人';
COMMENT ON COLUMN user_notice.update_time IS '修改时间';
COMMENT ON COLUMN user_notice.status IS '状态';
COMMENT ON COLUMN user_notice.is_deleted IS '是否已删除';
CREATE INDEX CONCURRENTLY idx_user_notice_opt ON user_notice (user_id, has_read ASC, create_time DESC, notice_type) WHERE is_deleted = 0;
CREATE INDEX CONCURRENTLY idx_user_notice_count ON user_notice (user_id, notice_type, has_read) WHERE is_deleted = 0;
---- 后台页面菜单
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component,
remark, is_deleted)
VALUES (2020763647899787265, 1123598815738675201, 'userNotice', '用户通知', 'menu', '/common/commonUserNotice', null, 1,
1,
0, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component,
remark, is_deleted)
VALUES (2020763647899787266, 2020763647899787265, 'userNotice_add', '新增', 'add', '/common/commonUserNotice/add',
'plus',
1, 2, 1, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component,
remark, is_deleted)
VALUES (2020763647899787267, 2020763647899787265, 'userNotice_edit', '修改', 'edit', '/common/commonUserNotice/edit',
'form', 2, 2, 2, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component,
remark, is_deleted)
VALUES (2020763647899787268, 2020763647899787265, 'userNotice_delete', '删除', 'delete',
'/api/common/commonUserNotice/remove', 'delete', 3, 2, 3, 1, null, null, 0);
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component,
remark, is_deleted)
VALUES (2020763647899787269, 2020763647899787265, 'userNotice_view', '查看', 'view', '/common/commonUserNotice/view',
'file-text', 4, 2, 2, 1, null, null, 0);
--- 后台系统参数-字典 通知类型 0-全局通知 1-APP系统通知 2-Market系统通知 3-APP用户通知 4-Market用户通知
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
VALUES (2020766458167353346, 0, 'notice_type', '-1', '通知类型', 28, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
VALUES (2020766503033823233, 2020766458167353346, 'notice_type', '0', '全局通知', 0, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
VALUES (2020766543760515074, 2020766458167353346, 'notice_type', '1', 'APP系统通知', 1, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
VALUES (2020766604569534466, 2020766458167353346, 'notice_type', '2', 'Market系统通知', 2, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
VALUES (2020766604569534467, 2020766458167353346, 'notice_type', '3', 'APP用户通知', 2, '', 0, 1, 0);
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
VALUES (2020766604569534468, 2020766458167353346, 'notice_type', '3', 'Market用户通知', 2, '', 0, 1, 0);
--- 福利积分 benefit_point
DROP TABLE IF EXISTS benefit_point;
create table benefit_point
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
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
);
comment on table benefit_point is '用户福利值表';
comment on column benefit_point.id is '主键(用户id)';
comment on column benefit_point.amount is '金额';
comment on column benefit_point.version is '版本号';
comment on column benefit_point.create_user is '创建人';
comment on column benefit_point.create_dept is '创建部门';
comment on column benefit_point.create_time is '创建时间';
comment on column benefit_point.update_user is '修改人';
comment on column benefit_point.update_time is '修改时间';
comment on column benefit_point.status is '状态';
comment on column benefit_point.is_deleted is '是否已删除';
alter table benefit_point
owner to yicha1lu;
DROP TABLE IF EXISTS benefit_point_log;
create table benefit_point_log
(
id int8 not null primary key,
user_id int8,
amount decimal(14, 2) default 0,
last_amount decimal(14, 2) default 0, -- 上一笔金额
fee decimal(14, 2) default 0,
source_type varchar(256), -- 来源类型 0-福利包产出 1-福利包兑换 2-用户直推 3-otc交易
source_id int8,
source_detail text,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
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_umbl_uid
on benefit_point_log (is_complete, user_id, type, statistical_date, create_time DESC);
comment on table benefit_point_log is '用户福利值流水表';
comment on column benefit_point_log.id is '主键';
comment on column benefit_point_log.user_id is '用户id';
comment on column benefit_point_log.amount is '金额';
comment on column benefit_point_log.last_amount is '上一笔金额';
comment on column benefit_point_log.fee is '手续费';
comment on column benefit_point_log.source_type is '来源类型';
comment on column benefit_point_log.source_id is '来源id';
comment on column benefit_point_log.source_detail is '来源详情';
comment on column benefit_point_log.type is '消费类型 1-收入 2-支出';
comment on column benefit_point_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column benefit_point_log.statistical_date is '统计时间';
comment on column benefit_point_log.remark is '备注';
comment on column benefit_point_log.create_user is '创建人';
comment on column benefit_point_log.create_dept is '创建部门';
comment on column benefit_point_log.create_time is '创建时间';
comment on column benefit_point_log.update_user is '修改人';
comment on column benefit_point_log.update_time is '修改时间';
comment on column benefit_point_log.status is '状态';
comment on column benefit_point_log.is_deleted is '是否已删除';
alter table benefit_point_log
owner to yicha1lu;
--- 现金券 cash_coupon
DROP TABLE IF EXISTS cash_coupon;
create table cash_coupon
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
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
);
comment on table cash_coupon is '用户现金券表';
comment on column cash_coupon.id is '主键(用户id)';
comment on column cash_coupon.amount is '面额';
comment on column cash_coupon.version is '版本号';
comment on column cash_coupon.create_user is '创建人';
comment on column cash_coupon.create_dept is '创建部门';
comment on column cash_coupon.create_time is '创建时间';
comment on column cash_coupon.update_user is '修改人';
comment on column cash_coupon.update_time is '修改时间';
comment on column cash_coupon.status is '状态';
comment on column cash_coupon.is_deleted is '是否已删除';
alter table cash_coupon
owner to yicha1lu;
DROP TABLE IF EXISTS cash_coupon_log;
create table cash_coupon_log
(
id int8 not null primary key,
user_id int8,
amount decimal(14, 2) default 0,
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8,
source_detail text,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
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_umcl_uid
on cash_coupon_log (is_complete, user_id, type, statistical_date, create_time DESC);
comment on table cash_coupon_log is '用户现金券流水表';
comment on column cash_coupon_log.id is '主键';
comment on column cash_coupon_log.user_id is '用户id';
comment on column cash_coupon_log.amount is '金额';
comment on column cash_coupon_log.last_amount is '上一笔金额';
comment on column cash_coupon_log.source_type is '来源类型';
comment on column cash_coupon_log.source_id is '来源id';
comment on column cash_coupon_log.source_detail is '来源详情';
comment on column cash_coupon_log.type is '消费类型 1-收入 2-支出';
comment on column cash_coupon_log.statistical_date is '统计时间';
comment on column cash_coupon_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column cash_coupon_log.remark is '备注';
comment on column cash_coupon_log.create_user is '创建人';
comment on column cash_coupon_log.create_dept is '创建部门';
comment on column cash_coupon_log.create_time is '创建时间';
comment on column cash_coupon_log.update_user is '修改人';
comment on column cash_coupon_log.update_time is '修改时间';
comment on column cash_coupon_log.status is '状态';
comment on column cash_coupon_log.is_deleted is '是否已删除';
alter table cash_coupon_log
owner to yicha1lu;
--- 用户积分 user_point
DROP TABLE IF EXISTS user_point;
create table user_point
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
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
);
comment on table user_point is '用户商城积分表';
comment on column user_point.id is '主键(用户id)';
comment on column user_point.amount is '面额';
comment on column user_point.version is '版本号';
comment on column user_point.create_user is '创建人';
comment on column user_point.create_dept is '创建部门';
comment on column user_point.create_time is '创建时间';
comment on column user_point.update_user is '修改人';
comment on column user_point.update_time is '修改时间';
comment on column user_point.is_deleted is '是否已删除';
alter table user_point
owner to yicha1lu;
DROP TABLE IF EXISTS user_point_log;
create table user_point_log
(
id int8 not null primary key,
user_id int8,
amount decimal(14, 2) default 0,
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8,
source_detail text,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
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_uapl_uid
on user_point_log (is_complete, user_id, type, statistical_date, create_time DESC);
comment on table user_point_log is '用户商城积分流水表';
comment on column user_point_log.id is '主键';
comment on column user_point_log.user_id is '用户id';
comment on column user_point_log.amount is '金额';
comment on column user_point_log.last_amount is '上一笔金额';
comment on column user_point_log.source_type is '来源类型';
comment on column user_point_log.source_id is '来源id';
comment on column user_point_log.source_detail is '来源详情';
comment on column user_point_log.type is '消费类型 1-收入 2-支出';
comment on column user_point_log.statistical_date is '统计时间';
comment on column user_point_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column user_point_log.remark is '备注';
comment on column user_point_log.create_user is '创建人';
comment on column user_point_log.create_dept is '创建部门';
comment on column user_point_log.create_time is '创建时间';
comment on column user_point_log.update_user is '修改人';
comment on column user_point_log.update_time is '修改时间';
comment on column user_point_log.status is '状态';
comment on column user_point_log.is_deleted is '是否已删除';
alter table user_point_log
owner to yicha1lu;
DROP TABLE IF EXISTS user_commission;
create table user_commission
(
id int8 not null primary key,
amount decimal(14, 2) default 0,
version int4 default 1,
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
);
comment on table user_commission is '用户佣金表';
comment on column user_commission.id is '主键';
comment on column user_commission.amount is '佣金金额';
comment on column user_commission.version is '版本号';
comment on column user_commission.create_user is '创建人';
comment on column user_commission.create_dept is '创建部门';
comment on column user_commission.create_time is '创建时间';
comment on column user_commission.update_user is '修改人';
comment on column user_commission.update_time is '修改时间';
comment on column user_commission.status is '状态';
comment on column user_commission.is_deleted is '是否已删除';
alter table user_commission
owner to yicha1lu;
DROP TABLE IF EXISTS user_commission_log;
create table user_commission_log
(
id int8 not null primary key,
user_id int8,
amount decimal(14, 2) default 0,
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8,
source_detail text,
type int4 default 1,
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6),
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
);
comment on table user_commission_log is '用户佣金流水表';
comment on column user_commission_log.id is '主键';
comment on column user_commission_log.user_id is '用户id';
comment on column user_commission_log.amount is '金额';
comment on column user_commission_log.last_amount is '上一笔金额';
comment on column user_commission_log.source_type is '来源类型';
comment on column user_commission_log.source_id is '来源id';
comment on column user_commission_log.source_detail is '来源详情';
comment on column user_commission_log.type is '消费类型 1-收入 2-支出';
comment on column user_commission_log.statistical_date is '统计时间';
comment on column user_commission_log.is_complete is '是否完成 0-未完成 1-已完成';
comment on column user_commission_log.remark is '备注';
comment on column user_commission_log.create_user is '创建人';
comment on column user_commission_log.create_dept is '创建部门';
comment on column user_commission_log.create_time is '创建时间';
comment on column user_commission_log.update_user is '修改人';
comment on column user_commission_log.update_time is '修改时间';
comment on column user_commission_log.status is '状态';
comment on column user_commission_log.is_deleted is '是否已删除';
create index idx_ucl_uid
on user_commission_log (is_complete, user_id, type, statistical_date, create_time DESC);
alter table user_commission_log
owner to yicha1lu;
-- 佣金账户表
DROP TABLE IF EXISTS market_commission_account;
create table market_commission_account
(
id int8 not null primary key,
account_name varchar(128), -- 账户名称
account_code varchar(64), -- 账户代码
account_type int4, -- 账户类型 0-商品成本 1-购买人获取用户积分 2-直推人佣金 3-运营佣金 4-广告补贴 5-服务商佣金 6-极差代理佣金 7-联创佣金
amount decimal(14, 2) default 0, -- 账户总余额
version int4 default 1,
remark varchar(200),
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_mca_code
on market_commission_account (account_code);
create index idx_mca_type
on market_commission_account (account_type);
comment on table market_commission_account is '用户佣金账户表';
comment on column market_commission_account.id is '主键';
comment on column market_commission_account.account_name is '账户名称';
comment on column market_commission_account.account_code is '账户代码';
comment on column market_commission_account.account_type is '账户类型 0-商品成本 1-购买人获取用户积分 2-直推人佣金 3-运营佣金 4-广告补贴 5-服务商佣金 6-极差代理佣金 7-联创佣金';
comment on column market_commission_account.amount is '账户总余额';
comment on column market_commission_account.version is '版本号';
comment on column market_commission_account.remark is '备注';
comment on column market_commission_account.create_user is '创建人';
comment on column market_commission_account.create_dept is '创建部门';
comment on column market_commission_account.create_time is '创建时间';
comment on column market_commission_account.update_user is '修改人';
comment on column market_commission_account.update_time is '修改时间';
comment on column market_commission_account.status is '状态';
comment on column market_commission_account.is_deleted is '是否已删除';
alter table market_commission_account
owner to yicha1lu;
---------------------------------------insert start
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017485441885196290, '商品成本账户', 'COMMISSION_GOODS_COST', '0', '0.0000', 1, '商品成本账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:29:47', 1123598821738675201, '2026-01-31 14:30:16.04',
1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017485893100032002, '分发商城积分账户', 'COMMISSION_USER_POINT_LOG', '1', '0.0000', 1, '分发商城积分账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:31:34.663', 1123598821738675201,
'2026-01-31 14:31:34.663', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486037128237058, '分发直推人佣金账户', 'COMMISSION_DIRECT_PUSH', '2', '0.0000', 1, '分发直推人佣金账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:32:08.998', 1123598821738675201,
'2026-01-31 14:32:08.998', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486179294171138, '运营账户', 'COMMISSION_OPERATION', '3', '0.0000', 1, '运营账户', 1123598821738675201,
1123598813738675201, '2026-01-31 14:32:42.889', 1123598821738675201, '2026-01-31 14:32:42.889', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486299502923778, '分发广告补贴账户', 'COMMISSION_ADVERTISING', '4', '0.0000', 1, '分发广告补贴账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:33:11.552', 1123598821738675201,
'2026-01-31 14:33:11.552', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486437340336130, '分发服务商佣金账户', 'COMMISSION_SERVICE_PROVIDER', '5', '0.0000', 1,
'分发服务商佣金账户', 1123598821738675201, 1123598813738675201, '2026-01-31 14:33:44.407', 1123598821738675201,
'2026-01-31 14:33:44.407', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486568441696258, '分发极差代理佣金账户', 'COMMISSION_AGENCY', '6', '0.0000', 1, '分发极差代理佣金账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:34:15.663', 1123598821738675201,
'2026-01-31 14:34:15.663', 1, 0);
INSERT INTO market_commission_account ("id", "account_name", "account_code", "account_type", "amount", "version",
"remark", "create_user", "create_dept", "create_time", "update_user",
"update_time", "status", "is_deleted")
VALUES (2017486664117964802, '联创佣金账户', 'COMMISSION_CO_CREATOR', '7', '0.0000', 1, '联创佣金账户',
1123598821738675201, 1123598813738675201, '2026-01-31 14:34:38.479', 1123598821738675201,
'2026-01-31 14:34:38.479', 1, 0);
---------------------------------------insert end
-- 25%商品成本佣金流水表
DROP TABLE IF EXISTS market_commission_goods_cost_log;
create table market_commission_goods_cost_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
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 inx_mcgcl_uid
on market_commission_goods_cost_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index inx_mcgcl_aid
on market_commission_goods_cost_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_goods_cost_log is '25%商品成本佣金流水表';
comment on column market_commission_goods_cost_log.id is '主键';
comment on column market_commission_goods_cost_log.account_id is '账户id';
comment on column market_commission_goods_cost_log.user_id is '用户id';
comment on column market_commission_goods_cost_log.amount is '金额';
comment on column market_commission_goods_cost_log.last_amount is '上笔金额';
comment on column market_commission_goods_cost_log.source_type is '来源类型';
comment on column market_commission_goods_cost_log.source_id is '来源id';
comment on column market_commission_goods_cost_log.source_detail is '来源详情';
comment on column market_commission_goods_cost_log.type is '类型 1-收入 2-支出';
comment on column market_commission_goods_cost_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_goods_cost_log.statistical_date is '统计时间';
comment on column market_commission_goods_cost_log.remark is '备注';
comment on column market_commission_goods_cost_log.create_user is '创建人';
comment on column market_commission_goods_cost_log.create_dept is '创建部门';
comment on column market_commission_goods_cost_log.create_time is '创建时间';
comment on column market_commission_goods_cost_log.update_user is '修改人';
comment on column market_commission_goods_cost_log.update_time is '修改时间';
comment on column market_commission_goods_cost_log.status is '状态';
comment on column market_commission_goods_cost_log.is_deleted is '是否已删除';
alter table market_commission_goods_cost_log
owner to yicha1lu;
-- 30%购买人获取用户积分佣金流水表
DROP TABLE IF EXISTS market_commission_user_point_log;
create table market_commission_user_point_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
is_salary_paid int4 default 0, -- 金额是否发放到用户 0-否 1-是
statistical_date timestamp(6), -- 统计时间
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_mcupl_uid
on market_commission_user_point_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcupl_aid
on market_commission_user_point_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_user_point_log is '30%购买人获取用户积分佣金流水表';
comment on column market_commission_user_point_log.id is '主键';
comment on column market_commission_user_point_log.account_id is '账户id';
comment on column market_commission_user_point_log.user_id is '用户id';
comment on column market_commission_user_point_log.amount is '变动金额';
comment on column market_commission_user_point_log.last_amount is '上笔金额';
comment on column market_commission_user_point_log.source_type is '来源类型';
comment on column market_commission_user_point_log.source_id is '来源id';
comment on column market_commission_user_point_log.source_detail is '来源详情';
comment on column market_commission_user_point_log.type is '类型 1-收入 2-支出';
comment on column market_commission_user_point_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_user_point_log.is_salary_paid is '金额是否发放到用户 0-否 1-是';
comment on column market_commission_user_point_log.statistical_date is '统计时间';
comment on column market_commission_user_point_log.remark is '备注';
comment on column market_commission_user_point_log.create_user is '创建人';
comment on column market_commission_user_point_log.create_dept is '创建部门';
comment on column market_commission_user_point_log.create_time is '创建时间';
comment on column market_commission_user_point_log.update_user is '修改人';
comment on column market_commission_user_point_log.update_time is '修改时间';
comment on column market_commission_user_point_log.status is '状态';
comment on column market_commission_user_point_log.is_deleted is '是否已删除';
alter table market_commission_user_point_log
owner to yicha1lu;
-- 10%直推人佣金流水表
DROP TABLE IF EXISTS market_commission_direct_push_log;
create table market_commission_direct_push_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
is_salary_paid int4 default 0, -- 金额是否发放到用户 0-否 1-是
statistical_date timestamp(6), -- 统计时间
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_mcdpl_uid
on market_commission_direct_push_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcdpl_aid
on market_commission_direct_push_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_direct_push_log is '10%直推人佣金流水表';
comment on column market_commission_direct_push_log.id is '主键';
comment on column market_commission_direct_push_log.account_id is '账户id';
comment on column market_commission_direct_push_log.user_id is '用户id';
comment on column market_commission_direct_push_log.amount is '变动金额';
comment on column market_commission_direct_push_log.last_amount is '上笔金额';
comment on column market_commission_direct_push_log.source_type is '来源类型';
comment on column market_commission_direct_push_log.source_id is '来源id';
comment on column market_commission_direct_push_log.source_detail is '来源详情';
comment on column market_commission_direct_push_log.type is '类型 1-收入 2-支出';
comment on column market_commission_direct_push_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_direct_push_log.is_salary_paid is '金额是否发放到用户 0-否 1-是';
comment on column market_commission_direct_push_log.statistical_date is '统计时间';
comment on column market_commission_direct_push_log.remark is '备注';
comment on column market_commission_direct_push_log.create_user is '创建人';
comment on column market_commission_direct_push_log.create_dept is '创建部门';
comment on column market_commission_direct_push_log.create_time is '创建时间';
comment on column market_commission_direct_push_log.update_user is '修改人';
comment on column market_commission_direct_push_log.update_time is '修改时间';
comment on column market_commission_direct_push_log.status is '状态';
comment on column market_commission_direct_push_log.is_deleted is '是否已删除';
alter table market_commission_direct_push_log
owner to yicha1lu;
-- 5%运营佣金流水表
DROP TABLE IF EXISTS market_commission_operation_log;
create table market_commission_operation_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
cut_amount decimal(14, 2) default 0, -- 随机立减金额
cut_detail text, -- 随机立减说明
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
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_mcol_aid
on market_commission_operation_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_operation_log is '5%运营佣金流水表';
comment on column market_commission_operation_log.id is '主键';
comment on column market_commission_operation_log.account_id is '账户id';
comment on column market_commission_operation_log.amount is '变动金额';
comment on column market_commission_operation_log.last_amount is '上笔金额';
comment on column market_commission_operation_log.cut_amount is '随机立减金额';
comment on column market_commission_operation_log.cut_detail is '随机立减说明';
comment on column market_commission_operation_log.source_type is '来源类型';
comment on column market_commission_operation_log.source_id is '来源id';
comment on column market_commission_operation_log.source_detail is '来源详情';
comment on column market_commission_operation_log.type is '类型 1-收入 2-支出';
comment on column market_commission_operation_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_operation_log.statistical_date is '统计时间';
comment on column market_commission_operation_log.remark is '备注';
comment on column market_commission_operation_log.create_user is '创建人';
comment on column market_commission_operation_log.create_dept is '创建部门';
comment on column market_commission_operation_log.create_time is '创建时间';
comment on column market_commission_operation_log.update_user is '修改人';
comment on column market_commission_operation_log.update_time is '修改时间';
comment on column market_commission_operation_log.status is '状态';
comment on column market_commission_operation_log.is_deleted is '是否已删除';
alter table market_commission_operation_log
owner to yicha1lu;
-- 5%广告补贴佣金流水表
DROP TABLE IF EXISTS market_commission_advertising_log;
create table market_commission_advertising_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
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_mcal_aid
on market_commission_advertising_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_advertising_log is '5%广告补贴佣金流水表';
comment on column market_commission_advertising_log.id is '主键';
comment on column market_commission_advertising_log.account_id is '账户id';
comment on column market_commission_advertising_log.amount is '变动金额';
comment on column market_commission_advertising_log.last_amount is '上笔金额';
comment on column market_commission_advertising_log.source_type is '来源类型 0-商城订单 1-发放广告佣金';
comment on column market_commission_advertising_log.source_id is '来源id';
comment on column market_commission_advertising_log.source_detail is '来源详情';
comment on column market_commission_advertising_log.type is '类型 1-收入 2-支出';
comment on column market_commission_advertising_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_advertising_log.statistical_date is '统计时间';
comment on column market_commission_advertising_log.remark is '备注';
comment on column market_commission_advertising_log.create_user is '创建人';
comment on column market_commission_advertising_log.create_dept is '创建部门';
comment on column market_commission_advertising_log.create_time is '创建时间';
comment on column market_commission_advertising_log.update_user is '修改人';
comment on column market_commission_advertising_log.update_time is '修改时间';
comment on column market_commission_advertising_log.status is '状态';
comment on column market_commission_advertising_log.is_deleted is '是否已删除';
alter table market_commission_advertising_log
owner to yicha1lu;
-- 5%服务商佣金流水表
DROP TABLE IF EXISTS market_commission_service_provider_log;
create table market_commission_service_provider_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
is_salary_paid int4 default 0, -- 金额是否发放到用户 0-否 1-是
statistical_date timestamp(6), -- 统计时间
address_id int8, -- 收货地址id
region_id int4, -- 区域id
service_provider_id int8, -- 服务商id
service_type int4, -- 服务类型
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_mcspl_uid
on market_commission_service_provider_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mcspl_aid
on market_commission_service_provider_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_service_provider_log is '5%服务商佣金流水表';
comment on column market_commission_service_provider_log.id is '主键';
comment on column market_commission_service_provider_log.account_id is '账户id';
comment on column market_commission_service_provider_log.user_id is '用户id';
comment on column market_commission_service_provider_log.amount is '变动金额';
comment on column market_commission_service_provider_log.last_amount is '上笔金额';
comment on column market_commission_service_provider_log.source_type is '来源类型';
comment on column market_commission_service_provider_log.source_id is '来源id';
comment on column market_commission_service_provider_log.source_detail is '来源详情';
comment on column market_commission_service_provider_log.type is '类型 1-收入 2-支出';
comment on column market_commission_service_provider_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_service_provider_log.is_salary_paid is '金额是否发放到用户 0-否 1-是';
comment on column market_commission_service_provider_log.statistical_date is '统计时间';
comment on column market_commission_service_provider_log.address_id is '收货地址id';
comment on column market_commission_service_provider_log.region_id is '省市区id';
comment on column market_commission_service_provider_log.service_type is '服务类型';
comment on column market_commission_service_provider_log.service_provider_id is '服务商ID';
comment on column market_commission_service_provider_log.remark is '备注';
comment on column market_commission_service_provider_log.create_user is '创建人';
comment on column market_commission_service_provider_log.create_dept is '创建部门';
comment on column market_commission_service_provider_log.create_time is '创建时间';
comment on column market_commission_service_provider_log.update_user is '修改人';
comment on column market_commission_service_provider_log.update_time is '修改时间';
comment on column market_commission_service_provider_log.status is '状态';
comment on column market_commission_service_provider_log.is_deleted is '是否已删除';
alter table market_commission_service_provider_log
owner to yicha1lu;
-- 15%极差代理佣金流水表
DROP TABLE IF EXISTS market_commission_agency_log;
create table market_commission_agency_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
user_id int8, -- 用户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
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_mc_agency_uid
on market_commission_agency_log (is_complete, user_id, type, statistical_date, create_time DESC);
create index idx_mc_agency_aid
on market_commission_agency_log (is_complete, account_id, type, statistical_date, create_time DESC);
comment on table market_commission_agency_log is '15%极差代理佣金流水表';
comment on column market_commission_agency_log.id is '主键';
comment on column market_commission_agency_log.id is '主键';
comment on column market_commission_agency_log.account_id is '账户id';
comment on column market_commission_agency_log.user_id is '用户id';
comment on column market_commission_agency_log.amount is '变动金额';
comment on column market_commission_agency_log.last_amount is '上笔金额';
comment on column market_commission_agency_log.source_type is '来源类型';
comment on column market_commission_agency_log.source_id is '来源id';
comment on column market_commission_agency_log.source_detail is '来源详情';
comment on column market_commission_agency_log.type is '类型 1-收入 2-支出';
comment on column market_commission_agency_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_agency_log.statistical_date is '统计时间';
comment on column market_commission_agency_log.remark is '备注';
comment on column market_commission_agency_log.create_user is '创建人';
comment on column market_commission_agency_log.create_dept is '创建部门';
comment on column market_commission_agency_log.create_time is '创建时间';
comment on column market_commission_agency_log.update_user is '修改人';
comment on column market_commission_agency_log.update_time is '修改时间';
comment on column market_commission_agency_log.status is '状态';
comment on column market_commission_agency_log.is_deleted is '是否已删除';
alter table market_commission_agency_log
owner to yicha1lu;
-- 5%联创佣金流水表
DROP TABLE IF EXISTS market_commission_co_creator_log;
create table market_commission_co_creator_log
(
id int8 not null primary key,
account_id int8, -- 佣金账户id
amount decimal(14, 2) default 0, -- 变动金额
last_amount decimal(14, 2) default 0, -- 上一笔金额
source_type varchar(256), -- 来源类型
source_id int8, -- 来源id
source_detail text, -- 来源详情
type int4 default 1, -- 类型 1-收入 2-支出
is_complete int4 default 0, -- 0-未完成 1-已完成
statistical_date timestamp(6), -- 统计时间
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_mcccl_aid
on market_commission_co_creator_log (is_complete, account_id, statistical_date, type, create_time DESC);
comment on table market_commission_co_creator_log is '5%联创佣金流水表';
comment on column market_commission_co_creator_log.id is '主键';
comment on column market_commission_co_creator_log.account_id is '账户id';
comment on column market_commission_co_creator_log.amount is '变动金额';
comment on column market_commission_co_creator_log.last_amount is '上笔金额';
comment on column market_commission_co_creator_log.source_type is '来源类型';
comment on column market_commission_co_creator_log.source_id is '来源id';
comment on column market_commission_co_creator_log.source_detail is '来源详情';
comment on column market_commission_co_creator_log.type is '类型 1-收入 2-支出';
comment on column market_commission_co_creator_log.is_complete is '0-未完成 1-已完成';
comment on column market_commission_co_creator_log.statistical_date is '统计时间';
comment on column market_commission_co_creator_log.remark is '备注';
comment on column market_commission_co_creator_log.create_user is '创建人';
comment on column market_commission_co_creator_log.create_dept is '创建部门';
comment on column market_commission_co_creator_log.create_time is '创建时间';
comment on column market_commission_co_creator_log.update_user is '修改人';
comment on column market_commission_co_creator_log.update_time is '修改时间';
comment on column market_commission_co_creator_log.status is '状态';
comment on column market_commission_co_creator_log.is_deleted is '是否已删除';
alter table market_commission_co_creator_log
owner to yicha1lu;
DROP TABLE IF EXISTS user_market_package_daily_settlement;
create table user_market_package_daily_settlement --用户福利包每天结算记录
(
id int8 not null primary key,
statistical_date timestamp(6),
user_id int8,
account int8,
user_name varchar(128),
package_id bigint[], --用户兑换福利包id(数组), 记录已发的id
is_complete integer default 0, -- 是否完成 0未完成 1完成
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 inx_umpds_uid
on user_market_package_daily_settlement (statistical_date, is_complete, user_id);
COMMENT ON TABLE user_market_package_daily_settlement IS '用户福利包每天结算记录';
COMMENT ON COLUMN user_market_package_daily_settlement.id IS '主键';
COMMENT ON COLUMN user_market_package_daily_settlement.user_id IS '用户id';
COMMENT ON COLUMN user_market_package_daily_settlement.account IS '账户';
COMMENT ON COLUMN user_market_package_daily_settlement.user_name IS '用户名';
COMMENT ON COLUMN user_market_package_daily_settlement.package_id IS '用户兑换福利包id(数组), 记录已发的id';
COMMENT ON COLUMN user_market_package_daily_settlement.is_complete IS '是否完成 0-未完成 1-完成';
COMMENT ON COLUMN user_market_package_daily_settlement.remark IS '备注';
comment on column user_market_package_daily_settlement.create_user is '创建人';
comment on column user_market_package_daily_settlement.create_dept is '创建部门';
comment on column user_market_package_daily_settlement.create_time is '创建时间';
comment on column user_market_package_daily_settlement.update_user is '修改人';
comment on column user_market_package_daily_settlement.update_time is '修改时间';
comment on column user_market_package_daily_settlement.status is '状态';
comment on column user_market_package_daily_settlement.is_deleted is '是否已删除';
alter table user_market_package_daily_settlement
owner to yicha1lu;
DROP TABLE IF EXISTS common_lottery_prize;
create table common_lottery_prize
(
id int8 not null primary key,
prize_name varchar(100),--奖品名称
prize_type int4, -- 类型:1=积分 2=优惠券 3=实物...
prize_value VARCHAR(255), -- 奖品内容(如积分数量、券码等)
probability DECIMAL(5, 4), -- 中奖概率(如 0.05 = 5%)
stock int4, -- 总库存(-1 表示无限)
daily_limit int4, -- 每日发放上限
sort_order int4, -- 排序(用于前端展示顺序)
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 1, -- 状态:0=下架 1=上架,
is_deleted int4 default 0
);
COMMENT ON TABLE common_lottery_prize IS '奖品配置表';
COMMENT ON COLUMN common_lottery_prize.id IS '主键';
COMMENT ON COLUMN common_lottery_prize.prize_name IS '奖品名称';
COMMENT ON COLUMN common_lottery_prize.prize_type IS '奖品类型';
COMMENT ON COLUMN common_lottery_prize.prize_value IS '奖品内容';
COMMENT ON COLUMN common_lottery_prize.probability IS '中奖概率(如 0.05 = 5%)';
COMMENT ON COLUMN common_lottery_prize.stock IS '总库存(-1 表示无限)';
COMMENT ON COLUMN common_lottery_prize.daily_limit IS '每日发放上限';
COMMENT ON COLUMN common_lottery_prize.sort_order IS '排序(用于前端展示顺序)';
COMMENT ON COLUMN common_lottery_prize.remark IS '备注';
comment on column common_lottery_prize.create_user is '创建人';
comment on column common_lottery_prize.create_dept is '创建部门';
comment on column common_lottery_prize.create_time is '创建时间';
comment on column common_lottery_prize.update_user is '修改人';
comment on column common_lottery_prize.update_time is '修改时间';
comment on column common_lottery_prize.status is '状态:0=下架 1=上架';
comment on column common_lottery_prize.is_deleted is '是否已删除';
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022583456075808770', '1123598815738675201', 'lotteryPrize', '奖品配置表', 'menu', '/common/lotteryPrize', 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 ('2022583456075808771', '2022583456075808770', 'lotteryPrize_add', '新增', 'add', '/common/lotteryPrize/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 ('2022583456075808772', '2022583456075808770', 'lotteryPrize_edit', '修改', 'edit', '/common/lotteryPrize/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 ('2022583456075808773', '2022583456075808770', 'lotteryPrize_delete', '删除', 'delete', '/api/blade-lotteryprize/lotteryPrize/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 ('2022583456075808774', '2022583456075808770', 'lotteryPrize_view', '查看', 'view', '/common/lotteryPrize/view', 'file-text', 4, 2, 2, 1, NULL, 0);
DROP TABLE IF EXISTS common_lottery_record;
create table common_lottery_record
(
id int8 not null primary key,
user_id int8, -- 用户id
prize_id int8, -- 中奖奖品ID(null 表示未中奖/谢谢参与)
points_used decimal(14, 2) default 0, -- 消耗积分
remark text, -- 备注
create_user int8,
create_dept int8,
create_time timestamp(6),
update_user int8,
update_time timestamp(6),
status int4 default 0, --0=未发放 1=已发放 2=发放失败
is_deleted int4 default 0
);
COMMENT ON TABLE common_lottery_record IS '抽奖记录表';
COMMENT ON COLUMN common_lottery_record.id IS '主键';
COMMENT ON COLUMN common_lottery_record.user_id IS '用户id';
COMMENT ON COLUMN common_lottery_record.prize_id IS '中奖奖品ID(null 表示未中奖/谢谢参与)';
COMMENT ON COLUMN common_lottery_record.points_used IS '消耗积分';
COMMENT ON COLUMN common_lottery_record.remark IS '备注';
comment on column common_lottery_record.create_user is '创建人';
comment on column common_lottery_record.create_dept is '创建部门';
comment on column common_lottery_record.create_time is '创建时间';
comment on column common_lottery_record.update_user is '修改人';
comment on column common_lottery_record.update_time is '修改时间';
comment on column common_lottery_record.status is '0=未发放 1=已发放 2=发放失败';
comment on column common_lottery_record.is_deleted is '是否已删除';
create index idx_clr_uc on common_lottery_record (user_id, is_deleted, create_time desc);
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
VALUES ('2022588119768522753', '1123598815738675201', 'lotteryRecord', '抽奖记录表', 'menu', '/common/lotteryRecord', 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 ('2022588119768522754', '2022588119768522753', 'lotteryRecord_add', '新增', 'add', '/common/lotteryRecord/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 ('2022588119768522755', '2022588119768522753', 'lotteryRecord_edit', '修改', 'edit', '/common/lotteryRecord/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 ('2022588119768522756', '2022588119768522753', 'lotteryRecord_delete', '删除', 'delete', '/api/blade-lotteryprize/lotteryRecord/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 ('2022588119768522757', '2022588119768522753', 'lotteryRecord_view', '查看', 'view', '/common/lotteryRecord/view', 'file-text', 4, 2, 2, 1, NULL, 0);