1072 lines
54 KiB
SQL
1072 lines
54 KiB
SQL
create table user_genealogy
|
|
(
|
|
id int8 not null primary key,
|
|
name varchar(128),
|
|
phone int8,
|
|
level integer default 1, --当前层数
|
|
pid int8,
|
|
p_name varchar(128),
|
|
p_phone int8,
|
|
root_id int8, --遍历当前树
|
|
group_id int8, --树内最近团队长的id
|
|
genealogy_list int8[], -- 往上所有父级
|
|
user_child_number int, --用户下线总人数
|
|
user_direct_number int, --用户直推总人数
|
|
user_direct_list int8[], --直推列表
|
|
is_revoked integer default 0, --是否注销 0-否 1-是
|
|
register_date date, -- 注册时间
|
|
remark text,
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
CREATE INDEX user_genealogy_list_gin_idx
|
|
ON user_genealogy USING gin (genealogy_list);
|
|
CREATE INDEX user_direct_list_gin_idx
|
|
ON user_genealogy USING gin (user_direct_list);
|
|
|
|
create index user_genealogy_phone_index
|
|
on user_genealogy (is_deleted, phone , is_revoked);
|
|
|
|
create index user_genealogy_register_date_index
|
|
on user_genealogy (is_deleted, register_date);
|
|
|
|
comment on table user_genealogy is '用户族谱表';
|
|
comment on column user_genealogy.id is '主键';
|
|
comment on column user_genealogy.pid is '上级id';
|
|
comment on column user_genealogy.name is '用户名';
|
|
comment on column user_genealogy.phone is '手机号';
|
|
comment on column user_genealogy.p_name is '上级用户名';
|
|
comment on column user_genealogy.p_phone is '上级用户手机号';
|
|
comment on column user_genealogy.level is '层级';
|
|
comment on column user_genealogy.root_id is '根节点id';
|
|
comment on column user_genealogy.group_id is '团队长id';
|
|
comment on column user_genealogy.genealogy_list is '族谱列表';
|
|
comment on column user_genealogy.user_child_number is '用户下线总人数';
|
|
comment on column user_genealogy.user_direct_number is '用户直推总人数';
|
|
comment on column user_genealogy.user_direct_list is '直推列表';
|
|
comment on column user_genealogy.is_revoked is '是否注销 0-否 1-是';
|
|
comment on column user_genealogy.register_date is '注册时间';
|
|
comment on column user_genealogy.create_user is '创建人';
|
|
comment on column user_genealogy.create_dept is '创建部门';
|
|
comment on column user_genealogy.create_time is '创建时间';
|
|
comment on column user_genealogy.update_user is '修改人';
|
|
comment on column user_genealogy.update_time is '修改时间';
|
|
comment on column user_genealogy.status is '状态';
|
|
comment on column user_genealogy.is_deleted is '是否已删除';
|
|
alter table user_genealogy
|
|
owner to postgres;
|
|
|
|
|
|
|
|
create table user_tree
|
|
(
|
|
id int8 not null primary key,
|
|
name varchar(128),
|
|
phone int8,
|
|
level integer default 1,
|
|
pid int8,
|
|
p_name varchar(128),
|
|
p_phone int8,
|
|
p_level integer default 1,
|
|
is_revoked integer default 0, --是否撤销 0-否 1-是
|
|
is_sync_genealogy integer default 0, --是否同步族谱 0-否 1-是
|
|
register_date date, -- 注册时间
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
|
|
create index user_tree_phone_index
|
|
on user_tree (is_deleted, phone);
|
|
|
|
create index user_tree_sync_genealogy_index
|
|
on user_tree (is_deleted, is_sync_genealogy);
|
|
|
|
create index user_tree_register_date_index
|
|
on user_tree (is_deleted, register_date);
|
|
|
|
|
|
comment on table user_tree is '用户树结构表';
|
|
comment on column user_tree.id is '主键';
|
|
comment on column user_tree.pid is '上级id';
|
|
comment on column user_tree.name is '用户名';
|
|
comment on column user_tree.phone is '手机号';
|
|
comment on column user_tree.level is '层级';
|
|
comment on column user_tree.p_name is '上级用户名';
|
|
comment on column user_tree.p_phone is '上级用户手机号';
|
|
comment on column user_tree.p_level is '上级用户层级';
|
|
comment on column user_tree.is_revoked is '是否注销 0-否 1-是';
|
|
comment on column user_tree.is_sync_genealogy is '是否同步族谱 0-否 1-是';
|
|
comment on column user_tree.register_date is '注册时间';
|
|
comment on column user_tree.create_user is '创建人';
|
|
comment on column user_tree.create_dept is '创建部门';
|
|
comment on column user_tree.create_time is '创建时间';
|
|
comment on column user_tree.update_user is '修改人';
|
|
comment on column user_tree.update_time is '修改时间';
|
|
comment on column user_tree.status is '状态';
|
|
comment on column user_tree.is_deleted is '是否已删除';
|
|
alter table user_tree
|
|
owner to postgres;
|
|
|
|
create table user_increase_day
|
|
(
|
|
id int8 not null primary key,
|
|
name varchar(128),
|
|
phone int8,
|
|
current_level_id int, --用户当前等级
|
|
current_level_name varchar(12), --用户当前等级
|
|
pid int8,
|
|
p_name varchar(128),
|
|
p_phone int8,
|
|
p_level integer default 1,
|
|
is_real integer default 0, -- 是否实名用户 0-否 1-是
|
|
real_date timestamp(6), -- 实名时间
|
|
real_name varchar(128), -- 实名姓名
|
|
real_id_card varchar(128), -- 实名身份证
|
|
is_revoked integer default 0, --是否撤销 0-否 1-是
|
|
register_date date, -- 注册时间
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
create index user_increase_day_phone_index
|
|
on user_increase_day (is_deleted, phone);
|
|
|
|
create index uid_register_date_index
|
|
on user_increase_day (is_deleted, register_date);
|
|
|
|
comment on table user_increase_day is '用户增加天数表';
|
|
|
|
comment on column user_increase_day.id is '主键';
|
|
comment on column user_increase_day.current_level_id is '用户当前等级';
|
|
comment on column user_increase_day.current_level_name is '用户当前等级';
|
|
comment on column user_increase_day.name is '用户名';
|
|
comment on column user_increase_day.p_name is '上级用户名';
|
|
comment on column user_increase_day.p_phone is '上级用户手机号';
|
|
comment on column user_increase_day.p_level is '上级用户层级';
|
|
comment on column user_increase_day.is_real is '是否实名用户 0-否 1-是';
|
|
comment on column user_increase_day.real_date is '实名时间';
|
|
comment on column user_increase_day.real_name is '实名姓名';
|
|
comment on column user_increase_day.real_id_card is '实名身份证';
|
|
comment on column user_increase_day.register_date is '注册时间';
|
|
comment on column user_increase_day.is_revoked is '是否注销 0-否 1-是';
|
|
comment on column user_increase_day.register_date is '注册时间';
|
|
comment on column user_increase_day.create_user is '创建人';
|
|
comment on column user_increase_day.create_dept is '创建部门';
|
|
comment on column user_increase_day.create_time is '创建时间';
|
|
comment on column user_increase_day.update_user is '修改人';
|
|
comment on column user_increase_day.update_time is '修改时间';
|
|
comment on column user_increase_day.status is '状态';
|
|
comment on column user_increase_day.is_deleted is '是否已删除';
|
|
alter table user_increase_day
|
|
owner to postgres;
|
|
|
|
|
|
|
|
CREATE TABLE level_info
|
|
(
|
|
id int8 NOT NULL PRIMARY KEY,
|
|
name VARCHAR(128) NULL,
|
|
child_qty INTEGER NULL,
|
|
performance DECIMAL(16, 4) NULL,
|
|
performance_benefit DECIMAL(16, 4) NULL,
|
|
next_level_id int8, --晋升等级id
|
|
is_lowest int DEFAULT 0, --是否最低等级
|
|
is_highest int DEFAULT 0, --是否最高等级
|
|
bonus_cash_day DECIMAL(16, 4) NULL,
|
|
bonus_cash_all DECIMAL(16, 4) NULL,
|
|
bonus_benefit DECIMAL(16, 4) NULL,
|
|
version integer DEFAULT 1,
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
COMMENT ON TABLE level_info IS '等级信息表';
|
|
COMMENT ON COLUMN level_info.name IS '等级名称';
|
|
COMMENT ON COLUMN level_info.child_qty IS '直推人数';
|
|
COMMENT ON COLUMN level_info.performance IS '现金总业绩';
|
|
COMMENT ON COLUMN level_info.performance_benefit IS '福利值业绩';
|
|
COMMENT ON COLUMN level_info.next_level_id IS '晋升等级id';
|
|
COMMENT ON COLUMN level_info.is_lowest IS '是否最低等级 0-否 1-是';
|
|
COMMENT ON COLUMN level_info.is_highest IS '是否最高等级 0-否 1-是';
|
|
COMMENT ON COLUMN level_info.bonus_cash_day IS '每日现金积分加速';
|
|
COMMENT ON COLUMN level_info.bonus_cash_all IS '全网现金积分加速';
|
|
COMMENT ON COLUMN level_info.bonus_benefit IS '每日福利积分加速';
|
|
comment on column level_info.create_user is '创建人';
|
|
comment on column level_info.create_dept is '创建部门';
|
|
comment on column level_info.create_time is '创建时间';
|
|
comment on column level_info.update_user is '修改人';
|
|
comment on column level_info.update_time is '修改时间';
|
|
comment on column level_info.status is '状态';
|
|
comment on column level_info.is_deleted is '是否已删除';
|
|
|
|
alter table level_info
|
|
owner to postgres;
|
|
|
|
|
|
create table user_level_log
|
|
(
|
|
id int8 not null primary key,
|
|
statistical_date timestamp(6),
|
|
user_id int8,
|
|
user_phone int8,
|
|
user_name varchar(128),
|
|
level_id int8,
|
|
level_name varchar(128),
|
|
is_lowest int, --是否最低等级
|
|
is_highest int, --是否最高等级
|
|
bonus_cash_day DECIMAL(16, 4) NULL,
|
|
bonus_cash_all DECIMAL(16, 4) NULL,
|
|
bonus_benefit DECIMAL(16, 4) NULL,
|
|
bonus_detail text,
|
|
remark text,
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
create index user_level_log_index
|
|
on user_level_log (is_deleted, statistical_date ,user_id);
|
|
|
|
comment on table user_level_log is '用户等级日志表';
|
|
comment on column user_level_log.id is '主键';
|
|
comment on column user_level_log.user_id is '用户id';
|
|
comment on column user_level_log.user_phone is '用户手机号';
|
|
comment on column user_level_log.user_name is '用户名';
|
|
comment on column user_level_log.level_id is '等级id';
|
|
comment on column user_level_log.level_name is '等级名称';
|
|
comment on column user_level_log.statistical_date is '统计日期';
|
|
comment on column user_level_log.is_lowest IS '是否最低等级 0-否 1-是';
|
|
comment on column user_level_log.is_highest IS '是否最高等级 0-否 1-是';
|
|
comment on column user_level_log.bonus_cash_day is '每日现金积分加速';
|
|
comment on column user_level_log.bonus_cash_all is '全网现金积分加速';
|
|
comment on column user_level_log.bonus_benefit is '每日福利积分加速';
|
|
comment on column user_level_log.bonus_detail is '升级详情';
|
|
comment on column user_level_log.remark is '备注';
|
|
comment on column user_level_log.create_user is '创建人';
|
|
comment on column user_level_log.create_dept is '创建部门';
|
|
comment on column user_level_log.create_time is '创建时间';
|
|
comment on column user_level_log.update_user is '修改人';
|
|
comment on column user_level_log.update_time is '修改时间';
|
|
comment on column user_level_log.status is '状态';
|
|
comment on column user_level_log.is_deleted is '是否已删除';
|
|
|
|
alter table user_level_log
|
|
owner to postgres;
|
|
|
|
|
|
|
|
CREATE TABLE package_info
|
|
(
|
|
id int8 NOT NULL PRIMARY KEY,
|
|
name VARCHAR(128) NULL,
|
|
buy_qty INTEGER default 0, -- 最大购买数量
|
|
day_total integer default 0, -- 产出总天数
|
|
amount_total decimal(14, 2) default 0, -- 总产出福利积分
|
|
give_amount decimal(14, 2) default 0, -- 购买赠与福利值
|
|
bonus decimal(16, 4) default 0, -- 激活比率
|
|
user_benefit decimal(14, 2) default 0, --兑换包需要的福利积分
|
|
user_cash decimal(14, 2) default 0, --兑换包需要的现金券
|
|
is_need_benefit int DEFAULT 0, --是否需要福利积分
|
|
is_need_cash int DEFAULT 0, --是否需要现金券
|
|
max_exchange_qty integer default 0, -- 全网最大兑换数量
|
|
exchanged_qty integer default 0, -- 已兑换数量
|
|
version integer default 1,
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
|
|
);
|
|
|
|
COMMENT ON TABLE package_info IS '积分包信息表';
|
|
COMMENT ON COLUMN package_info.id IS '主键';
|
|
COMMENT ON COLUMN package_info.name IS '积分包名称';
|
|
COMMENT ON COLUMN package_info.buy_qty IS '最大购买数量';
|
|
COMMENT ON COLUMN package_info.day_total IS '产出总天数';
|
|
COMMENT ON COLUMN package_info.amount_total IS '总产出福利积分';
|
|
COMMENT ON COLUMN package_info.give_amount IS '购买赠与福利值';
|
|
COMMENT ON COLUMN package_info.bonus IS '激活比率';
|
|
COMMENT ON COLUMN package_info.user_benefit IS '兑换包需要的福利积分';
|
|
COMMENT ON COLUMN package_info.user_cash IS '兑换包需要的现金券';
|
|
COMMENT ON COLUMN package_info.is_need_benefit IS '是否需要福利积分 0-否 1-是';
|
|
COMMENT ON COLUMN package_info.is_need_cash IS '是否需要现金券 0-否 1-是';
|
|
COMMENT ON COLUMN package_info.max_exchange_qty IS '全网最大兑换数量';
|
|
COMMENT ON COLUMN package_info.exchanged_qty IS '已兑换数量';
|
|
comment on column package_info.create_user is '创建人';
|
|
comment on column package_info.create_dept is '创建部门';
|
|
comment on column package_info.create_time is '创建时间';
|
|
comment on column package_info.update_user is '修改人';
|
|
comment on column package_info.update_time is '修改时间';
|
|
comment on column package_info.status is '状态';
|
|
comment on column package_info.is_deleted is '是否已删除';
|
|
|
|
alter table package_info
|
|
owner to postgres;
|
|
|
|
create table give_pack_log
|
|
(
|
|
id int8 not null primary key,
|
|
statistical_date date,
|
|
user_id int8,
|
|
phone int8,
|
|
user_name varchar(128),
|
|
package_id int8,
|
|
package_name varchar(128),
|
|
package_detail text,
|
|
give_number integer default 1,
|
|
remark text,
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
|
|
create index gpl_date_index
|
|
on give_pack_log (is_deleted, statistical_date ,user_id);
|
|
|
|
|
|
COMMENT ON TABLE give_pack_log IS '划拨积分记录';
|
|
COMMENT ON COLUMN give_pack_log.id IS '主键';
|
|
COMMENT ON COLUMN give_pack_log.statistical_date IS '统计日期';
|
|
COMMENT ON COLUMN give_pack_log.user_id IS '用户id';
|
|
COMMENT ON COLUMN give_pack_log.phone IS '用户手机号';
|
|
COMMENT ON COLUMN give_pack_log.user_name IS '用户名';
|
|
COMMENT ON COLUMN give_pack_log.package_id IS '积分包id';
|
|
COMMENT ON COLUMN give_pack_log.package_name IS '积分包名称';
|
|
COMMENT ON COLUMN give_pack_log.package_detail IS '积分包信息快照';
|
|
COMMENT ON COLUMN give_pack_log.give_number IS '赠送数量';
|
|
COMMENT ON COLUMN give_pack_log.remark IS '备注';
|
|
comment on column give_pack_log.create_user is '创建人';
|
|
comment on column give_pack_log.create_dept is '创建部门';
|
|
comment on column give_pack_log.create_time is '创建时间';
|
|
comment on column give_pack_log.update_user is '修改人';
|
|
comment on column give_pack_log.update_time is '修改时间';
|
|
comment on column give_pack_log.status is '状态';
|
|
comment on column give_pack_log.is_deleted is '是否已删除';
|
|
|
|
alter table give_pack_log
|
|
owner to postgres;
|
|
|
|
create table user_package_info
|
|
(
|
|
id int8 not null primary key,
|
|
statistical_date timestamp(6),
|
|
user_id int8,
|
|
phone int8,
|
|
user_name varchar(128),
|
|
package_id int8,
|
|
package_name varchar(128),
|
|
type integer default 1, -- 1-积分兑换 2-后台划拨
|
|
user_benefit decimal(14, 2) default 0, --兑换包需要的福利积分
|
|
user_cash decimal(14, 2) default 0, --兑换包需要的现金券
|
|
give_amount decimal(14, 2) default 0, -- 购买赠与福利值
|
|
day_total integer default 0, -- 产出总天数
|
|
amount_total decimal(14, 2) default 0, -- 总产出福利积分
|
|
amount_day decimal(14, 2) default 0, -- 每日产出福利积分 = 总产出 / 总产出
|
|
amount_out decimal(16, 4) default 0, -- 已产出福利积分
|
|
out_day integer default 0, -- 已产出天数
|
|
is_complete integer default 0, -- 是否完成 0未完成 1完成
|
|
expired_date timestamp(6),
|
|
is_expired integer default 0,
|
|
remark text,
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
|
|
|
|
|
|
create index upi_complete_index
|
|
on user_package_info (is_deleted, user_id , is_complete , is_expired);
|
|
|
|
create index upi_date_index
|
|
on user_package_info (is_deleted, statistical_date ,user_id);
|
|
|
|
create index upi_expired_index
|
|
on user_package_info (is_deleted, expired_date ,is_expired);
|
|
|
|
COMMENT ON TABLE user_package_info IS '用户积分包信息表';
|
|
COMMENT ON COLUMN user_package_info.id IS '主键';
|
|
COMMENT ON COLUMN user_package_info.user_id IS '用户id';
|
|
COMMENT ON COLUMN user_package_info.phone IS '用户手机号';
|
|
COMMENT ON COLUMN user_package_info.user_name IS '用户名';
|
|
COMMENT ON COLUMN user_package_info.package_id IS '积分包id';
|
|
COMMENT ON COLUMN user_package_info.package_name IS '积分包名称';
|
|
COMMENT ON COLUMN user_package_info.type IS '1-积分兑换 2-后台划拨';
|
|
COMMENT ON COLUMN user_package_info.user_benefit IS '兑换包需要的福利积分';
|
|
COMMENT ON COLUMN user_package_info.user_cash IS '兑换包需要的现金券';
|
|
COMMENT ON COLUMN user_package_info.give_amount IS '购买赠与福利值';
|
|
COMMENT ON COLUMN user_package_info.day_total IS '产出总天数';
|
|
COMMENT ON COLUMN user_package_info.amount_total IS '总产出福利积分';
|
|
COMMENT ON COLUMN user_package_info.amount_day IS '每日产出福利积分';
|
|
COMMENT ON COLUMN user_package_info.amount_out IS '已产出福利积分';
|
|
COMMENT ON COLUMN user_package_info.out_day IS '已产出天数';
|
|
COMMENT ON COLUMN user_package_info.is_complete IS '是否完成 0-未完成 1-完成';
|
|
COMMENT ON COLUMN user_package_info.expired_date IS '过期时间';
|
|
COMMENT ON COLUMN user_package_info.is_expired IS '是否过期 0-未过期 1-已过期';
|
|
COMMENT ON COLUMN user_package_info.remark IS '备注';
|
|
comment on column user_package_info.create_user is '创建人';
|
|
comment on column user_package_info.create_dept is '创建部门';
|
|
comment on column user_package_info.create_time is '创建时间';
|
|
comment on column user_package_info.update_user is '修改人';
|
|
comment on column user_package_info.update_time is '修改时间';
|
|
comment on column user_package_info.status is '状态';
|
|
comment on column user_package_info.is_deleted is '是否已删除';
|
|
|
|
alter table user_package_info
|
|
owner to postgres;
|
|
|
|
|
|
|
|
|
|
create table user_package_info_copy
|
|
(
|
|
id int8 not null primary key,
|
|
statistical_date timestamp(6),
|
|
user_id int8,
|
|
phone int8,
|
|
user_name varchar(128),
|
|
user_package_info_Id int8, --user_package_info id
|
|
package_id int8,
|
|
package_name varchar(128),
|
|
type integer default 1, -- 1-积分兑换 2-后台划拨
|
|
user_benefit decimal(14, 2) default 0, --兑换包需要的福利积分
|
|
user_cash decimal(14, 2) default 0, --兑换包需要的现金券
|
|
give_amount decimal(14, 2) default 0, -- 购买赠与福利值
|
|
day_total integer default 0, -- 产出总天数
|
|
amount_total decimal(14, 2) default 0, -- 总产出福利积分
|
|
amount_day decimal(14, 2) default 0, -- 每日产出福利积分 = 总产出 / 总产出
|
|
amount_out decimal(16, 4) default 0, -- 已产出多少福利积分
|
|
remaining_amount decimal(16, 4) default 0, -- 剩余可产出福利积分 (总计 - 已经经历多少天 * 每天产出 - 加速积分)
|
|
accelerated_amount decimal(16, 4) default 0, -- 已加速多少福利积分
|
|
parent_id int8, -- 给到谁10%积分,到用户id
|
|
parent_amount decimal(16, 4) default 0, -- 给到谁10%积分,到积分账户(福利积分)
|
|
out_day integer default 0, -- 产出天数 当前包已经产出天数
|
|
experience_day integer default 0, -- 当前包已经经历的天数
|
|
not_sign_list int8[], -- 未签到日期详情 (数组)
|
|
is_complete integer default 0, -- 是否完成 0未完成 1完成
|
|
active_time timestamp(6), -- 当前包激活时间
|
|
start_time timestamp(6), -- 当前包生效时间
|
|
sign_bitmap int8 default 0, -- 位图将包的签到时间360天二进制转成十进制
|
|
expired_date timestamp(6),
|
|
is_expired integer default 0,
|
|
version integer default 1,
|
|
remark text,
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
|
|
);
|
|
create index upi_copy_complete_index
|
|
on user_package_info_copy (is_deleted, is_complete , is_expired ,user_id );
|
|
create index upi_copy_date_index
|
|
on user_package_info_copy (is_deleted, statistical_date ,user_id);
|
|
create index upi_copy_expired_index
|
|
on user_package_info_copy (is_deleted, expired_date ,is_expired);
|
|
|
|
COMMENT ON TABLE user_package_info_copy IS '用户积分包信息-副本表';
|
|
COMMENT ON COLUMN user_package_info_copy.id IS '主键';
|
|
COMMENT ON COLUMN user_package_info_copy.user_id IS '用户id';
|
|
COMMENT ON COLUMN user_package_info_copy.phone IS '用户手机号';
|
|
COMMENT ON COLUMN user_package_info_copy.user_name IS '用户名';
|
|
COMMENT ON COLUMN user_package_info_copy.user_package_info IS '用户积分包id';
|
|
COMMENT ON COLUMN user_package_info_copy.package_id IS '积分包id';
|
|
COMMENT ON COLUMN user_package_info_copy.package_name IS '积分包名称';
|
|
COMMENT ON COLUMN user_package_info_copy.type IS '1-积分兑换 2-后台划拨';
|
|
COMMENT ON COLUMN user_package_info_copy.user_benefit IS '兑换包需要的福利积分';
|
|
COMMENT ON COLUMN user_package_info_copy.user_cash IS '兑换包需要的现金券';
|
|
COMMENT ON COLUMN user_package_info_copy.give_amount IS '购买赠与福利值';
|
|
COMMENT ON COLUMN user_package_info_copy.day_total IS '产出总天数';
|
|
COMMENT ON COLUMN user_package_info_copy.amount_total IS '总产出福利积分';
|
|
COMMENT ON COLUMN user_package_info_copy.amount_day IS '每日产出福利积分';
|
|
COMMENT ON COLUMN user_package_info_copy.amount_out IS '已产出福利积分';
|
|
COMMENT ON COLUMN user_package_info_copy.remaining_amount IS '剩余可产出福利积分';
|
|
COMMENT ON COLUMN user_package_info_copy.accelerated_amount IS '已加速多少福利积分';
|
|
COMMENT ON COLUMN user_package_info_copy.parent_id IS '给到谁10%积分,到用户id';
|
|
COMMENT ON COLUMN user_package_info_copy.parent_amount IS '给到谁10%积分,到积分账户(福利积分)';
|
|
COMMENT ON COLUMN user_package_info_copy.out_day IS '产出天数 当前包已经产出天数';
|
|
COMMENT ON COLUMN user_package_info_copy.experience_day IS '当前包已经经历的天数';
|
|
COMMENT ON COLUMN user_package_info_copy.not_sign_list IS '未签到日期详情 (数组)';
|
|
COMMENT ON COLUMN user_package_info_copy.is_complete IS '是否完成 0-未完成 1-完成';
|
|
COMMENT ON COLUMN user_package_info_copy.start_time IS '当前包生效时间';
|
|
COMMENT ON COLUMN user_package_info_copy.active_time IS '当前包激活时间';
|
|
COMMENT ON COLUMN user_package_info_copy.sign_bitmap IS '位图将包的签到时间360天二进制转成十进制';
|
|
COMMENT ON COLUMN user_package_info_copy.expired_date IS '过期时间';
|
|
COMMENT ON COLUMN user_package_info_copy.is_expired IS '是否过期 0-未过期 1-已过期';
|
|
COMMENT ON COLUMN user_package_info_copy.version IS '版本号';
|
|
COMMENT ON COLUMN user_package_info_copy.remark IS '备注';
|
|
COMMENT ON COLUMN user_package_info_copy.create_user IS '创建人';
|
|
COMMENT ON COLUMN user_package_info_copy.create_dept IS '创建部门';
|
|
COMMENT ON COLUMN user_package_info_copy.create_time IS '创建时间';
|
|
COMMENT ON COLUMN user_package_info_copy.update_user IS '修改人';
|
|
COMMENT ON COLUMN user_package_info_copy.update_time IS '修改时间';
|
|
COMMENT ON COLUMN user_package_info_copy.status IS '状态';
|
|
COMMENT ON COLUMN user_package_info_copy.is_deleted IS '是否已删除';
|
|
|
|
|
|
|
|
-- 佣金账户表
|
|
create table user_commission_account
|
|
(
|
|
id int8 not null primary key,
|
|
account_name varchar(128), -- 账户名称
|
|
account_number varchar(64), -- 账户编号
|
|
account_code varchar(64), -- 账户代码
|
|
amount decimal(14, 2) default 0, -- 账户总余额
|
|
version int default 1,
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
create index user_commission_account_index
|
|
on user_commission_account (is_deleted, account_code);
|
|
|
|
comment on table user_commission_account is '用户佣金账户表';
|
|
comment on column user_commission_account.id is '主键';
|
|
comment on column user_commission_account.account_name is '账户名称';
|
|
comment on column user_commission_account.account_number is '账户编号';
|
|
comment on column user_commission_account.account_code is '账户代码';
|
|
comment on column user_commission_account.amount is '账户总余额';
|
|
comment on column user_commission_account.version is '版本号';
|
|
comment on column user_commission_account.create_user is '创建人';
|
|
comment on column user_commission_account.create_dept is '创建部门';
|
|
comment on column user_commission_account.create_time is '创建时间';
|
|
comment on column user_commission_account.update_user is '修改人';
|
|
comment on column user_commission_account.update_time is '修改时间';
|
|
comment on column user_commission_account.status is '状态';
|
|
comment on column user_commission_account.is_deleted is '是否已删除';
|
|
|
|
alter table user_commission_account
|
|
owner to postgres;
|
|
|
|
-- 25%商品成本佣金流水表
|
|
create table user_commission_goods_cost_log
|
|
(
|
|
id int8 not null primary key,
|
|
account_id int8, -- 账户id
|
|
account_name varchar(128), -- 账户名称
|
|
account_number varchar(64), -- 账户编号
|
|
account_code varchar(64), -- 账户代码
|
|
user_id int8,
|
|
user_phone int8,
|
|
user_name varchar(128),
|
|
amount decimal(14, 2) default 0, -- 变动金额
|
|
source_id int8, -- 来源id
|
|
source_detail text, -- 来源详情
|
|
order_id int8, -- 订单id
|
|
order_detail text, -- 订单详情
|
|
type int default 1, -- 类型 1-收入 2-支出
|
|
statistical_date timestamp(6), -- 统计时间
|
|
remark text, -- 备注
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
create index ucc_log_date_index
|
|
on user_commission_goods_cost_log (is_deleted, user_id, statistical_date, type);
|
|
|
|
comment on table user_commission_goods_cost_log is '25%商品成本佣金流水表';
|
|
comment on column user_commission_goods_cost_log.id is '主键';
|
|
comment on column user_commission_goods_cost_log.account_id is '账户id';
|
|
comment on column user_commission_goods_cost_log.account_name is '账户名称';
|
|
comment on column user_commission_goods_cost_log.account_number is '账户编号';
|
|
comment on column user_commission_goods_cost_log.account_code is '账户代码';
|
|
comment on column user_commission_goods_cost_log.user_id is '用户id';
|
|
comment on column user_commission_goods_cost_log.user_phone is '用户手机号';
|
|
comment on column user_commission_goods_cost_log.user_name is '用户名称';
|
|
comment on column user_commission_goods_cost_log.amount is '变动金额';
|
|
comment on column user_commission_goods_cost_log.source_id is '来源id';
|
|
comment on column user_commission_goods_cost_log.source_detail is '来源详情';
|
|
comment on column user_commission_goods_cost_log.order_id is '订单id';
|
|
comment on column user_commission_goods_cost_log.order_detail is '订单详情';
|
|
comment on column user_commission_goods_cost_log.type is '类型 1-收入 2-支出';
|
|
comment on column user_commission_goods_cost_log.statistical_date is '统计时间';
|
|
comment on column user_commission_goods_cost_log.remark is '备注';
|
|
comment on column user_commission_goods_cost_log.create_user is '创建人';
|
|
comment on column user_commission_goods_cost_log.create_dept is '创建部门';
|
|
comment on column user_commission_goods_cost_log.create_time is '创建时间';
|
|
comment on column user_commission_goods_cost_log.update_user is '修改人';
|
|
comment on column user_commission_goods_cost_log.update_time is '修改时间';
|
|
comment on column user_commission_goods_cost_log.status is '状态';
|
|
comment on column user_commission_goods_cost_log.is_deleted is '是否已删除';
|
|
|
|
alter table user_commission_goods_cost_log
|
|
owner to postgres;
|
|
|
|
-- 30%购买人获取用户积分佣金流水表
|
|
create table user_commission_user_point_log
|
|
(
|
|
id int8 not null primary key,
|
|
account_id int8, -- 账户id
|
|
account_name varchar(128), -- 账户名称
|
|
account_number varchar(64), -- 账户编号
|
|
account_code varchar(64), -- 账户代码
|
|
user_id int8,
|
|
user_phone int8,
|
|
user_name varchar(128),
|
|
amount decimal(14, 2) default 0, -- 变动金额
|
|
source_id int8, -- 来源id
|
|
source_detail text, -- 来源详情
|
|
order_id int8, -- 订单id
|
|
order_detail text, -- 订单详情
|
|
type int default 1, -- 类型 1-收入 2-支出
|
|
statistical_date timestamp(6), -- 统计时间
|
|
remark text, -- 备注
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
create index ucup_log_date_index
|
|
on user_commission_user_point_log (is_deleted, user_id, statistical_date, type);
|
|
|
|
comment on table user_commission_user_point_log is '30%购买人获取用户积分佣金流水表';
|
|
comment on column user_commission_user_point_log.id is '主键';
|
|
comment on column user_commission_user_point_log.account_id is '账户id';
|
|
comment on column user_commission_user_point_log.account_name is '账户名称';
|
|
comment on column user_commission_user_point_log.account_number is '账户编号';
|
|
comment on column user_commission_user_point_log.account_code is '账户代码';
|
|
comment on column user_commission_user_point_log.user_id is '用户id';
|
|
comment on column user_commission_user_point_log.user_phone is '用户手机号';
|
|
comment on column user_commission_user_point_log.user_name is '用户名称';
|
|
comment on column user_commission_user_point_log.amount is '变动金额';
|
|
comment on column user_commission_user_point_log.source_id is '来源id';
|
|
comment on column user_commission_user_point_log.source_detail is '来源详情';
|
|
comment on column user_commission_user_point_log.order_id is '订单id';
|
|
comment on column user_commission_user_point_log.order_detail is '订单详情';
|
|
comment on column user_commission_user_point_log.type is '类型 1-收入 2-支出';
|
|
comment on column user_commission_user_point_log.statistical_date is '统计时间';
|
|
comment on column user_commission_user_point_log.remark is '备注';
|
|
comment on column user_commission_user_point_log.create_user is '创建人';
|
|
comment on column user_commission_user_point_log.create_dept is '创建部门';
|
|
comment on column user_commission_user_point_log.create_time is '创建时间';
|
|
comment on column user_commission_user_point_log.update_user is '修改人';
|
|
comment on column user_commission_user_point_log.update_time is '修改时间';
|
|
comment on column user_commission_user_point_log.status is '状态';
|
|
comment on column user_commission_user_point_log.is_deleted is '是否已删除';
|
|
|
|
alter table user_commission_user_point_log
|
|
owner to postgres;
|
|
|
|
-- 10%直推人佣金流水表
|
|
create table user_commission_direct_push_log
|
|
(
|
|
id int8 not null primary key,
|
|
account_id int8, -- 账户id
|
|
account_name varchar(128), -- 账户名称
|
|
account_number varchar(64), -- 账户编号
|
|
account_code varchar(64), -- 账户代码
|
|
user_id int8,
|
|
user_phone int8,
|
|
user_name varchar(128),
|
|
amount decimal(14, 2) default 0, -- 变动金额
|
|
source_id int8, -- 来源id
|
|
source_detail text, -- 来源详情
|
|
order_id int8, -- 订单id
|
|
order_detail text, -- 订单详情
|
|
type int default 1, -- 类型 1-收入 2-支出
|
|
statistical_date timestamp(6), -- 统计时间
|
|
remark text, -- 备注
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
create index ucdp_log_date_index
|
|
on user_commission_direct_push_log (is_deleted, user_id, statistical_date, type);
|
|
|
|
comment on table user_commission_direct_push_log is '10%直推人佣金流水表';
|
|
comment on column user_commission_direct_push_log.id is '主键';
|
|
comment on column user_commission_direct_push_log.account_id is '账户id';
|
|
comment on column user_commission_direct_push_log.account_name is '账户名称';
|
|
comment on column user_commission_direct_push_log.account_number is '账户编号';
|
|
comment on column user_commission_direct_push_log.account_code is '账户代码';
|
|
comment on column user_commission_direct_push_log.user_id is '用户id';
|
|
comment on column user_commission_direct_push_log.user_phone is '用户手机号';
|
|
comment on column user_commission_direct_push_log.user_name is '用户名称';
|
|
comment on column user_commission_direct_push_log.amount is '变动金额';
|
|
comment on column user_commission_direct_push_log.source_id is '来源id';
|
|
comment on column user_commission_direct_push_log.source_detail is '来源详情';
|
|
comment on column user_commission_direct_push_log.order_id is '订单id';
|
|
comment on column user_commission_direct_push_log.order_detail is '订单详情';
|
|
comment on column user_commission_direct_push_log.type is '类型 1-收入 2-支出';
|
|
comment on column user_commission_direct_push_log.statistical_date is '统计时间';
|
|
comment on column user_commission_direct_push_log.remark is '备注';
|
|
comment on column user_commission_direct_push_log.create_user is '创建人';
|
|
comment on column user_commission_direct_push_log.create_dept is '创建部门';
|
|
comment on column user_commission_direct_push_log.create_time is '创建时间';
|
|
comment on column user_commission_direct_push_log.update_user is '修改人';
|
|
comment on column user_commission_direct_push_log.update_time is '修改时间';
|
|
comment on column user_commission_direct_push_log.status is '状态';
|
|
comment on column user_commission_direct_push_log.is_deleted is '是否已删除';
|
|
|
|
alter table user_commission_direct_push_log
|
|
owner to postgres;
|
|
|
|
-- 5%运营佣金流水表
|
|
create table user_commission_operation_log
|
|
(
|
|
id int8 not null primary key,
|
|
account_id int8, -- 账户id
|
|
account_name varchar(128), -- 账户名称
|
|
account_number varchar(64), -- 账户编号
|
|
account_code varchar(64), -- 账户代码
|
|
user_id int8,
|
|
user_phone int8,
|
|
user_name varchar(128),
|
|
amount decimal(14, 2) default 0, -- 变动金额
|
|
source_id int8, -- 来源id
|
|
source_detail text, -- 来源详情
|
|
order_id int8, -- 订单id
|
|
order_detail text, -- 订单详情
|
|
type int default 1, -- 类型 1-收入 2-支出
|
|
statistical_date timestamp(6), -- 统计时间
|
|
remark text, -- 备注
|
|
random_deduction decimal(14, 2) default 0, -- 随机立减金额
|
|
random_deduction_desc text, -- 随机立减说明
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
create index ucop_log_date_index
|
|
on user_commission_operation_log (is_deleted, user_id, statistical_date, type);
|
|
|
|
comment on table user_commission_operation_log is '5%运营佣金流水表';
|
|
comment on column user_commission_operation_log.id is '主键';
|
|
comment on column user_commission_operation_log.account_id is '账户id';
|
|
comment on column user_commission_operation_log.account_name is '账户名称';
|
|
comment on column user_commission_operation_log.account_number is '账户编号';
|
|
comment on column user_commission_operation_log.account_code is '账户代码';
|
|
comment on column user_commission_operation_log.order_detail is '订单详情';
|
|
comment on column user_commission_operation_log.user_id is '用户id';
|
|
comment on column user_commission_operation_log.user_phone is '用户手机号';
|
|
comment on column user_commission_operation_log.user_name is '用户名称';
|
|
comment on column user_commission_operation_log.amount is '变动金额';
|
|
comment on column user_commission_operation_log.source_id is '来源id';
|
|
comment on column user_commission_operation_log.source_detail is '来源详情';
|
|
comment on column user_commission_operation_log.order_id is '订单id';
|
|
comment on column user_commission_operation_log.type is '类型 1-收入 2-支出';
|
|
comment on column user_commission_operation_log.statistical_date is '统计时间';
|
|
comment on column user_commission_operation_log.remark is '备注';
|
|
comment on column user_commission_operation_log.random_deduction is '随机立减金额';
|
|
comment on column user_commission_operation_log.random_deduction_desc is '随机立减说明';
|
|
comment on column user_commission_operation_log.create_user is '创建人';
|
|
comment on column user_commission_operation_log.create_dept is '创建部门';
|
|
comment on column user_commission_operation_log.create_time is '创建时间';
|
|
comment on column user_commission_operation_log.update_user is '修改人';
|
|
comment on column user_commission_operation_log.update_time is '修改时间';
|
|
comment on column user_commission_operation_log.status is '状态';
|
|
comment on column user_commission_operation_log.is_deleted is '是否已删除';
|
|
|
|
alter table user_commission_operation_log
|
|
owner to postgres;
|
|
|
|
-- 5%广告补贴佣金流水表
|
|
create table user_commission_advertising_log
|
|
(
|
|
id int8 not null primary key,
|
|
account_id int8, -- 账户id
|
|
account_name varchar(128), -- 账户名称
|
|
account_number varchar(64), -- 账户编号
|
|
account_code varchar(64), -- 账户代码
|
|
amount decimal(14, 2) default 0, -- 变动金额
|
|
source_id int8, -- 来源id
|
|
source_detail text, -- 来源详情
|
|
order_id int8, -- 订单id
|
|
order_detail text, -- 订单详情
|
|
type int default 1, -- 类型 1-收入 2-支出
|
|
statistical_date timestamp(6), -- 统计时间
|
|
remark text, -- 备注
|
|
daily_statistics_date timestamp(6), -- 每日统计日期
|
|
statistics_cycle varchar(32), -- 统计周期
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
create index uca_log_date_index
|
|
on user_commission_advertising_log (is_deleted, account_id);
|
|
|
|
comment on table user_commission_advertising_log is '5%广告补贴佣金流水表';
|
|
comment on column user_commission_advertising_log.id is '主键';
|
|
comment on column user_commission_advertising_log.account_id is '账户id';
|
|
comment on column user_commission_advertising_log.account_name is '账户名称';
|
|
comment on column user_commission_advertising_log.account_number is '账户编号';
|
|
comment on column user_commission_advertising_log.account_code is '账户代码';
|
|
comment on column user_commission_advertising_log.amount is '变动金额';
|
|
comment on column user_commission_advertising_log.source_id is '来源id';
|
|
comment on column user_commission_advertising_log.source_detail is '来源详情';
|
|
comment on column user_commission_advertising_log.order_id is '订单id';
|
|
comment on column user_commission_advertising_log.order_detail is '订单详情';
|
|
comment on column user_commission_advertising_log.type is '类型 1-收入 2-支出';
|
|
comment on column user_commission_advertising_log.statistical_date is '统计时间';
|
|
comment on column user_commission_advertising_log.remark is '备注';
|
|
comment on column user_commission_advertising_log.daily_statistics_date is '每日统计日期';
|
|
comment on column user_commission_advertising_log.statistics_cycle is '统计周期';
|
|
comment on column user_commission_advertising_log.create_user is '创建人';
|
|
comment on column user_commission_advertising_log.create_dept is '创建部门';
|
|
comment on column user_commission_advertising_log.create_time is '创建时间';
|
|
comment on column user_commission_advertising_log.update_user is '修改人';
|
|
comment on column user_commission_advertising_log.update_time is '修改时间';
|
|
comment on column user_commission_advertising_log.status is '状态';
|
|
comment on column user_commission_advertising_log.is_deleted is '是否已删除';
|
|
|
|
alter table user_commission_advertising_log
|
|
owner to postgres;
|
|
|
|
-- 5%服务商佣金流水表
|
|
create table user_commission_service_provider_log
|
|
(
|
|
id int8 not null primary key,
|
|
account_id int8, -- 账户id
|
|
account_name varchar(128), -- 账户名称
|
|
account_number varchar(64), -- 账户编号
|
|
account_code varchar(64), -- 账户代码
|
|
user_id int8,
|
|
user_phone int8,
|
|
user_name varchar(128),
|
|
amount decimal(14, 2) default 0, -- 变动金额
|
|
source_id int8, -- 来源id
|
|
source_detail text, -- 来源详情
|
|
order_id int8, -- 订单id
|
|
order_detail text, -- 订单详情
|
|
type int default 1, -- 类型 1-收入 2-支出
|
|
statistical_date timestamp(6), -- 统计时间
|
|
remark text, -- 备注
|
|
service_type varchar(64), -- 服务类型
|
|
service_provider_id int8, -- 服务商ID
|
|
address_id int8,
|
|
region_id int8,
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
create index ucsp_log_date_index
|
|
on user_commission_service_provider_log (is_deleted, user_id, statistical_date, type);
|
|
|
|
comment on table user_commission_service_provider_log is '5%服务商佣金流水表';
|
|
comment on column user_commission_service_provider_log.id is '主键';
|
|
comment on column user_commission_service_provider_log.account_id is '账户id';
|
|
comment on column user_commission_service_provider_log.account_name is '账户名称';
|
|
comment on column user_commission_service_provider_log.account_number is '账户编号';
|
|
comment on column user_commission_service_provider_log.account_code is '账户代码';
|
|
comment on column user_commission_service_provider_log.order_detail is '订单详情';
|
|
comment on column user_commission_service_provider_log.amount is '变动金额';
|
|
comment on column user_commission_service_provider_log.source_id is '来源id';
|
|
comment on column user_commission_service_provider_log.source_detail is '来源详情';
|
|
comment on column user_commission_service_provider_log.order_id is '订单id';
|
|
comment on column user_commission_service_provider_log.type is '类型 1-收入 2-支出';
|
|
comment on column user_commission_service_provider_log.statistical_date is '统计时间';
|
|
comment on column user_commission_service_provider_log.remark is '备注';
|
|
comment on column user_commission_service_provider_log.service_type is '服务类型';
|
|
comment on column user_commission_service_provider_log.service_provider_id is '服务商ID';
|
|
comment on column user_commission_service_provider_log.address_id is '收货地址id';
|
|
comment on column user_commission_service_provider_log.region_id is '省市区id';
|
|
comment on column user_commission_service_provider_log.create_user is '创建人';
|
|
comment on column user_commission_service_provider_log.create_dept is '创建部门';
|
|
comment on column user_commission_service_provider_log.create_time is '创建时间';
|
|
comment on column user_commission_service_provider_log.update_user is '修改人';
|
|
comment on column user_commission_service_provider_log.update_time is '修改时间';
|
|
comment on column user_commission_service_provider_log.status is '状态';
|
|
comment on column user_commission_service_provider_log.is_deleted is '是否已删除';
|
|
|
|
alter table user_commission_service_provider_log
|
|
owner to postgres;
|
|
|
|
-- 15%极差代理佣金流水表
|
|
create table user_commission_agency_log
|
|
(
|
|
id int8 not null primary key,
|
|
account_id int8, -- 账户id
|
|
account_name varchar(128), -- 账户名称
|
|
account_number varchar(64), -- 账户编号
|
|
account_code varchar(64), -- 账户代码
|
|
user_id int8,
|
|
user_phone int8,
|
|
user_name varchar(128),
|
|
amount decimal(14, 2) default 0, -- 变动金额
|
|
source_id int8, -- 来源id
|
|
source_detail text, -- 来源详情
|
|
order_id int8, -- 订单id
|
|
order_detail text, -- 订单详情
|
|
type int default 1, -- 类型 1-收入 2-支出
|
|
statistical_date timestamp(6), -- 统计时间
|
|
remark text, -- 备注
|
|
agency_level varchar(32), -- 代理级别
|
|
agency_parent_id int8, -- 上级代理ID
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
create index ucal_log_date_index
|
|
on user_commission_agency_log (is_deleted, user_id, statistical_date, type);
|
|
|
|
comment on table user_commission_agency_log is '15%极差代理佣金流水表';
|
|
comment on column user_commission_agency_log.id is '主键';
|
|
comment on column user_commission_agency_log.account_id is '账户id';
|
|
comment on column user_commission_agency_log.account_name is '账户名称';
|
|
comment on column user_commission_agency_log.account_number is '账户编号';
|
|
comment on column user_commission_agency_log.account_code is '账户代码';
|
|
comment on column user_commission_agency_log.user_id is '用户id';
|
|
comment on column user_commission_agency_log.user_phone is '用户手机号';
|
|
comment on column user_commission_agency_log.user_name is '用户名称';
|
|
comment on column user_commission_agency_log.order_detail is '订单详情';
|
|
comment on column user_commission_agency_log.amount is '变动金额';
|
|
comment on column user_commission_agency_log.source_id is '来源id';
|
|
comment on column user_commission_agency_log.source_detail is '来源详情';
|
|
comment on column user_commission_agency_log.order_id is '订单id';
|
|
comment on column user_commission_agency_log.type is '类型 1-收入 2-支出';
|
|
comment on column user_commission_agency_log.statistical_date is '统计时间';
|
|
comment on column user_commission_agency_log.remark is '备注';
|
|
comment on column user_commission_agency_log.agency_level is '代理级别';
|
|
comment on column user_commission_agency_log.agency_parent_id is '上级代理ID';
|
|
comment on column user_commission_agency_log.create_user is '创建人';
|
|
comment on column user_commission_agency_log.create_dept is '创建部门';
|
|
comment on column user_commission_agency_log.create_time is '创建时间';
|
|
comment on column user_commission_agency_log.update_user is '修改人';
|
|
comment on column user_commission_agency_log.update_time is '修改时间';
|
|
comment on column user_commission_agency_log.status is '状态';
|
|
comment on column user_commission_agency_log.is_deleted is '是否已删除';
|
|
|
|
alter table user_commission_agency_log
|
|
owner to postgres;
|
|
|
|
-- 5%联创佣金流水表
|
|
create table user_commission_co_creator_log
|
|
(
|
|
id int8 not null primary key,
|
|
account_id int8, -- 账户id
|
|
account_name varchar(128), -- 账户名称
|
|
account_number varchar(64), -- 账户编号
|
|
account_code varchar(64), -- 账户代码
|
|
user_id int8,
|
|
user_phone int8,
|
|
user_name varchar(128),
|
|
amount decimal(14, 2) default 0, -- 变动金额
|
|
source_id int8, -- 来源id
|
|
source_detail text, -- 来源详情
|
|
order_id int8, -- 订单id
|
|
order_detail text, -- 订单详情
|
|
type int default 1, -- 类型 1-收入 2-支出
|
|
statistical_date timestamp(6), -- 统计时间
|
|
remark text, -- 备注
|
|
create_user int8,
|
|
create_dept int8,
|
|
create_time timestamp(6),
|
|
update_user int8,
|
|
update_time timestamp(6),
|
|
status integer default 1,
|
|
is_deleted integer default 0
|
|
);
|
|
|
|
create index uccc_log_date_index
|
|
on user_commission_co_creator_log (is_deleted, user_id, statistical_date, type);
|
|
|
|
comment on table user_commission_co_creator_log is '5%联创佣金流水表';
|
|
comment on column user_commission_co_creator_log.id is '主键';
|
|
comment on column user_commission_co_creator_log.account_id is '账户id';
|
|
comment on column user_commission_co_creator_log.account_name is '账户名称';
|
|
comment on column user_commission_co_creator_log.account_number is '账户编号';
|
|
comment on column user_commission_co_creator_log.account_code is '账户代码';
|
|
comment on column user_commission_co_creator_log.order_detail is '订单详情';
|
|
comment on column user_commission_co_creator_log.amount is '变动金额';
|
|
comment on column user_commission_co_creator_log.source_id is '来源id';
|
|
comment on column user_commission_co_creator_log.source_detail is '来源详情';
|
|
comment on column user_commission_co_creator_log.order_id is '订单id';
|
|
comment on column user_commission_co_creator_log.type is '类型 1-收入 2-支出';
|
|
comment on column user_commission_co_creator_log.statistical_date is '统计时间';
|
|
comment on column user_commission_co_creator_log.remark is '备注';
|
|
comment on column user_commission_co_creator_log.create_user is '创建人';
|
|
comment on column user_commission_co_creator_log.create_dept is '创建部门';
|
|
comment on column user_commission_co_creator_log.create_time is '创建时间';
|
|
comment on column user_commission_co_creator_log.update_user is '修改人';
|
|
comment on column user_commission_co_creator_log.update_time is '修改时间';
|
|
comment on column user_commission_co_creator_log.status is '状态';
|
|
comment on column user_commission_co_creator_log.is_deleted is '是否已删除';
|
|
|
|
alter table user_commission_co_creator_log
|
|
owner to postgres;
|
|
|
|
|
|
|
|
|
|
|