sql脚本-用户树结构, 用户直推
This commit is contained in:
@@ -68,10 +68,12 @@ alter table user_base
|
|||||||
create table user_genealogy
|
create table user_genealogy
|
||||||
(
|
(
|
||||||
id bigint not null primary key,
|
id bigint not null primary key,
|
||||||
|
name varchar(128),
|
||||||
|
phone bigint,
|
||||||
pid bigint,
|
pid bigint,
|
||||||
root_id bigint,
|
root_id bigint,
|
||||||
group_id bigint,
|
group_id bigint,
|
||||||
genealogy_list text,
|
genealogy_list bigint[] ,
|
||||||
create_user bigint,
|
create_user bigint,
|
||||||
create_dept bigint,
|
create_dept bigint,
|
||||||
create_time timestamp(6),
|
create_time timestamp(6),
|
||||||
@@ -80,9 +82,18 @@ create table user_genealogy
|
|||||||
status integer default 1,
|
status integer default 1,
|
||||||
is_deleted integer default 0
|
is_deleted integer default 0
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX user_genealogy_list_gin_idx
|
||||||
|
ON user_genealogy USING gin (genealogy_list);
|
||||||
|
|
||||||
|
create index user_genealogy_phone_index
|
||||||
|
on user_genealogy (is_deleted, phone);
|
||||||
|
|
||||||
comment on table user_genealogy is '用户族谱表';
|
comment on table user_genealogy is '用户族谱表';
|
||||||
comment on column user_genealogy.id is '主键';
|
comment on column user_genealogy.id is '主键';
|
||||||
comment on column user_genealogy.pid is '上级id';
|
comment on column user_genealogy.pid is '上级id';
|
||||||
|
comment on column user_genealogy.phone is '手机号';
|
||||||
|
comment on column user_genealogy.name is '用户名';
|
||||||
comment on column user_genealogy.root_id is '根id';
|
comment on column user_genealogy.root_id is '根id';
|
||||||
comment on column user_genealogy.group_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.genealogy_list is '族谱列表';
|
||||||
|
|||||||
71
doc/sql/user_tree_postgres.sql
Normal file
71
doc/sql/user_tree_postgres.sql
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
create table user_tree
|
||||||
|
(
|
||||||
|
id bigint not null primary key,
|
||||||
|
name varchar(128),
|
||||||
|
phone bigint,
|
||||||
|
pid bigint,
|
||||||
|
level integer default 1,
|
||||||
|
create_user bigint,
|
||||||
|
create_dept bigint,
|
||||||
|
create_time timestamp(6),
|
||||||
|
update_user bigint,
|
||||||
|
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);
|
||||||
|
|
||||||
|
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.phone is '手机号';
|
||||||
|
comment on column user_tree.name is '用户名';
|
||||||
|
comment on column user_tree.level 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_child
|
||||||
|
(
|
||||||
|
id bigint not null primary key,
|
||||||
|
name varchar(128),
|
||||||
|
phone bigint,
|
||||||
|
child_list bigint[] ,
|
||||||
|
create_user bigint,
|
||||||
|
create_dept bigint,
|
||||||
|
create_time timestamp(6),
|
||||||
|
update_user bigint,
|
||||||
|
update_time timestamp(6),
|
||||||
|
status integer default 1,
|
||||||
|
is_deleted integer default 0
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX user_child_list_gin_idx
|
||||||
|
ON user_child USING gin (child_list);
|
||||||
|
|
||||||
|
create index user_child_phone_index
|
||||||
|
on user_child (is_deleted, phone);
|
||||||
|
|
||||||
|
comment on table user_child is '用户直推表';
|
||||||
|
comment on column user_child.id is '主键';
|
||||||
|
comment on column user_child.phone is '手机号';
|
||||||
|
comment on column user_child.name is '用户名';
|
||||||
|
comment on column user_child.child_list is '直推列表';
|
||||||
|
comment on column user_child.create_user is '创建人';
|
||||||
|
comment on column user_child.create_dept is '创建部门';
|
||||||
|
comment on column user_child.create_time is '创建时间';
|
||||||
|
comment on column user_child.update_user is '修改人';
|
||||||
|
comment on column user_child.update_time is '修改时间';
|
||||||
|
comment on column user_child.status is '状态';
|
||||||
|
comment on column user_child.is_deleted is '是否已删除';
|
||||||
|
alter table user_child
|
||||||
|
owner to postgres;
|
||||||
Reference in New Issue
Block a user