管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-11 35a5eec0d176b550fb0d7c5a0a5421b66f3b26c4
data/db_tab.sql
@@ -1,4 +1,6 @@
----------------------------------------------------------------------------------------------------- 1.菜单表
create sequence lf.sys_meta_id_seq increment  by 1 minvalue 1 maxvalue 2147483647 start 1 cache 1;
alter sequence lf.sys_layer_id_seq restart with 1;
----------------------------------------------------------------------------------------------------- 01.菜单表
-- DROP TABLE IF EXISTS lf.sys_menu;
create table lf.sys_menu(
  id serial primary key,
@@ -41,7 +43,7 @@
--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,
@@ -89,7 +91,7 @@
-- 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,
@@ -121,7 +123,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,
@@ -175,7 +177,7 @@
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,
@@ -216,7 +218,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,
@@ -267,7 +269,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,
@@ -314,7 +316,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,
@@ -351,7 +353,7 @@
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,
@@ -588,7 +590,7 @@
-- 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 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;
----------------------------------------------------------------------------------------------------- 18.附件表
----------------------------------------------------------------------------------------------------- 17.附件表
-- DROP TABLE IF EXISTS lf.sys_attach;
create table lf.sys_attach(
  id serial primary key,
@@ -619,7 +621,7 @@
--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,
@@ -644,7 +646,7 @@
--insert into lf.sys_ver (dirid,name) values (1003,'2020-02-01');
select * from lf.sys_ver order by id;
----------------------------------------------------------------------------------------------------- 20.数据字典表
----------------------------------------------------------------------------------------------------- 19.数据字典表
-- DROP TABLE IF EXISTS lf.sys_dict;
create table lf.sys_dict(
  id serial primary key,
@@ -665,7 +667,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 '附件表';
@@ -688,13 +691,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;
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,
@@ -706,7 +710,9 @@
  status smallint default 1,
  precision varchar(50),
  descr varchar(256),
  fname varchar(50),
  file_guid varchar(40) default new_guid(),
  vname varchar(50),
  view_guid varchar(40) default new_guid(),
  create_user integer default 1,
  create_time timestamp(6) without time zone default now(),
@@ -724,7 +730,9 @@
comment on column lf.sys_style.status is '状态:0-停用,1-启用';
comment on column lf.sys_style.precision is '精度:如 1:1000';
comment on column lf.sys_style.descr is '描述';
comment on column lf.sys_style.fname is '样式文件名';
comment on column lf.sys_style.file_guid is '样式文件ID';
comment on column lf.sys_style.vname is '预览文件名';
comment on column lf.sys_style.view_guid is '预览文件ID';
comment on column lf.sys_style.create_user is '创建人ID';
comment on column lf.sys_style.create_time is '创建时间';
@@ -735,7 +743,7 @@
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,
@@ -779,7 +787,7 @@
-- insert into lf.sys_download (name,pwd,url,descr) values ('2022-09-27','123456','','测试下载');
select * from lf.sys_download order by id;
----------------------------------------------------------------------------------------------------- 23.消息通知表
----------------------------------------------------------------------------------------------------- 22.消息通知表
-- DROP TABLE IF EXISTS lf.sys_msg;
create table lf.sys_msg(
  id serial primary key,
@@ -803,7 +811,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,
@@ -841,10 +849,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,
@@ -874,7 +884,7 @@
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,
@@ -895,7 +905,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,
@@ -928,57 +938,37 @@
comment on column lf.sys_domain.bak is '备注';
select * from lf.sys_domain order by dom_name,orderid;
----------------------------------------------------------------------------------------------------- 28.项目表
-- drop table if exists lf.sys_project;
create table if not exists lf.sys_project (
----------------------------------------------------------------------------------------------------- 27.报告模板表
-- drop table if exists lf.sys_report;
create table if not exists lf.sys_report (
    id serial primary key,
    dirid integer default 0,
    depid integer default 0,
    projname varchar(200),
    projtype varchar(50),
    location varchar(200),
    province varchar(50),
    country varchar(50),
    corpname varchar(200),
    department varchar(200),
    conperiod varchar(20),
    contents varchar(500),
    projstate varchar(50),
   remarks varchar(250),
    belongsid varchar(100),
    datastatus varchar(10),
    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,
    geom geometry(Point, 4490)
); -- drop index index_sys_project_geom;
create index index_sys_project_geom on lf.sys_project using gist (geom);
comment on table lf.sys_project is '项目表';
comment on column lf.sys_project.id is '主键id';
comment on column lf.sys_project.dirid is '目录id';
comment on column lf.sys_project.depid is '单位id';
comment on column lf.sys_project.projname is '项目名称';
comment on column lf.sys_project.projtype is '项目类型';
comment on column lf.sys_project.location is '地理位置';
comment on column lf.sys_project.province is '所属省份';
comment on column lf.sys_project.country is '所属国家';
comment on column lf.sys_project.corpname is '建设单位名称';
comment on column lf.sys_project.department is '主管部门';
comment on column lf.sys_project.conperiod is '建设工期';
comment on column lf.sys_project.contents is '工程内容';
comment on column lf.sys_project.projstate is '项目状态';
comment on column lf.sys_project.remarks is '备注';
comment on column lf.sys_project.belongsid is '权限代码';
comment on column lf.sys_project.datastatus is '数据状态';
comment on column lf.sys_project.create_user is '创建人id';
comment on column lf.sys_project.create_time is '创建时间';
comment on column lf.sys_project.update_user is '更新人id';
comment on column lf.sys_project.update_time is '更新时间';
comment on column lf.sys_project.geom is '空间位置';
    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_project;
----------------------------------------------------------------------------------------------------- 29.下载日志表
select * from lf.sys_report;
----------------------------------------------------------------------------------------------------- 28.下载日志表
-- drop table if exists lf.sys_downlog;
create table lf.sys_downlog (
    id serial primary key,
@@ -999,7 +989,7 @@
-- insert into lf.sys_downlog(downid,ip,create_user) values (100,'192.168.20.39',1);
select * from lf.sys_downlog;
----------------------------------------------------------------------------------------------------- 30.数据申请表
----------------------------------------------------------------------------------------------------- 29.数据申请表
-- drop table if exists lf.sys_apply;
create table lf.sys_apply (
    id serial primary key,
@@ -1034,7 +1024,7 @@
comment on column lf.sys_apply.update_time is '更新时间';
select * from lf.sys_apply;
----------------------------------------------------------------------------------------------------- 31.申请流程表
----------------------------------------------------------------------------------------------------- 30.申请流程表
-- drop table if exists lf.sys_flow;
create table lf.sys_flow (
    id serial primary key,
@@ -1061,7 +1051,7 @@
comment on column lf.sys_flow.update_time is '更新时间';
select * from lf.sys_flow;
----------------------------------------------------------------------------------------------------- 32.FME日志表
----------------------------------------------------------------------------------------------------- 31.FME日志表
create table lf.sys_fme_log (
  id serial primary key,
  parentid varchar(38),
@@ -1083,7 +1073,7 @@
comment on column lf.sys_fme_log.create_time is '创建时间';
select * from lf.sys_fme_log; -- delete from lf.sys_fme_log;
----------------------------------------------------------------------------------------------------- 33.图层表
----------------------------------------------------------------------------------------------------- 32.图层表
-- DROP TABLE IF EXISTS lf.sys_layer;
create table lf.sys_layer(
  id serial primary key,
@@ -1122,4 +1112,41 @@
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;