管道基础大数据平台系统开发-【后端】-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,
@@ -37,13 +39,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 url type varchar(1024);
--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,
@@ -87,11 +87,11 @@
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 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,
@@ -123,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,
@@ -168,16 +168,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,
@@ -218,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,
@@ -269,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,
@@ -316,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,
@@ -349,11 +349,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,
@@ -542,7 +542,7 @@
select * from lf.sys_role_menu_auth;
----------------------------------------------------------------------------------------------------- 16.元数据表
-- DROP TABLE IF EXISTS lf.sys_meta;
create table lf.sys_meta_new (
create table lf.sys_meta (
  id serial primary key,
  eventid varchar(38) default new_guid(),
  metaid integer default 0,
@@ -555,7 +555,8 @@
  path varchar(512),
  sizes float8 default 0,
  tab varchar(50),
  rows integer default 0,
  layer varchar(50),
  rows integer,
  create_user integer default 1,
  create_time timestamp(6) without time zone default now(),
  update_user integer,
@@ -578,6 +579,7 @@
comment on column lf.sys_meta.path is '存储路径';
comment on column lf.sys_meta.sizes is '大小:单位MB';
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 '创建时间';
@@ -586,10 +588,9 @@
comment on column lf.sys_meta.bak is '备注';
comment on column lf.sys_meta.geom is '空间位置';
-- 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');
-- alter table lf.sys_meta rename column bstab to tab; alter table lf.sys_meta drop column mdtab;
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,
@@ -617,12 +618,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,
@@ -647,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,
@@ -668,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 '附件表';
@@ -691,15 +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;
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,
@@ -711,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(),
@@ -729,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 '创建时间';
@@ -740,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,
@@ -782,10 +785,9 @@
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','','测试下载');
-- alter table lf.sys_download add sizes float8 default 0;
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,
@@ -809,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,
@@ -847,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,
@@ -873,11 +877,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,
@@ -898,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,
@@ -931,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,
@@ -1002,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,
@@ -1037,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,
@@ -1064,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),
@@ -1072,7 +1059,8 @@
  pg_ns varchar(10),
  tcmc varchar(150),
  tcdm varchar(50),
  count integer default 0
  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';
@@ -1082,61 +1070,83 @@
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;
----------------------------------------------------------------------------------------------------- 元数据测试表 *
-- drop table if exists md.md_zxcg;
create table md.md_zxcg(
  gid serial primary key,
  zh varchar(50),
  zj float8,
  lc float8,
  x float8,
  y float8,
  z float8,
  createuser integer,
  createtime timestamp(6) without time zone default now(),
  updateuser integer,
  updatetime timestamp(6) without time zone,
  geom geometry(Point, 4490)
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)
);
create index if not exists md_zxcg_geom_idx on md.md_zxcg using gist (geom);
/*drop index if exists md_zxcg_geom_idx cascade;
comment on table md.md_zxcg is '中线成果表';
vacuum analyze md.md_zxcg;
insert into md.md_zxcg (zh, geom) values ('A01', ST_GeomFromText('POINT(95.80461853400004 34.13862467200005)'));
insert into md.md_zxcg (zh, geom) values ('A02', ST_GeomFromText('POINT(119.873000 39.392000)'));*/
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 gid,zh,ST_ASText(geom) from md.md_zxcg;
select * from md.md_zxcg;
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);
-- drop table if exists md.md_gdcg;
create table md.md_gdcg(
  gid serial primary key,
  bh varchar(100),
  gxdh varchar(100),
  ljdh varchar(100),
  msfs varchar(100),
  gxcl varchar(100),
  gjcc varchar(100),
  tz varchar(100),
  fsw varchar(100),
  x float8,
  y float8,
  dm float8,
  gd float8,
  gnd float8,
  ms float8,
  dngs varchar(100),
  gkpl varchar(100),
  dldy varchar(100),
  bz varchar(100),
  createuser integer,
  createtime timestamp(6) without time zone default now(),
  updateuser integer,
  updatetime timestamp(6) without time zone
);
comment on table md.md_gdcg is '管道成果表';
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);
select * from md.md_gdcg;
-----------------------------------------------------------------------------------------------------
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;