管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-10 39e35df1c928a6dbceb216a315f5238b8839af8e
data/db_tab.sql
@@ -1,4 +1,4 @@
----------------------------------------------------------------------------------------------------- 1.菜单表
----------------------------------------------------------------------------------------------------- 01.菜单表
-- DROP TABLE IF EXISTS lf.sys_menu;
create table lf.sys_menu(
  id serial primary key,
@@ -8,6 +8,7 @@
  url varchar(256),
  perms varchar(512),
  type smallint,
  css varchar(30),
  icon varchar(256),
  level integer,
  order_num integer,
@@ -26,6 +27,7 @@
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.css is '样式表';
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 '排序号';
@@ -35,11 +37,11 @@
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 '备注';
--alter table lf.sys_menu alter column bak type varchar(1024);
--alter table lf.sys_menu add css varchar(30);
--alter sequence lf.sys_menu_id_seq restart with 44;
select * from lf.sys_menu order by order_num;
----------------------------------------------------------------------------------------------------- 2.单位表
----------------------------------------------------------------------------------------------------- 02.单位表
-- DROP TABLE IF EXISTS lf.sys_dep;
create table lf.sys_dep(
  id serial primary key,
@@ -82,11 +84,12 @@
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 sequence lf.sys_dep_id_seq restart with 45;
--alter table lf.sys_dep rename short to sname; alter table lf.sys_dep alter column bak type varchar(1024);
-- alter sequence lf.sys_dep_id_seq restart with 45;
-- alter table lf.sys_dep rename short to sname;
-- update lf.sys_dep set name='中国xxx工程有限公司' where name='中国石油天然气管道工程有限公司';
select * from lf.sys_dep order by id;
----------------------------------------------------------------------------------------------------- 3.目录表
----------------------------------------------------------------------------------------------------- 03.目录表
-- DROP TABLE IF EXISTS lf.sys_dir;
create table lf.sys_dir(
  id serial primary key,
@@ -118,7 +121,7 @@
--alter sequence lf.sys_dir_id_seq restart with 124;
select * from lf.sys_dir order by id;
----------------------------------------------------------------------------------------------------- 4.用户表
----------------------------------------------------------------------------------------------------- 04.用户表
-- DROP TABLE IF EXISTS lf.sys_user;
create table lf.sys_user(
  id serial primary key,
@@ -163,16 +166,16 @@
comment on column lf.sys_user.update_user is '更新人ID';
comment on column lf.sys_user.update_time is '更新时间';
comment on column lf.sys_user.bak is '备注';
/*insert into lf.sys_user (depid,uid,uname,pwd,create_user) values (1,'admin','管理员','000000',1);
/* insert into lf.sys_user (depid,uid,uname,pwd,create_user) values (1,'admin','管理员','000000',1);
insert into lf.sys_user (depid,uid,uname,pwd,create_user) values (20,'xl','线路室','000000',1);
insert into lf.sys_user (depid,uid,uname,pwd,create_user) values (21,'cky','穿跨越室','000000',1);
insert into lf.sys_user (depid,uid,uname,pwd,create_user) values (22,'tj','土建室','000000',1);
insert into lf.sys_user (depid,uid,uname,pwd,create_user) values (38,'kc','勘察室','000000',1);
insert into lf.sys_user (id,depid,uid,uname,pwd,create_user) values (0,1,'guest','访客','',1);
update lf.sys_user set pwd='b37f70636f1164e86cc8796201737933f65af63918d8442b';*/
update lf.sys_user set pwd='b37f70636f1164e86cc8796201737933f65af63918d8442b'; */
select * from lf.sys_user order by id;
----------------------------------------------------------------------------------------------------- 5.登录日志表
----------------------------------------------------------------------------------------------------- 05.登录日志表
-- DROP TABLE IF EXISTS lf.sys_login;
create table lf.sys_login(
  id serial8,
@@ -188,15 +191,15 @@
create table lf.sys_login_2022 partition of lf.sys_login for values from ('2022-01-01') to ('2023-01-01');
create INDEX index_sys_login_2022_optime on lf.sys_login_2022 (optime);
create table lf.sys_login_2023 partition of lf.sys_login for values from ('2023-01-01') to ('2024-01-01');
create INDEX index_sys_login_2023_optime on lf.sys_login_2022 (optime);
create INDEX index_sys_login_2023_optime on lf.sys_login_2023 (optime);
create table lf.sys_login_2024 partition of lf.sys_login for values from ('2024-01-01') to ('2025-01-01');
create INDEX index_sys_login_2024_optime on lf.sys_login_2022 (optime);
create INDEX index_sys_login_2024_optime on lf.sys_login_2024 (optime);
create table lf.sys_login_2025 partition of lf.sys_login for values from ('2025-01-01') to ('2026-01-01');
create INDEX index_sys_login_2025_optime on lf.sys_login_2022 (optime);
create INDEX index_sys_login_2025_optime on lf.sys_login_2025 (optime);
create table lf.sys_login_2026 partition of lf.sys_login for values from ('2026-01-01') to ('2027-01-01');
create INDEX index_sys_login_2026_optime on lf.sys_login_2022 (optime);
create INDEX index_sys_login_2026_optime on lf.sys_login_2026 (optime);
create table lf.sys_login_2027 partition of lf.sys_login for values from ('2027-01-01') to ('2028-01-01');
create INDEX index_sys_login_2027_optime on lf.sys_login_2022 (optime);
create INDEX index_sys_login_2027_optime on lf.sys_login_2027 (optime);
comment on table lf.sys_login is '登录日志表';
comment on column lf.sys_login.id is '主键ID';
@@ -213,7 +216,7 @@
select * from lf.sys_login; select * from lf.sys_login_2022; select * from lf.sys_login_2024;
select a.*,b.uname from lf.sys_login a inner join lf.sys_user b on a.userid = b.id;
----------------------------------------------------------------------------------------------------- 6.操作日志表
----------------------------------------------------------------------------------------------------- 06.操作日志表
-- DROP TABLE IF EXISTS lf.sys_operate;
create table lf.sys_operate(
  id serial8,
@@ -232,15 +235,15 @@
create table lf.sys_operate_2022 partition of lf.sys_operate for values from ('2022-01-01') to ('2023-01-01');
create INDEX index_sys_operate_2022_optime on lf.sys_operate_2022 (optime);
create table lf.sys_operate_2023 partition of lf.sys_operate for values from ('2023-01-01') to ('2024-01-01');
create INDEX index_sys_operate_2023_optime on lf.sys_operate_2022 (optime);
create INDEX index_sys_operate_2023_optime on lf.sys_operate_2023 (optime);
create table lf.sys_operate_2024 partition of lf.sys_operate for values from ('2024-01-01') to ('2025-01-01');
create INDEX index_sys_operate_2024_optime on lf.sys_operate_2022 (optime);
create INDEX index_sys_operate_2024_optime on lf.sys_operate_2024 (optime);
create table lf.sys_operate_2025 partition of lf.sys_operate for values from ('2025-01-01') to ('2026-01-01');
create INDEX index_sys_operate_2025_optime on lf.sys_operate_2022 (optime);
create INDEX index_sys_operate_2025_optime on lf.sys_operate_2025 (optime);
create table lf.sys_operate_2026 partition of lf.sys_operate for values from ('2026-01-01') to ('2027-01-01');
create INDEX index_sys_operate_2026_optime on lf.sys_operate_2022 (optime);
create INDEX index_sys_operate_2026_optime on lf.sys_operate_2026 (optime);
create table lf.sys_operate_2027 partition of lf.sys_operate for values from ('2027-01-01') to ('2028-01-01');
create INDEX index_sys_operate_2027_optime on lf.sys_operate_2022 (optime);
create INDEX index_sys_operate_2027_optime on lf.sys_operate_2027 (optime);
comment on table lf.sys_operate is '操作日志表';
comment on column lf.sys_operate.id is '主键ID';
@@ -264,7 +267,7 @@
select a.*,b.uname from lf.sys_operate a inner join lf.sys_user b on a.userid = b.id;
select * from lf.sys_operate; select * from lf.sys_operate_2022; select * from lf.sys_operate_2024;
----------------------------------------------------------------------------------------------------- 7.令牌表
----------------------------------------------------------------------------------------------------- 07.令牌表
-- DROP TABLE IF EXISTS lf.sys_token;
create table lf.sys_token(
  id serial8,
@@ -282,15 +285,15 @@
create table lf.sys_token_2022 partition of lf.sys_token for values from ('2022-01-01') to ('2023-01-01');
create INDEX index_sys_token_2022_create_time on lf.sys_token_2022 (create_time);
create table lf.sys_token_2023 partition of lf.sys_token for values from ('2023-01-01') to ('2024-01-01');
create INDEX index_sys_token_2023_create_time on lf.sys_token_2022 (create_time);
create INDEX index_sys_token_2023_create_time on lf.sys_token_2023 (create_time);
create table lf.sys_token_2024 partition of lf.sys_token for values from ('2024-01-01') to ('2025-01-01');
create INDEX index_sys_token_2024_create_time on lf.sys_token_2022 (create_time);
create INDEX index_sys_token_2024_create_time on lf.sys_token_2024 (create_time);
create table lf.sys_token_2025 partition of lf.sys_token for values from ('2025-01-01') to ('2026-01-01');
create INDEX index_sys_token_2025_create_time on lf.sys_token_2022 (create_time);
create INDEX index_sys_token_2025_create_time on lf.sys_token_2025 (create_time);
create table lf.sys_token_2026 partition of lf.sys_token for values from ('2026-01-01') to ('2027-01-01');
create INDEX index_sys_token_2026_create_time on lf.sys_token_2022 (create_time);
create INDEX index_sys_token_2026_create_time on lf.sys_token_2026 (create_time);
create table lf.sys_token_2027 partition of lf.sys_token for values from ('2027-01-01') to ('2028-01-01');
create INDEX index_sys_token_2027_create_time on lf.sys_token_2022 (create_time);
create INDEX index_sys_token_2027_create_time on lf.sys_token_2027 (create_time);
comment on table lf.sys_token is '令牌表';
comment on column lf.sys_token.id is '主键ID';
@@ -311,7 +314,7 @@
select * from lf.sys_user where id=(select create_user from lf.sys_token where token='91cf74dc-1d03-4937-983f-88810589b112' and expire > now() limit 1);
select * from lf.sys_token; select * from lf.sys_token_2022; select * from lf.sys_token_2023; select now()::timestamp + '1 year 4 hour';
----------------------------------------------------------------------------------------------------- 8.资源表
----------------------------------------------------------------------------------------------------- 08.资源表
-- DROP TABLE IF EXISTS lf.sys_res;
create table lf.sys_res(
  id serial primary key,
@@ -344,11 +347,11 @@
comment on column lf.sys_res.update_user is '更新人ID';
comment on column lf.sys_res.update_time is '更新时间';
comment on column lf.sys_res.bak is '备注';
--insert into lf.sys_res (name) values ('天地图影像');
--insert into lf.sys_res (name) values ('天地图矢量');
/* insert into lf.sys_res (name) values ('天地图影像');
insert into lf.sys_res (name) values ('天地图矢量'); */
select * from lf.sys_res;
----------------------------------------------------------------------------------------------------- 9.资源操作表
----------------------------------------------------------------------------------------------------- 09.资源操作表
-- DROP TABLE IF EXISTS lf.sys_res_op;
create table lf.sys_res_op(
  id serial8,
@@ -362,15 +365,15 @@
create table lf.sys_res_op_2022 partition of lf.sys_res_op for values from ('2022-01-01') to ('2023-01-01');
create INDEX index_sys_res_op_2022_optime on lf.sys_res_op_2022 (optime);
create table lf.sys_res_op_2023 partition of lf.sys_res_op for values from ('2023-01-01') to ('2024-01-01');
create INDEX index_sys_res_op_2023_optime on lf.sys_res_op_2022 (optime);
create INDEX index_sys_res_op_2023_optime on lf.sys_res_op_2023 (optime);
create table lf.sys_res_op_2024 partition of lf.sys_res_op for values from ('2024-01-01') to ('2025-01-01');
create INDEX index_sys_res_op_2024_optime on lf.sys_res_op_2022 (optime);
create INDEX index_sys_res_op_2024_optime on lf.sys_res_op_2024 (optime);
create table lf.sys_res_op_2025 partition of lf.sys_res_op for values from ('2025-01-01') to ('2026-01-01');
create INDEX index_sys_res_op_2025_optime on lf.sys_res_op_2022 (optime);
create INDEX index_sys_res_op_2025_optime on lf.sys_res_op_2025 (optime);
create table lf.sys_res_op_2026 partition of lf.sys_res_op for values from ('2026-01-01') to ('2027-01-01');
create INDEX index_sys_res_op_2026_optime on lf.sys_res_op_2022 (optime);
create INDEX index_sys_res_op_2026_optime on lf.sys_res_op_2026 (optime);
create table lf.sys_res_op_2027 partition of lf.sys_res_op for values from ('2027-01-01') to ('2028-01-01');
create INDEX index_sys_res_op_2027_optime on lf.sys_res_op_2022 (optime);
create INDEX index_sys_res_op_2027_optime on lf.sys_res_op_2027 (optime);
comment on table lf.sys_res_op is '资源操作表';
comment on column lf.sys_res_op.id is '主键ID';
@@ -437,7 +440,7 @@
comment on column lf.sys_role.depid is '单位ID';
comment on column lf.sys_role.name is '名称';
comment on column lf.sys_role.descr is '描述';
comment on column lf.sys_role.is_admin is '是否为管理员:0-否,1-是';
comment on column lf.sys_role.is_admin is '是/否为管理员:0-普通会员,1-超级管理员,2-数据管理员';
comment on column lf.sys_role.create_user is '创建人ID';
comment on column lf.sys_role.create_time is '创建时间';
comment on column lf.sys_role.update_user is '更新人ID';
@@ -537,82 +540,55 @@
select * from lf.sys_role_menu_auth;
----------------------------------------------------------------------------------------------------- 16.元数据表
-- DROP TABLE IF EXISTS lf.sys_meta;
create table lf.sys_meta(
create table lf.sys_meta (
  id serial primary key,
  name varchar(256),
  eventid varchar(38) default new_guid(),
  metaid integer default 0,
  dirid integer default 0,
  depid integer default 0,
  verid integer default 0,
  name varchar(256),
  type varchar(100),
  guid varchar(38) default new_guid(),
  path varchar(512),
  sizes float8 default 0,
  cs varchar(50),
  scale varchar(50),
  resolution varchar(50),
  gather timestamp(6) without time zone,
  descr varchar(256),
  tab varchar(50),
  layer varchar(50),
  rows integer,
  create_user integer default 1,
  create_time timestamp(6) without time zone default now(),
  update_user integer,
  update_time timestamp(6) without time zone,
  geom geometry default null,
  CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 2),
  CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POLYGON'::text OR geom IS NULL),
  CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 4490)
  bak varchar(1024),
  geom geometry(MultiPolygon, 4490)
);
-- drop index index_sys_meta_geom;
create index index_sys_meta_geom on lf.sys_meta using GIST (geom);
comment on table lf.sys_meta is '元数据表';
comment on column lf.sys_meta.id is '主键ID';
comment on column lf.sys_meta.name is '名称';
comment on column lf.sys_meta.eventid is 'GUID';
comment on column lf.sys_meta.metaid is '父元数据ID:0-没有';
comment on column lf.sys_meta.dirid is '目录ID';
comment on column lf.sys_meta.depid is '单位ID';
comment on column lf.sys_meta.verid is '版本ID';
comment on column lf.sys_meta.type is '格式';
comment on column lf.sys_meta.name is '名称';
comment on column lf.sys_meta.type is '类型:file-文件,shp-ShapeFile,gdb-GDB,zip-压缩包';
comment on column lf.sys_meta.guid is '文件GUID';
comment on column lf.sys_meta.path is '存储路径';
comment on column lf.sys_meta.sizes is '大小:单位MB';
comment on column lf.sys_meta.cs is '坐标系';
comment on column lf.sys_meta.scale is '比例尺';
comment on column lf.sys_meta.resolution is '分辨率';
comment on column lf.sys_meta.gather is '采集日期';
comment on column lf.sys_meta.descr is '描述';
comment on column lf.sys_meta.tab is '表名';
comment on column lf.sys_meta.layer is '图层';
comment on column lf.sys_meta.rows is '行数';
comment on column lf.sys_meta.create_user is '创建人ID';
comment on column lf.sys_meta.create_time is '创建时间';
comment on column lf.sys_meta.update_user is '更新人ID';
comment on column lf.sys_meta.update_time is '更新时间';
comment on column lf.sys_meta.bak is '备注';
comment on column lf.sys_meta.geom is '空间位置';
-- insert into lf.sys_meta(dirid,depid,name,geom,sizes) values (1,1,'Test',ST_PolygonFromText('POLYGON ((100 0,120 0,120 20,100 20,100 0))',4490),0.001);
-- insert into lf.sys_meta(dirid,depid,geom,sizes,name,path) values (1,1,ST_PolygonFromText('MultiPolygon (((100 0,120 0,120 20,100 20,100 0)))', 4490),0.001,'a.jpg','c:\a.jpg');
select * from lf.sys_meta; select id,name,dirid,depid,verid,type,sizes,descr,create_user,create_time,update_user,update_time,st_astext(geom) from lf.sys_meta;
----------------------------------------------------------------------------------------------------- 17.元数据文件表
-- DROP TABLE IF EXISTS lf.sys_meta_file;
create table lf.sys_meta_file(
  id serial primary key,
  name varchar(256),
  metaid integer,
  fileid integer default 0,
  guid varchar(40) default new_guid(),
  path varchar(512),
  sizes float default 0,
  create_user integer default 1,
  create_time timestamp(6) without time zone default now(),
  update_user integer,
  update_time timestamp(6) without time zone
);
comment on table lf.sys_meta_file is '元数据文件表';
comment on column lf.sys_meta_file.id is '主键ID';
comment on column lf.sys_meta_file.name is '文件名';
comment on column lf.sys_meta_file.metaid is '元数据ID';
comment on column lf.sys_meta_file.fileid is '父文件ID:0-没有';
comment on column lf.sys_meta_file.guid is '文件ID';
comment on column lf.sys_meta_file.path is '存储路径';
comment on column lf.sys_meta_file.sizes is '文件大小:单位MB';
comment on column lf.sys_meta_file.create_user is '创建人ID';
comment on column lf.sys_meta_file.create_time is '创建时间';
comment on column lf.sys_meta_file.update_user is '更新人ID';
comment on column lf.sys_meta_file.update_time is '更新时间';
-- insert into lf.sys_meta_file (metaid,name,path) values (1,'a.jpg','c:\a.jpg');
select * from lf.sys_meta_file;
----------------------------------------------------------------------------------------------------- 18.附件表
select a.*,st_astext(geom) from lf.sys_meta a; select id,name,dirid,depid,verid,type,sizes,create_user,create_time,update_user,update_time,st_astext(geom) from lf.sys_meta;
----------------------------------------------------------------------------------------------------- 17.附件表
-- DROP TABLE IF EXISTS lf.sys_attach;
create table lf.sys_attach(
  id serial primary key,
@@ -640,12 +616,10 @@
comment on column lf.sys_attach.update_user is '更新人ID';
comment on column lf.sys_attach.update_time is '更新时间';
--insert into lf.sys_attach (name,tab,path) values ('a.jpg','public.data_dir','c:\a.jpg');
--alter table lf.sys_attach add tab_guid varchar(40);
--alter table lf.sys_attach add sizes bigint default 0;
--alter table lf.sys_attach alter column sizes type float8;
select * from lf.sys_attach; select length(guid) from lf.sys_attach limit 1; select * from lf.sys_attach;
----------------------------------------------------------------------------------------------------- 19.版本表
----------------------------------------------------------------------------------------------------- 18.版本表
-- DROP TABLE IF EXISTS lf.sys_ver;
create table lf.sys_ver(
  id serial primary key,
@@ -666,10 +640,11 @@
comment on column lf.sys_ver.create_time is '创建时间';
comment on column lf.sys_ver.update_user is '更新人ID';
comment on column lf.sys_ver.update_time is '更新时间';
insert into lf.sys_ver (id,dirid,name) values (0,0,'默认');
--insert into lf.sys_ver (dirid,name) values (1003,'2020-02-01');
select * from lf.sys_ver;
----------------------------------------------------------------------------------------------------- 20.数据字典表
select * from lf.sys_ver order by id;
----------------------------------------------------------------------------------------------------- 19.数据字典表
-- DROP TABLE IF EXISTS lf.sys_dict;
create table lf.sys_dict(
  id serial primary key,
@@ -690,7 +665,8 @@
  unit varchar(50),
  domain_na varchar(100),
  showtype smallint,
  editable smallint,
  editable smallint,
  status smallint default 0,
  bak varchar(1024) 
);
comment on table lf.sys_dict is '附件表';
@@ -713,15 +689,14 @@
comment on column lf.sys_dict.domain_na is '值域名称';
comment on column lf.sys_dict.showtype is '显示类型';
comment on column lf.sys_dict.editable is '是否可编辑';
comment on column lf.sys_dict.status is '状态:0-正常,1-删除,-1-废弃';
comment on column lf.sys_dict.bak is '备注';
/* alter sequence lf.sys_dict_id_seq restart with 300;
update lf.sys_dict set create_user=1,create_time=now() where 1=1;
update lf.sys_dict set bak=null where bak=' '; */
-- alter sequence lf.sys_dict_id_seq restart with 300;
select count(*) from lf.sys_dict where tab='sys_user';
select count(*) from lf.sys_dict where status=0 and tab='sys_user';
select * from lf.sys_dict order by ns,tab,order_num limit 10 offset 0;
select distinct ns,tab,fn_get_entity(tab) entity,tab_desc,tabletype from lf.sys_dict order by tab;
----------------------------------------------------------------------------------------------------- 21.样式表
----------------------------------------------------------------------------------------------------- 20.样式表
-- DROP TABLE IF EXISTS lf.sys_style;
create table lf.sys_style(
  id serial primary key,
@@ -762,13 +737,14 @@
select count(*) from lf.sys_style where name like '%.edp';
select * from lf.sys_style order by ns,tab,order_num limit 10 offset 0;
----------------------------------------------------------------------------------------------------- 22.下载记录表
----------------------------------------------------------------------------------------------------- 21.下载记录表
-- DROP TABLE IF EXISTS lf.sys_download;
create table lf.sys_download(
  id serial primary key,
  name varchar(50),
  type smallint default 1,
  depid integer default 1,
  sizes float8 default 0,
  dcount integer default 0,
  pwd varchar(200),
  url varchar(512),
@@ -788,8 +764,9 @@
comment on table lf.sys_download is '下载记录表';
comment on column lf.sys_download.id is '主键ID';
comment on column lf.sys_download.name is '名称';
comment on column lf.sys_download.type is '类型:1-ShapeFile,2-专题图';
comment on column lf.sys_download.type is '类型:1-Shp文件,2-专题图,3-元数据,4-业务数据,5-管道分析';
comment on column lf.sys_download.depid is '单位ID';
comment on column lf.sys_download.sizes is '文件大小:单位MB';
comment on column lf.sys_download.dcount is '下载次数';
comment on column lf.sys_download.pwd is 'MD5';
comment on column lf.sys_download.url is '下载地址';
@@ -803,8 +780,8 @@
comment on column lf.sys_download.geom is '空间位置';
-- insert into lf.sys_download (name,pwd,url,descr) values ('2022-09-27','123456','','测试下载');
select * from lf.sys_download;
----------------------------------------------------------------------------------------------------- 23.消息通知表
select * from lf.sys_download order by id;
----------------------------------------------------------------------------------------------------- 22.消息通知表
-- DROP TABLE IF EXISTS lf.sys_msg;
create table lf.sys_msg(
  id serial primary key,
@@ -828,7 +805,7 @@
--insert into lf.sys_msg (title,msg,guid,update_user) values ('2022-09-26','数据下载',new_guid(),2);
select * from lf.sys_msg;
----------------------------------------------------------------------------------------------------- 24.参数设置表
----------------------------------------------------------------------------------------------------- 23.参数设置表
-- DROP TABLE IF EXISTS lf.sys_args;
create table lf.sys_args(
  id serial primary key,
@@ -866,10 +843,12 @@
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,times,descr,mark) values ('缓存有效期',240,240,60,1440,1,'缓存默认有效期为240分钟,超时将失效。','CACHE_EXPIRE');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,times,descr,mark) values ('最大文件数',2000,2000,500,2500,1,'单个文件夹下默认最大存储文件的数目为2000个。','MAX_FILES');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,times,descr,mark) values ('Cookie有效期',240,240,60,43200,60,'Cookie默认有效期为240分钟,超时将失效。','COOKIE_MAX_AGE');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,times,descr,mark) values ('附件大小',50,50,5,1024,1048576,'单个附件大小默认最大为50MB。','MAX_FILE_SIZE'); */
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,times,descr,mark) values ('附件大小',50,50,5,1024,1048576,'单个附件大小默认最大为50MB。','MAX_FILE_SIZE');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,times,descr,mark) values ('用户访问量',5000,5000,5,1000000,1,'当超出用户访问量时,就拒绝登录。','MAX_USER_LOGIN');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,times,descr,mark) values ('服务上限',5000,5000,5,1000000,1,'当超出服务上限时,就拒绝访问。','MAX_SERVERS'); */
select * from lf.sys_args;
----------------------------------------------------------------------------------------------------- 25.黑名单表
select * from lf.sys_args order by id;
----------------------------------------------------------------------------------------------------- 24.黑名单表
-- DROP TABLE IF EXISTS lf.sys_blacklist;
create table lf.sys_blacklist(
  id serial primary key,
@@ -892,11 +871,14 @@
comment on column lf.sys_blacklist.create_time is '创建时间';
comment on column lf.sys_blacklist.update_user is '更新人ID';
comment on column lf.sys_blacklist.update_time is '更新时间';
/* insert into lf.sys_blacklist (ip,type) values ('192.168.20.99',1);
insert into lf.sys_blacklist (ip,type) values ('127.0.0.1',2); */
/* insert into lf.sys_blacklist (ip,type) values ('192.168.20.1',1);
insert into lf.sys_blacklist (ip,type) values ('192.168.20.205',2);
insert into lf.sys_blacklist (ip,type) values ('127.0.0.1',2);
insert into lf.sys_blacklist (ip,type) values ('localhost',2);
insert into lf.sys_blacklist (ip,type) values ('0:0:0:0:0:0:0:1',2);*/
select * from lf.sys_blacklist;
----------------------------------------------------------------------------------------------------- 26.标绘表
----------------------------------------------------------------------------------------------------- 25.标绘表
-- DROP TABLE IF EXISTS lf.sys_mark;
create table lf.sys_mark(
  id serial primary key,
@@ -917,7 +899,7 @@
comment on column lf.sys_mark.update_time is '更新时间';
select * from lf.sys_mark;
----------------------------------------------------------------------------------------------------- 27.值域表
----------------------------------------------------------------------------------------------------- 26.值域表
-- drop table if exists lf.sys_domain;
create table if not exists lf.sys_domain(
    id serial primary key,
@@ -950,4 +932,215 @@
comment on column lf.sys_domain.bak is '备注';
select * from lf.sys_domain order by dom_name,orderid;
-----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------- 27.报告模板表
-- drop table if exists lf.sys_report;
create table if not exists lf.sys_report (
    id serial primary key,
    name varchar(100),
    type varchar(50),
    code varchar(50),
   fname varchar(256),
    guid varchar(38),
    create_user integer default 1,
    create_time timestamp(6) without time zone default now(),
    update_user integer,
    update_time timestamp(6) without time zone,
    bak varchar(1024)
);
comment on table lf.sys_report is '报告模板表';
comment on column lf.sys_report.id is '主键ID';
comment on column lf.sys_report.name is '名称';
comment on column lf.sys_report.type is '文件类型:1-Word模板,2-Excel模板';
comment on column lf.sys_report.code is '编码';
comment on column lf.sys_report.fname is '文件名';
comment on column lf.sys_report.guid is '文件GUID';
comment on column lf.sys_report.create_user is '创建人id';
comment on column lf.sys_report.create_time is '创建时间';
comment on column lf.sys_report.update_user is '更新人id';
comment on column lf.sys_report.update_time is '更新时间';
comment on column lf.sys_report.bak is '备注';
-- insert into lf.sys_report (name,type,guid,code) values ('统计用户量',2,'1\aa.xlsx','');
select * from lf.sys_report;
----------------------------------------------------------------------------------------------------- 28.下载日志表
-- drop table if exists lf.sys_downlog;
create table lf.sys_downlog (
    id serial primary key,
   downid integer default 0,
   ip varchar(30),
    create_user integer default 1,
    create_time timestamp(6) without time zone default now(),
    update_user integer,
    update_time timestamp(6) without time zone
);
comment on table lf.sys_downlog is '下载日志表';
comment on column lf.sys_downlog.id is '主键id';
comment on column lf.sys_downlog.ip is 'IP地址';
comment on column lf.sys_downlog.create_user is '创建人id';
comment on column lf.sys_downlog.create_time is '创建时间';
comment on column lf.sys_downlog.update_user is '更新人id';
comment on column lf.sys_downlog.update_time is '更新时间';
-- insert into lf.sys_downlog(downid,ip,create_user) values (100,'192.168.20.39',1);
select * from lf.sys_downlog;
----------------------------------------------------------------------------------------------------- 29.数据申请表
-- drop table if exists lf.sys_apply;
create table lf.sys_apply (
    id serial primary key,
   userid integer default 0,
   depids varchar(500),
   tabs varchar(2000),
   entities varchar(2000),
   wkt varchar(4000),
   pwd varchar(200),
   status integer default 0,
   count integer default 0,
   descr varchar(50),
    create_user integer default 1,
    create_time timestamp(6) without time zone default now(),
    update_user integer,
    update_time timestamp(6) without time zone
);
comment on table lf.sys_apply is '数据申请表';
comment on column lf.sys_apply.id is '主键ID';
comment on column lf.sys_apply.userid is '用户ID';
comment on column lf.sys_apply.depids is '单位ID';
comment on column lf.sys_apply.tabs is '表名';
comment on column lf.sys_apply.entities is '实体名';
comment on column lf.sys_apply.wkt is 'WKT';
comment on column lf.sys_apply.pwd is '密码';
comment on column lf.sys_apply.status is '状态:-10-作废,-1-打回,0~9-审核中,10-通过';
comment on column lf.sys_apply.count is '审核总数';
comment on column lf.sys_apply.descr is '描述';
comment on column lf.sys_apply.create_user is '创建人id';
comment on column lf.sys_apply.create_time is '创建时间';
comment on column lf.sys_apply.update_user is '更新人id';
comment on column lf.sys_apply.update_time is '更新时间';
select * from lf.sys_apply;
----------------------------------------------------------------------------------------------------- 30.申请流程表
-- drop table if exists lf.sys_flow;
create table lf.sys_flow (
    id serial primary key,
   applyid integer,
   depid integer,
   userid integer,
   status integer default 0,
   descr varchar(50),
    create_user integer default 1,
    create_time timestamp(6) without time zone default now(),
    update_user integer,
    update_time timestamp(6) without time zone
);
comment on table lf.sys_flow is '申请流程表';
comment on column lf.sys_flow.id is '主键id';
comment on column lf.sys_flow.applyid is '申请ID';
comment on column lf.sys_flow.depid is '单位ID';
comment on column lf.sys_flow.userid is '用户ID';
comment on column lf.sys_flow.status is '状态:-1-打回,0-待审核,1-通过';
comment on column lf.sys_flow.descr is '描述';
comment on column lf.sys_flow.create_user is '创建人id';
comment on column lf.sys_flow.create_time is '创建时间';
comment on column lf.sys_flow.update_user is '更新人id';
comment on column lf.sys_flow.update_time is '更新时间';
select * from lf.sys_flow;
----------------------------------------------------------------------------------------------------- 31.FME日志表
create table lf.sys_fme_log (
  id serial primary key,
  parentid varchar(38),
  dirpath varchar(1024),
  pg_ns varchar(10),
  tcmc varchar(150),
  tcdm varchar(50),
  count integer default 0,
  create_time timestamp(6) without time zone default now()
);
comment on table lf.sys_fme_log is 'FME日志表';
comment on column lf.sys_fme_log.id is '主键ID';
comment on column lf.sys_fme_log.parentid is '父表GUID';
comment on column lf.sys_fme_log.dirpath is '文件路径';
comment on column lf.sys_fme_log.pg_ns is '表架构';
comment on column lf.sys_fme_log.tcmc is '图层名称';
comment on column lf.sys_fme_log.tcdm is '表名';
comment on column lf.sys_fme_log.count is '行数';
comment on column lf.sys_fme_log.create_time is '创建时间';
select * from lf.sys_fme_log; -- delete from lf.sys_fme_log;
----------------------------------------------------------------------------------------------------- 32.图层表
-- DROP TABLE IF EXISTS lf.sys_layer;
create table lf.sys_layer(
  id serial primary key,
  pid integer,
  cn_name varchar(50),
  en_name varchar(50),
  url varchar(512),
  test_url 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(1024)
);
comment on table lf.sys_layer is '图层表';
comment on column lf.sys_layer.id is '主键ID';
comment on column lf.sys_layer.pid is '父ID:0-根节点';
comment on column lf.sys_layer.cn_name is '中文名称';
comment on column lf.sys_layer.en_name is '英文名称';
comment on column lf.sys_layer.url is '图层地址';
comment on column lf.sys_layer.test_url is '测试地址';
comment on column lf.sys_layer.type is '类型:1-图层组,2-图层';
comment on column lf.sys_layer.icon is '图标';
comment on column lf.sys_layer.level is '层级:0-根节点';
comment on column lf.sys_layer.order_num is '排序号';
comment on column lf.sys_layer.is_show is '是否显示';
comment on column lf.sys_layer.create_user is '创建人ID';
comment on column lf.sys_layer.create_time is '创建时间';
comment on column lf.sys_layer.update_user is '更新人ID';
comment on column lf.sys_layer.update_time is '更新时间';
comment on column lf.sys_layer.bak is '备注';
select * from lf.sys_layer;
----------------------------------------------------------------------------------------------------- 33.服务日志表
-- DROP TABLE IF EXISTS lf.sys_serve_log;
create table lf.sys_serve_log(
  id serial8,
  resid integer,
  name varchar(100),
  type varchar(50),
  url varchar(4096),
  create_user integer,
  create_time timestamp(6) without time zone default now(),
  bak varchar(1024)
) partition by range(create_time);
create table lf.sys_serve_log_2023 partition of lf.sys_serve_log for values from ('2023-01-01') to ('2024-01-01');
create INDEX index_sys_serve_log_2023_optime on lf.sys_serve_log_2023 (create_time);
create table lf.sys_serve_log_2024 partition of lf.sys_serve_log for values from ('2024-01-01') to ('2025-01-01');
create INDEX index_sys_serve_log_2024_optime on lf.sys_serve_log_2024 (create_time);
create table lf.sys_serve_log_2025 partition of lf.sys_serve_log for values from ('2025-01-01') to ('2026-01-01');
create INDEX index_sys_serve_log_2025_optime on lf.sys_serve_log_2025 (create_time);
create table lf.sys_serve_log_2026 partition of lf.sys_serve_log for values from ('2026-01-01') to ('2027-01-01');
create INDEX index_sys_serve_log_2026_optime on lf.sys_serve_log_2026 (create_time);
create table lf.sys_serve_log_2027 partition of lf.sys_serve_log for values from ('2027-01-01') to ('2028-01-01');
create INDEX index_sys_serve_log_2027_optime on lf.sys_serve_log_2027 (create_time);
comment on table lf.sys_serve_log is '服务日志表';
comment on column lf.sys_serve_log.id is '主键ID';
comment on column lf.sys_serve_log.resid is '服务ID';
comment on column lf.sys_serve_log.name is '名称';
comment on column lf.sys_serve_log.type is '类型';
comment on column lf.sys_serve_log.url is '图层地址';
comment on column lf.sys_serve_log.create_user is '访问人ID';
comment on column lf.sys_serve_log.create_time is '访问时间';
comment on column lf.sys_serve_log.bak is '备注';
/* insert into lf.sys_serve_log (resid,name,type,url) values (1,'全国影像图','01','http://192.168.20.205/LFData/2d/tiles/img/{z}/{x}/{y}.png');
   insert into lf.sys_serve_log (resid,name,type,url) values (2,'全国矢量图','02','http://192.168.20.205/LFData/2d/tiles/vec/{z}/{x}/{y}.png'); */
select * from lf.sys_serve_log;
----------------------------------------------------------------------------------------------------- vacuum analyze md.md_zxcg;