管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-02 eb1af5f77f2c16e580173553e548ff4e41653e4e
data/db_tab.sql
@@ -36,9 +36,9 @@
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 sequence lf.sys_menu_id_seq restart with 45;
--alter sequence lf.sys_menu_id_seq restart with 44;
select * from lf.sys_menu order by id;
select * from lf.sys_menu order by order_num;
----------------------------------------------------------------------------------------------------- 2.单位表
-- DROP TABLE IF EXISTS lf.sys_dep;
create table lf.sys_dep(
@@ -207,8 +207,9 @@
comment on column lf.sys_login.descr is '描述';
comment on column lf.sys_login.userid is '登记人ID';
comment on column lf.sys_login.optime is '登记时间';
/*insert into lf.sys_login (appid,ip,userid) values (1,'192.168.20.106',1);
insert into lf.sys_login (appid,ip,userid,optime) values (1,'192.168.20.106',1,'2024-01-02');*/
/* insert into lf.sys_login (appid,ip,userid) values (1,'192.168.20.106',1);
insert into lf.sys_login (appid,ip,userid,optime) values (1,'192.168.20.106',1,'2024-01-02');
delete from lf.sys_login_2024; */
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;
@@ -253,8 +254,9 @@
comment on column lf.sys_operate.userid is '操作人ID';
comment on column lf.sys_operate.optime is '操作时间';
comment on column lf.sys_operate.bak is '备注';
/*insert into lf.sys_operate (modular,url,ip,type) values ('数据管理\目录管理','data/manage/update','192.168.20.106',5);
insert into lf.sys_operate (modular,url,ip,type,optime) values ('数据管理\目录管理','data/manage/delete','192.168.20.107',4,'2024-01-02');*/
/* insert into lf.sys_operate (modular,url,ip,type) values ('数据管理\目录管理','data/manage/update','192.168.20.106',5);
insert into lf.sys_operate (modular,url,ip,type,optime) values ('数据管理\目录管理','data/manage/delete','192.168.20.107',4,'2024-01-02');
delete from lf.sys_operate_2024; */
alter table lf.sys_operate add column modular1 varchar(50); alter table lf.sys_operate drop column modular;
select split_part(modular,'\',1),split_part(modular,'\',2) from lf.sys_operate;
@@ -301,8 +303,9 @@
comment on column lf.sys_token.create_time is '创建时间';
comment on column lf.sys_token.update_user is '更新人ID';
comment on column lf.sys_token.update_time is '更新时间';
/*insert into lf.sys_token (token,ip) values (new_guid(),'192.168.20.106');
insert into lf.sys_token (token,ip,expire,create_time) values (new_guid(),'192.168.20.107',now()::timestamp + '1 year 4 hour',now()::timestamp + '1 year');*/
/* insert into lf.sys_token (token,ip) values (new_guid(),'192.168.20.106');
insert into lf.sys_token (token,ip,expire,create_time) values (new_guid(),'192.168.20.107',now()::timestamp + '1 year 4 hour',now()::timestamp + '1 year');
delete from lf.sys_token_2023; */
select * from lf.sys_token where token='91cf74dc-1d03-4937-983f-88810589b112' and expire > now() limit 1;
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);
@@ -342,6 +345,7 @@
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 ('天地图矢量');
select * from lf.sys_res;
----------------------------------------------------------------------------------------------------- 9.资源操作表
@@ -371,13 +375,14 @@
comment on table lf.sys_res_op is '资源操作表';
comment on column lf.sys_res_op.id is '主键ID';
comment on column lf.sys_res_op.resid is '资源ID';
comment on column lf.sys_res_op.type is '操作类型:1-查看,2-新增,3-修改,4-删除,5-上传,6-下载';
comment on column lf.sys_res_op.type is '操作类型:1-查看,2-新增,3-修改,4-删除,5-上传,6-下载,7-统计';
comment on column lf.sys_res_op.ip is 'IP地址';
comment on column lf.sys_res_op.userid is '操作人ID';
comment on column lf.sys_res_op.optime is '创建时间';
/*insert into lf.sys_res_op (resid,ip,type) values (1,'192.168.20.106',5);
/* insert into lf.sys_res_op (resid,ip,type) values (1,'192.168.20.106',5);
insert into lf.sys_res_op (resid,ip,type) values (1,'192.168.20.106',1);
insert into lf.sys_res_op (resid,ip,type,optime) values (1,'192.168.20.107',4,'2024-01-02');*/
insert into lf.sys_res_op (resid,ip,type,optime) values (1,'192.168.20.107',4,'2024-01-02');
delete from lf.sys_res_op_2024; */
select a.*,b.uname,c.name from lf.sys_res_op a inner join lf.sys_user b on a.userid = b.id inner join lf.sys_res c on a.resid=c.id;
@@ -403,12 +408,14 @@
comment on column lf.sys_auth.update_user is '更新人ID';
comment on column lf.sys_auth.update_time is '更新时间';
comment on column lf.sys_auth.bak is '备注';
/*insert into lf.sys_auth (name,tag) values ('查看','select');
insert into lf.sys_auth (name,tag) values ('新增','insert');
insert into lf.sys_auth (name,tag) values ('修改','update');
insert into lf.sys_auth (name,tag) values ('删除','delete');
insert into lf.sys_auth (name,tag) values ('上传','upload');
insert into lf.sys_auth (name,tag) values ('下载','download');*/
/* insert into lf.sys_auth (name,tag) values ('查看','/select');
insert into lf.sys_auth (name,tag) values ('新增','/insert');
insert into lf.sys_auth (name,tag) values ('修改','/update');
insert into lf.sys_auth (name,tag) values ('删除','/delete');
insert into lf.sys_auth (name,tag) values ('上传','/upload');
insert into lf.sys_auth (name,tag) values ('下载','/download');
insert into lf.sys_auth (name,tag) values ('统计','/count');
alter sequence lf.sys_auth_id_seq restart with 8; */
select * from lf.sys_auth;
----------------------------------------------------------------------------------------------------- 11.角色表
@@ -418,6 +425,7 @@
  depid integer default 1,
  name varchar(100),
  descr varchar(100),
  is_admin integer default 0,
  create_user integer default 1,
  create_time timestamp(6) without time zone default now(),
  update_user integer,
@@ -429,12 +437,13 @@
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.create_user is '创建人ID';
comment on column lf.sys_role.create_time is '创建时间';
comment on column lf.sys_role.update_user is '更新人ID';
comment on column lf.sys_role.update_time is '更新时间';
comment on column lf.sys_role.bak is '备注';
--insert into lf.sys_role (depid,name,descr) values (1,'Admin','系统管理员');
--insert into lf.sys_role (id,depid,name,descr,is_admin) values (1,1,'Admin','系统管理员',1);
select * from lf.sys_role;
select a.*,b.name depname from lf.sys_role a inner join lf.sys_dep b on a.depid = b.id order by a.id limit 10 offset 0;
@@ -501,10 +510,10 @@
comment on column lf.sys_menu_auth.create_time is '创建时间';
comment on column lf.sys_menu_auth.update_user is '更新人ID';
comment on column lf.sys_menu_auth.update_time is '更新时间';
--insert into lf.sys_menu_auth (menuid,authid) values (1,1);
--insert into lf.sys_menu_auth (menuid,authid) values (1,1),(1,2),(1,3),(1,4),(1,5);
select * from lf.sys_menu_auth;
----------------------------------------------------------------------------------------------------- 14.角色-菜单-权限表
----------------------------------------------------------------------------------------------------- 15.角色-菜单-权限表
-- DROP TABLE IF EXISTS lf.sys_role_menu_auth;
create table lf.sys_role_menu_auth(
  id serial primary key,
@@ -530,57 +539,59 @@
-- DROP TABLE IF EXISTS lf.sys_meta;
create table lf.sys_meta(
  id serial primary key,
  dirid integer,
  depid integer,
  name varchar(256),
  format varchar(100),
  fsize bigint default 0,
  dirid integer default 0,
  depid integer default 0,
  verid integer default 0,
  type varchar(100),
  sizes float8 default 0,
  cs varchar(50),
  fscale varchar(50),
  scale varchar(50),
  resolution varchar(50),
  gather timestamp(6) without time zone,
  descr varchar(256),
  guid varchar(40) default null,
  create_user integer default 1,
  create_time timestamp(6) without time zone default now(),
  update_user integer,
  update_time timestamp(6) without time zone,
  geo geometry default null,
  CONSTRAINT enforce_dims_geom CHECK (st_ndims(geo) = 2),
  CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geo) = 'POLYGON'::text OR geo IS NULL),
  CONSTRAINT enforce_srid_geom CHECK (st_srid(geo) = 4490)
  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)
);
create index index_sys_meta_geo on lf.sys_meta using gist (geo);
-- 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.dirid is '目录ID';
comment on column lf.sys_meta.depid is '单位ID';
comment on column lf.sys_meta.name is '名称';
comment on column lf.sys_meta.format is '格式';
comment on column lf.sys_meta.fsize is '大小:单位为kb';
comment on column lf.sys_meta.verid is '版本ID';
comment on column lf.sys_meta.type is '格式';
comment on column lf.sys_meta.sizes is '大小:单位MB';
comment on column lf.sys_meta.cs is '坐标系';
comment on column lf.sys_meta.fscale 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.guid is '文件ID';
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.geo is '空间';
--insert into lf.sys_meta(dirid,depid,name,geo) values (1,1,'Test',ST_PolygonFromText('POLYGON ((100 0,120 0,120 20,100 20,100 0))',4490));
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);
select id,dirid,depid,name,descr,guid,create_user,create_time,update_user,update_time,st_astext(geo) from lf.sys_meta;
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,
  metaid integer,
  name varchar(256),
  metaid integer,
  fileid integer default 0,
  guid varchar(40) default new_guid(),
  path varchar(512),
  fileid integer default 0,
  sizes float default 0,
  create_user integer default 1,
  create_time timestamp(6) without time zone default now(),
  update_user integer,
