管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-11-02 eb1af5f77f2c16e580173553e548ff4e41653e4e
data/db_tab.sql
@@ -36,7 +36,7 @@
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 order_num;
----------------------------------------------------------------------------------------------------- 2.单位表
@@ -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);
@@ -372,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;
@@ -404,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.角色表
@@ -507,7 +513,7 @@
--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,
@@ -548,13 +554,13 @@
  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)
);
-- drop index index_sys_meta_geo;
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 '名称';
@@ -572,10 +578,10 @@
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,sizes) values (1,1,'Test',ST_PolygonFromText('POLYGON ((100 0,120 0,120 20,100 20,100 0))',4490),0.001);
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 * from lf.sys_meta; select id,name,dirid,depid,verid,type,sizes,descr,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(
@@ -680,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 '附件表';
@@ -697,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;
@@ -704,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(
@@ -761,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 '名称';
@@ -783,7 +800,7 @@
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.bak is '备注';
comment on column lf.sys_download.geo 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;
@@ -856,7 +873,7 @@
-- 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),
@@ -879,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;
-----------------------------------------------------------------------------------------------------