管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-04-11 4c882f00d9ee90d43a1c330683a612063ce64f04
data/db_cx.sql
@@ -1,34 +1,26 @@
st_length( st_geographyfromtext( st_astext( st_intersection( ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) ) ) AS acrossLength;
---------------------------------------------------------------------------------------------- -1.SQL测试
select case a.userid when 2 then guid else null end "guid", a.* from lf.sys_apply a order by id desc
select * from bs.s_explorationpoint where upper(exppointid) like '%XK0%';
select * from bs.s_survey_information; --勘察信息表,汉江穿越
alter table bs.s_survey_information add column workname varchar(50);
update bs.s_survey_information set workname='汉江穿越' where gid=1;
select * from bs.s_surveyworksite; --勘察工点
select * from lf.sys_download order by id desc;
select * from lf.sys_layer where url is not null and serve_type='WMS' and data_type in ('工程项目','工程项目-地灾类','工程项目-测量类','工程项目-洞库类','工程项目-勘察类') order by id;
select * from lf.sys_layer order by id desc limit 20;
insert into lf.sys_layer (pid,cn_name,en_name,url,type,level,order_num,is_show,create_user,serve_type,data_type,elev) values
  (423, '地面层', 'fushun_site', 'tileset/o/39HBFG/tileset.json', 2, 3, 5, 0, 1, 'Tileset', '工程测量模型', 1200);
update lf.sys_layer set elev=118,cn_name='地面层' where id=427;
select ST_AsText(geom) "geom", a.*, fn_get_fullname(a.depid, 1) depName, fn_get_fullname(a.dirid, 2) dirName, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_publish a
select concat(gb, '_', name) from bd.dlg_agnp limit 10;
select a.*, fn_uname(create_user) createName, fn_uname(update_user) updateName from lf.sys_dict a limit 10
select * from lf.sys_download where position('管道基础大数据平台' in descr)>0 order by id desc;
-- 删除冗余数据,修复tab_guid值
select id,name,path,tab,tab_guid from lf.sys_attach where tab != 'bd.b_borehole' order by id desc limit 200;
--delete from bs.s_explorationpointstratum where parentid in (select eventid from lf.sys_meta where name='勘探点地层表.xlsx');
select * from lf.sys_meta where type = 'tif' or type = 'tiff' or lower(name) in ('平面图索引文件.xlsx', '穿跨越地形图.dwg', '中线成果表.xlsx', '离散点.xlsx', '控制点.xlsx', '地面线.xlsx');
select * from lf.sys_meta_pub; -- delete from lf.sys_meta_pub where id = 3;
select ST_AsText(geom),a.* from lf.sys_publish a; -- delete from lf.sys_publish where id = 1;
select count(gid) from bd.b_rg20w_anna where 1=1;
select ST_AsText(geom) "geom", a.*, fn_get_fullname(a.depid, 1) depName, fn_get_fullname(a.dirid, 2) dirName, fn_uname(create_user) createName, fn_uname(update_user) updateName
from lf.sys_publish a
where id = 7
insert into lf.sys_meta_pub (id,metaid,pubid) values (1,1,1);
insert into lf.sys_publish (id,name,type,dirid,depid) values (1,'Test','3dml','0102','000305');
select a.* from lf.sys_publish a
select * from lf.sys_meta order by id desc limit 20;
-- delete from lf.sys_apply where id > 47; delete from lf.sys_flow where applyid > 47;
select * from lf.sys_publish order by id desc;
select * from lf.sys_download order by id desc limit 20; --downid
select * from lf.sys_apply order by id desc;
select * from lf.sys_flow order by id desc;
select * from lf.sys_meta order by id desc;
select depcode from lf.sys_meta where id in (1393,1392,1383,1382) and depcode not like '000305%' group by depcode order by depcode;
select * from lf.sys_user where id=1
-- tabs=元数据表,entities=sysmeta,gids=1393,1392,1383,1382
@@ -40,6 +32,100 @@
---------------------------------------------------------------------------------------------- SY1.煤层54表
-- drop table public.coal54;
create table if not exists public.coal54 (
    gid serial primary key,
   top numeric(12, 3),
   bottom numeric(12, 3),
    clong numeric(12, 3),
   width numeric(12, 3),
   height numeric(12, 3),
   ctype varchar(8),
   density numeric(12, 3),
   gangue numeric(12, 5),
   volume numeric(12, 3),
    geom geometry(point, 2435)
);
create index idx_coal54_geom on public.coal54 using gist (geom);
comment on table public.coal54 is '煤层54表';
comment on column public.coal54.gid is '主键ID';
comment on column public.coal54.top is '上顶高度';
comment on column public.coal54.bottom is '下底高度';
comment on column public.coal54.clong is '长度';
comment on column public.coal54.width is '宽度';
comment on column public.coal54.height is '高度';
comment on column public.coal54.ctype is '类别';
comment on column public.coal54.density is '视密度';
comment on column public.coal54.gangue is '含矸率';
comment on column public.coal54.volume is '体积';
comment on column public.coal54.geom is '空间';
select count(*) from public.coal54; -- 12701714
select a.*, ST_AsText(geom) from public.coal54 a order by gid desc limit 100;
---------------------------------------------------------------------------------------------- SY2.煤层2000表
-- create sequence public.coal2000_gid_seq increment  by 1 minvalue 1 maxvalue 2147483647 start 1 cache 1;
-- alter sequence public.coal2000_gid_seq restart with 12701715; vacuum analyze public.coal2000;
-- drop table public.coal2000;
create table if not exists public.coal2000 (
    gid serial primary key,
   top numeric(12, 3),
   bottom numeric(12, 3),
    clong numeric(12, 3),
   width numeric(12, 3),
   height numeric(12, 3),
   ctype varchar(8),
   density numeric(12, 3),
   gangue numeric(12, 5),
   volume numeric(12, 3),
   coal_prod numeric(15, 3),
   gangue_prod numeric(15, 5),
   soil_prod numeric(15, 5),
    geom geometry(point, 4490)
);
-- drop index if exists public.idx_coal2000_geom;
create index idx_coal2000_geom on public.coal2000 using gist (geom);
comment on table public.coal2000 is '煤层2000表';
comment on column public.coal2000.gid is '主键ID';
comment on column public.coal2000.top is '上顶高度';
comment on column public.coal2000.bottom is '下底高度';
comment on column public.coal2000.clong is '长度';
comment on column public.coal2000.width is '宽度';
comment on column public.coal2000.height is '高度';
comment on column public.coal2000.ctype is '类别';
comment on column public.coal2000.density is '视密度';
comment on column public.coal2000.gangue is '含矸率';
comment on column public.coal2000.volume is '体积';
comment on column public.coal2000.coal_prod is '煤量';
comment on column public.coal2000.gangue_prod is '矸石量';
comment on column public.coal2000.soil_prod is '土量';
comment on column public.coal2000.geom is '空间';
-- drop index if exists public.idx_coal2000_ctype;
create index idx_coal2000_ctype on public.coal2000 (ctype);
--煤量 = 体积 * 视密度,矸石量 = 体积 * 含矸率,土量 = 总体积 - 煤量- 矸石量
select count(*) from public.coal2000; -- 12701714
select * from public.coal2000 order by gid desc limit 100;
select ctype, sum(volume) "volume", sum(coal_prod) "coal_prod", sum(gangue_prod) "gangue_prod", 0 "soil_prod" from public.coal2000
where (top between 640 and 690 or bottom between 640 and 690) and ST_Intersects(geom, ST_PolygonFromText('POLYGON ((113.5807 45.4897,113.5898 45.4893,113.5857 45.4837,113.5807 45.4897))', 4490)) group by ctype order by ctype;
-- select ST_GeometryFromText('POLYGON ((113.5807 45.4897,113.5898 45.4893,113.5857 45.4837,113.5807 45.4897))', 4490)
---------------------------------------------------------------------------------------------- -1.更新钻孔
select count(*) from bd.b_borehole; -- 357824
select count(*) from lf.sys_attach; -- 357880 = 56 + 357824
select * from bd.b_borehole limit 10; -- 基础钻孔
-- update bd.b_borehole set path = 'Drill\' || path;
-- insert into lf.sys_attach (name, guid, path, tab, tab_guid)
select substr(path, length(path) - position('\' in reverse(path)) + 2), eventid, path, 'bd.b_borehole', eventid from bd.b_borehole;
---------------------------------------------------------------------------------------------- 00.SQL查询
insert into lf.sys_meta_pub (metaid, pubid) select 1, 1 from (select 1) temp where not exists (select 1 from lf.sys_meta_pub where metaid = 1 and pubid = 1);