@@ -588,16 +599,17 @@
);
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.metaid 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.fileid is '父文件ID:0-没有';
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');
-- insert into lf.sys_meta_file (metaid,name,path) values (1,'a.jpg','c:\a.jpg');
select * from lf.sys_meta_file;
----------------------------------------------------------------------------------------------------- 18.附件表
@@ -606,8 +618,10 @@
  id serial primary key,
  name varchar(256),
  tab varchar(100),
  tab_guid varchar(40),
  guid varchar(40) default new_guid(),
  path varchar(512),
  sizes float8 default 0;
  create_user integer default 1,
  create_time timestamp(6) without time zone default now(),
  update_user integer,
@@ -617,15 +631,20 @@
comment on column lf.sys_attach.id is '主键ID';
comment on column lf.sys_attach.name is '文件名';
comment on column lf.sys_attach.tab is '表名:如 public.data_dir';
comment on column lf.sys_attach.tab_guid is '表ID';
comment on column lf.sys_attach.guid is '文件ID';
comment on column lf.sys_attach.path is '存储路径';
comment on column lf.sys_attach.sizes is '文件大小:单位MB';
comment on column lf.sys_attach.create_user is '创建人ID';
comment on column lf.sys_attach.create_time is '创建时间';
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 length(guid) from lf.sys_attach limit 1; select * from lf.sys_attach;
select * from lf.sys_attach; select length(guid) from lf.sys_attach limit 1; select * from lf.sys_attach;
----------------------------------------------------------------------------------------------------- 19.版本表
-- DROP TABLE IF EXISTS lf.sys_ver;
create table lf.sys_ver(
@@ -667,6 +686,11 @@
  create_time timestamp(6) without time zone default now(),
  update_user integer,
  update_time timestamp(6) without time zone,
  tabletype varchar(20),
  unit varchar(50),
  domain_na varchar(100),
  showtype smallint,
  editable smallint,
  bak varchar(1024) 
);
comment on table lf.sys_dict is '附件表';
@@ -684,6 +708,11 @@
comment on column lf.sys_dict.create_time is '创建时间';
comment on column lf.sys_dict.update_user is '更新人ID';
comment on column lf.sys_dict.update_time is '更新时间';
comment on column lf.sys_dict.tabletype is '表类型';
comment on column lf.sys_dict.unit is '单位';
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.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;
@@ -691,6 +720,7 @@
select count(*) from lf.sys_dict where tab='sys_user';
select * from lf.sys_dict order by ns,tab,order_num limit 10 offset 0;
select distinct ns,fn_get_entity(tab) tab,tab_desc,tabletype from lf.sys_dict order by tab;
----------------------------------------------------------------------------------------------------- 21.样式表
-- DROP TABLE IF EXISTS lf.sys_style;
create table lf.sys_style(
@@ -748,13 +778,13 @@
  create_time timestamp(6) without time zone default now(),
  download_user integer,
  download_time timestamp(6) without time zone,
  geo geometry default null,
  geom geometry default null,
  bak varchar(1024)
  CONSTRAINT enforce_dims_geom CHECK (st_ndims(geo) = 2),
  CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geo) = 'POLYGON'::text OR geo IS NULL),
  CONSTRAINT enforce_srid_geom CHECK (st_srid(geo) = 4490)
  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)
);
create index index_sys_download_geo on lf.sys_download using gist (geo);
create index index_sys_download_geom on lf.sys_download using gist (geom);
comment on table lf.sys_download is '下载记录表';
comment on column lf.sys_download.id is '主键ID';
comment on column lf.sys_download.name is '名称';
@@ -769,8 +799,8 @@
comment on column lf.sys_download.create_time is '创建时间';
comment on column lf.sys_download.download_user is '下载人ID';
comment on column lf.sys_download.download_time is '下载时间';
comment on column lf.sys_download.geo is '空间';
comment on column lf.sys_download.bak is '备注';
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;
@@ -807,6 +837,7 @@
  dvalue integer default 0,
  min_value integer default 0,
  max_value integer default 0,
  times integer default 1,
  descr varchar(256),
  mark varchar(50),
  create_user integer default 1,
