----------------------------------------------------------------------------------------------------- 菜单表
-- DROP TABLE IF EXISTS lf.sys_menu;
create table lf.sys_menu(
  id serial primary key,
  pid integer,
  cn_name varchar(50),
  en_name varchar(50),
  url varchar(256),
  perms varchar(512),
  type smallint,
  icon varchar(256),
  level integer,
  order_num integer,
  is_show smallint,
  create_user integer,
  create_time timestamp(6) without time zone default now(),
  update_user integer,
  update_time timestamp(6) without time zone,
  bak varchar(256)
);

comment on table lf.sys_menu is '菜单表';
comment on column lf.sys_menu.id is '主键';
comment on column lf.sys_menu.pid is '父ID,根节点-0';
comment on column lf.sys_menu.cn_name is '中文名称';
comment on column lf.sys_menu.en_name is '英文名称';
comment on column lf.sys_menu.url is '菜单Url';
comment on column lf.sys_menu.perms is '授权(多个用逗号分隔，如：user:list,user:create)';
comment on column lf.sys_menu.type is '类型：0-目录,1-菜单,2-按钮';
comment on column lf.sys_menu.icon is '图标';
comment on column lf.sys_menu.level is '层级,根节点-0';
comment on column lf.sys_menu.order_num is '排序号';
comment on column lf.sys_menu.is_show is '是否显示';
comment on column lf.sys_menu.create_user is '创建人ID';
comment on column lf.sys_menu.create_time is '创建时间';
comment on column lf.sys_menu.update_user is '更新人ID';
comment on column lf.sys_menu.update_time is '更新时间';
comment on column lf.sys_menu.bak is '备注';

--update lf.sys_menu set bak=null,create_time=now() where 1=1;

select * from lf.sys_menu;
----------------------------------------------------------------------------------------------------- 组织机构表
-- DROP TABLE IF EXISTS lf.sys_dep;
create table lf.sys_dep(
  id serial primary key,
  pid integer,
  name varchar(150),
  sname varchar(50),
  code varchar(50),
  uncode varchar(50),
  addr varchar(300),
  contact varchar(50),
  fax varchar(50),
  email varchar(50),
  post varchar(20),
  website varchar(1024),
  level integer,
  order_num integer,
  create_user integer,
  create_time timestamp(6) without time zone default now(),
  update_user integer,
  update_time timestamp(6) without time zone,
  bak varchar(256)
);

comment on table lf.sys_dep is '单位表';
comment on column lf.sys_dep.id is '主键';
comment on column lf.sys_dep.pid is '父ID,根节点-0';
comment on column lf.sys_dep.name is '名称';
comment on column lf.sys_dep.sname is '简称';
comment on column lf.sys_dep.code is '编码';
comment on column lf.sys_dep.uncode is '机构代码';
comment on column lf.sys_dep.addr is '地址';
comment on column lf.sys_dep.contact is '联系方式';
comment on column lf.sys_dep.fax is '传真';
comment on column lf.sys_dep.email is '电子邮件';
comment on column lf.sys_dep.post is '邮政编码';
comment on column lf.sys_dep.website is '网站地址';
comment on column lf.sys_dep.level is '层级,根节点-0';
comment on column lf.sys_dep.order_num is '排序号';
comment on column lf.sys_dep.create_user is '创建人ID';
comment on column lf.sys_dep.create_time is '创建时间';
comment on column lf.sys_dep.update_user is '更新人ID';
comment on column lf.sys_dep.update_time is '更新时间';
comment on column lf.sys_dep.bak is '备注';

--alter table lf.sys_dep rename short to sname;
--update lf.sys_dep set bak=null,create_time=now() where 1=1;

select * from lf.sys_dep;
----------------------------------------------------------------------------------------------------- 目录管理
-- DROP TABLE IF EXISTS lf.sys_dir;
create table lf.sys_dir(
  id serial primary key,
  pid integer,
  name varchar(150),
  short varchar(50),
  code varchar(50),
  uncode varchar(50),
  addr varchar(300),
  contact varchar(50),
  fax varchar(50),
  email varchar(50),
  post varchar(20),
  website varchar(1024),
  level integer,
  order_num integer,
  create_user integer,
  create_time timestamp(6) without time zone default now(),
  update_user integer,
  update_time timestamp(6) without time zone,
  bak varchar(256)
);

comment on table lf.sys_dir is '单位表';
comment on column lf.sys_dir.id is '主键';
comment on column lf.sys_dir.pid is '父ID,根节点-0';
comment on column lf.sys_dir.name is '名称';

comment on column lf.sys_dep.short is '简称';
comment on column lf.sys_dep.code is '编码';
comment on column lf.sys_dep.uncode is '机构代码';
comment on column lf.sys_dep.addr is '地址';
comment on column lf.sys_dep.contact is '联系方式';
comment on column lf.sys_dep.fax is '传真';
comment on column lf.sys_dep.email is '电子邮件';
comment on column lf.sys_dep.post is '邮政编码';
comment on column lf.sys_dep.website is '网站地址';
comment on column lf.sys_dep.level is '层级,根节点-0';
comment on column lf.sys_dep.order_num is '排序号';

comment on column lf.sys_dir.create_user is '创建人ID';
comment on column lf.sys_dir.create_time is '创建时间';
comment on column lf.sys_dir.update_user is '更新人ID';
comment on column lf.sys_dir.update_time is '更新时间';
comment on column lf.sys_dir.bak is '备注';

--update lf.sys_dir set bak=null,create_time=now() where 1=1;

select * from lf.sys_dir;
-----------------------------------------------------------------------------------------------------------
select * from public.addr


CREATE TABLE IF NOT EXISTS public.data_dir
(
    id integer NOT NULL,
    name character varying(60) COLLATE pg_catalog."default",
    pid integer NOT NULL,
    oid integer DEFAULT 1,
    CONSTRAINT data_dir_pkey PRIMARY KEY (id)
)