@@ -821,25 +852,28 @@
comment on column lf.sys_args.dvalue is '默认值';
comment on column lf.sys_args.min_value is '最小值';
comment on column lf.sys_args.max_value is '最大值';
comment on column lf.sys_args.times is '倍数';
comment on column lf.sys_args.descr is '描述';
comment on column lf.sys_args.mark is '标识';
comment on column lf.sys_args.create_user is '创建人ID';
comment on column lf.sys_args.create_time is '创建时间';
comment on column lf.sys_args.update_user is '更新人ID';
comment on column lf.sys_args.update_time is '更新时间';
/* insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,descr,mark) values ('自动登出时间',15,15,3,1440,'默认用户15分钟不操作,就自动登出系统。','AUTO_LOGOUT');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,descr,mark) values ('令牌有效期',240,240,60,1440,'令牌默认有效期为240分钟,超时将失效。','TOKEN_EXPIRE');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,descr,mark) values ('缓存有效期',240,240,60,1440,'缓存默认有效期为240分钟,超时将失效。','CACHE_EXPIRE');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,descr,mark) values ('最大文件数',2000,2000,500,2500,'单个文件夹下默认最大存储文件的数目为2000个。','MAX_FILES');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,descr,mark) values ('Cookie有效期',240,240,60,43200,'Cookie默认有效期为240分钟,超时将失效。','COOKIE_MAX_AGE');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,descr,mark) values ('附件大小',50,50,5,1024,'单个附件大小默认最大为50MB。','MAX_FILE_SIZE'); */
/* insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,times,descr,mark) values ('密码出错次数',5,5,3,20,1,'默认用户密码连续输入出错5次,就暂时拒绝登录。','PWD_ERR_COUNT');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,times,descr,mark) values ('密码出错等待时间',5,5,1,60,1,'默认用户密码连续输入多次出错时,5分钟内拒绝登录。','PWD_ERR_TIME');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,times,descr,mark) values ('自动登出时间',15,15,3,1440,1,'默认用户15分钟不操作,就自动登出系统。','AUTO_LOGOUT');
insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,times,descr,mark) values ('令牌有效期',240,240,60,1440,1,'令牌默认有效期为240分钟,超时将失效。','TOKEN_EXPIRE');
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'); */
select * from lf.sys_args;
----------------------------------------------------------------------------------------------------- 25.黑名单表
-- DROP TABLE IF EXISTS lf.sys_blacklist;
create table lf.sys_blacklist(
  id serial primary key,
  ip varchar(50),
  ip varchar(50) unique,
  type smallint default 1,
  visit integer default 0,
  descr varchar(50),
@@ -862,4 +896,25 @@
insert into lf.sys_blacklist (ip,type) values ('127.0.0.1',2); */
select * from lf.sys_blacklist;
----------------------------------------------------------------------------------------------------- 26.标绘表
-- DROP TABLE IF EXISTS lf.sys_mark;
create table lf.sys_mark(
  id serial primary key,
  name varchar(50),
  wkt text,
  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_mark is '标绘表';
comment on column lf.sys_mark.id is '主键ID';
comment on column lf.sys_mark.name is '名称';
comment on column lf.sys_mark.wkt is 'WKT';
comment on column lf.sys_mark.create_user is '创建人ID';
comment on column lf.sys_mark.create_time is '创建时间';
comment on column lf.sys_mark.update_user is '更新人ID';
comment on column lf.sys_mark.update_time is '更新时间';
select * from lf.sys_mark;
-----------------------------------------------------------------------------------------------------