¶Ô±ÈÐÂÎļþ |
| | |
| | | ---------------------------------------------------------------------------------------------- 00.åå»ºç©ºé´æ©å± |
| | | create extension postgis; |
| | | create extension pgrouting; |
| | | create extension postgis_raster; |
| | | create extension postgis_topology; |
| | | create extension fuzzystrmatch; |
| | | create extension postgis_tiger_geocoder; |
| | | create extension address_standardizer; |
| | | ---------------------------------------------------------------------------------------------- 01.æ¥è¯¢è¿æ¥æ° |
| | | show max_connections; |
| | | select count(1) from pg_stat_activity; |
| | | |
| | | select c.relname "tab", cast(obj_description(c.oid) as varchar) "desc", a.attnum "num", a.attname "col", |
| | | t.typname "type",concat_ws('', t.typname,SUBSTRING(format_type(a.atttypid, a.atttypmod) from '(.*)')) "type2", d.description "bak" -- select * |
| | | from pg_attribute a left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum left join pg_class c |
| | | on a.attrelid = c.oid left join pg_type t on a.atttypid = t.oid where a.attnum >= 0 and reltype>0 and relnamespace in (29257,20582)--135502,69701 |
| | | order by c.relname desc, a.attnum asc; |
| | | |
| | | select pg_constraint.conname as pk_name,pg_attribute.attname as colname,pg_type.typname as typename from pg_constraint inner join pg_class |
| | | on pg_constraint.conrelid = pg_class.oid inner join pg_attribute on pg_attribute.attrelid = pg_class.oid and pg_attribute.attnum = pg_constraint.conkey[1] |
| | | inner join pg_type on pg_type.oid = pg_attribute.atttypid where pg_class.relname = 'sys_user' and pg_constraint.contype='p'; |
| | | |
| | | st_length( st_geographyfromtext( st_astext( st_intersection( ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) ) ) AS acrossLength |
| | | ---------------------------------------------------------------------------------------------- 02.é彿¥è¯¢ |
| | | with recursive rs as( |
| | | select * from lf.sys_menu where cn_name='管éåºç¡å¤§æ°æ®å¹³å°' |
| | | union |
| | | select a.* from lf.sys_menu a, rs b where a.pid=b.id |
| | | ) select * FROM rs order by order_num; -- æ¥è¯¢èå |
| | | |
| | | with recursive rs as( |
| | | select * from lf.sys_dep where name='ä¸å½ç³æ²¹å¤©ç¶æ°ç®¡éå·¥ç¨æéå
¬å¸' |
| | | union |
| | | select a.* from lf.sys_dep a, rs b where a.pid=b.id |
| | | ) select * FROM rs order by order_num; -- æ¥è¯¢åä½ |
| | | |
| | | with recursive rs as( |
| | | select * from lf.sys_dir where name='ä¸ä¿ä¸çº¿ç®¡éå·¥ç¨å段' |
| | | union |
| | | select a.* from lf.sys_dir a, rs b where a.pid=b.id |
| | | ) select * FROM rs order by order_num; -- æ°æ®ç®å½ |
| | | ---------------------------------------------------------------------------------------------- 03.æ¥è¯¢è¡¨ç»æ |
| | | select * from pg_tables; select * from pg_class order by relnamespace; |
| | | select relnamespace,relkind,relname from pg_class where relnamespace in (select oid from pg_namespace) and relkind='r' order by 1,2; |
| | | |
| | | select c.relname as "表å", cast(obj_description(c.oid) as varchar) as "表åæè¿°",a.attnum as "åºå·", a.attname as "åå", |
| | | concat_ws('', t.typname, SUBSTRING(format_type(a.atttypid, a.atttypmod) from '\(.*\)')) as "åæ®µç±»å",d.description as "夿³¨" |
| | | from pg_attribute a left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum |
| | | left join pg_class c on a.attrelid = c.oid left join pg_type t on a.atttypid = t.oid |
| | | where a.attnum >= 0 and c.relname like 'sys_%' and obj_description(c.oid) is not null --and relnamespace=20582 |
| | | order by c.relname desc, a.attnum asc; |
| | | ---------------------------------------------------------------------------------------------- 04.ç´¢å¼ |
| | | alter table lf.sys_role_user add constraint idx_unique_role_user unique (roleid, userid); -- èåå¯ä¸ç´¢å¼ |
| | | insert into lf.sys_role_user (roleid,userid) values (1,1); -- æµè¯ |
| | | select * from lf.sys_role_user; |
| | | |
| | | alter table lf.sys_menu_auth add constraint idx_unique_menu_auth unique (menuid, authid); -- èåå¯ä¸ç´¢å¼ |
| | | insert into lf.sys_menu_auth (menuid, authid) values (1,1); -- æµè¯ |
| | | select * from lf.sys_menu_auth; |
| | | |
| | | alter table lf.sys_role_res add constraint idx_unique_role_res unique (roleid,resid); -- èåå¯ä¸ç´¢å¼ |
| | | insert into lf.sys_role_res (roleid,resid) values (1,1); |
| | | select * from lf.sys_role_res; |
| | | |
| | | alter table lf.sys_role_menu_auth add constraint idx_unique_role_menu_auth unique (roleid,menu_auth_id); -- èåå¯ä¸ç´¢å¼ |
| | | insert into lf.sys_role_menu_auth (roleid,menu_auth_id) values (1,1); |
| | | select * from lf.sys_role_menu_auth; |
| | | ---------------------------------------------------------------------------------------------- 05.èåæ¥è¯¢ |
| | | select a.*,fn_uname(a.create_user) createUserName,fn_uname(a.update_user) updateUserName from lf.sys_blacklist a order by a.id; |
| | | select * from lf.sys_user a where uname like '%' and a.depid=ANY(fn_rec_array(1,'dep')); |
| | | select * from lf.sys_user a left join lf.sys_role_user b on a.id=b.userid; |
| | | |
| | | select a.* from lf.sys_user a where not exists (select b.id from lf.sys_role_user b where b.userid = a.id and b.roleid = 1) |
| | | and uname like '%室%' and a.depid = ANY(fn_rec_array(1, 'dep')) |
| | | order by a.id limit 10 offset 0; |
| | | |
| | | select a.*,fn_rec_query(a.depid, 'dep') depName,fn_rec_query(a.dirid, 'dir') dirName from lf.sys_style a; |
| | | ------------------------------------------------------------ |
| | | select * from lf.sys_auth a left join lf.sys_menu; |
| | | select a.* from lf.sys_auth a where not exists (select b.id from lf.sys_menu_auth b where b.authid = a.id and b.menuid = 1); |
| | | |
| | | select a.* from lf.sys_res a where not exists (select b.id from lf.sys_role_res b where b.resid = a.id and b.roleid = 1); |
| | | |
| | | select a.*,c.name from lf.sys_menu_auth a inner join lf.sys_auth c on a.authid = c.id |
| | | where not exists (select b.id from lf.sys_role_menu_auth b where b.menu_auth_id = a.id and b.roleid = 1) and a.menuid = 1 order by c.id; |
| | | |
| | | select a.*,b.menuid,c.name from lf.sys_role_menu_auth a inner join lf.sys_menu_auth b on a.menu_auth_id = b.id |
| | | inner join lf.sys_auth c on b.authid = c.id where a.roleid = 1 and b.menuid = 1 order by c.id; |
| | | ---------------------------------------------------------------------------------------------- |
| | | update lf.sys_operate set modular1='è¿ç»´ç®¡ç',modular2='èå管ç' where position('/Menu/select' in url)>0 and (modular1 is null or modular2 is null); |
| | | update lf.sys_operate set modular1='è¿ç»´ç®¡ç',modular2='ç¨æ·ç®¡ç' where position('/user/select' in url)>0 and (modular1 is null or modular2 is null); |
| | | update lf.sys_operate set modular1='è¿ç»´ç®¡ç',modular2='èµæºç®¡ç' where position('/res/select' in url)>0 and (modular1 is null or modular2 is null); |
| | | |
| | | delete from lf.sys_operate where modular1 is null or modular2 is null; |
| | | ---------------------------------------------------------------------------------------------- 06.æ¥è¯¢ææ |
| | | select gid,gb,name,st_astext(a.geom) from bd.dlg_agnp a; |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢èµæº |
| | | select distinct d.id,d.name,d.server from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_res c on b.roleid = c.roleid |
| | | inner join lf.sys_res d on c.resid = d.id |
| | | where a.uid = 'admin'; |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢èå |
| | | select distinct e.id,e.pid,e.cn_name,e.en_name,e.url,e.type,e.icon,e.level,e.order_num,e.is_show |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | where a.uid = 'admin'; |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢æé |
| | | select distinct f.id,e.cn_name,f.name,e.perms,f.tag |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | inner join lf.sys_auth f on d.authid = f.id |
| | | where a.uid = 'admin'; |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢æé2 |
| | | select distinct e.perms || f.tag as "perms" |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | inner join lf.sys_auth f on d.authid = f.id |
| | | where a.uid = 'admin'; |
| | | ---------------------------------------------------------------------------------------------- 07.æ°æ®ç»è®¡ |
| | | select modular2,count(*) from lf.sys_operate group by modular2; |
| | | |
| | | select to_char(optime,'yyyy-mm-dd') as optime,count(*) from lf.sys_login where optime between (select optime - interval '30 day') |
| | | and optime group by to_char(optime, 'yyyy-mm-dd') order by to_char(optime, 'yyyy-mm-dd') asc; |
| | | |
| | | select a.*,coalesce(a.native,'') from lf.sys_user a; |
| | | select ST_PointFromText('POINT(95.80461853400004 34.13862467200005)'); |
| | | select ST_LineFromText('LINESTRING(04.98985101830993 37.43840773692756,104.99318913447104 37.43883729720358)', 4326); |
| | | select ST_PolygonFromText('POLYGON((104.9907822932683 37.43532941961706,104.99088987736599 37.43532941961706,104.9908670336867 37.4349030213574,104.99078327712658 37.4349030213574,104.9907822932683 37.43532941961706))',4326); |
| | | ---------------------------------------------------------------------------------------------- |
| | | -- 114msï¼180/3248 |
| | | select count(1) from bd.dlg_agnp a where ST_Intersects(geom, |
| | | ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 4326)) |
| | | |
| | | -- 1101ï¼gid >= 50 and name like 'å¿' and objectid < 5000.0 and pac = '360430' |
| | | select count(*) from bd.dlg_agnp where gid >= 50 and name like '%å¿%' and objectid < 5000 --and pac = '360430' |
| | | and ST_Intersects(geom, |
| | | ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 4326)) |
| | | |
| | | select a.* from lf.sys_domain a inner join lf.sys_dict b on a.dom_name = b.domain_na |
| | | where b.ns = 'bd' and b.tab = 'dlg_25w_aanp' and b.domain_na is not null; |
| | | |
| | | select * from lf.sys_dict where ns = 'bd' and tab = 'dlg_25w_aanp' and domain_na is not null; |
| | | select * from lf.sys_domain where dom_name='dlg25gbcode'; |
| | | select * from bd.dlg_25w_aanp limit 10; |
| | | |
| | | select * from bd.dlg_25w_agnp |
| | | where ST_Intersects(geom, |
| | | ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 0)) |
| | | limit 10; |
| | | select st_srid(geom) from bd.dlg_25w_agnp limit 1; |
| | | select * from bd.dlg_25w_agnp where class != 'BB' limit 1; |
| | | |
| | | select a.* from lf.sys_domain a where exists (select * from lf.sys_dict b where b.ns = 'bd' and b.tab = 'dlg_25w_hyda') and a.dom_code like '210%' order by a.id |
| | | select * from lf.sys_download a where create_user = 1 and type = 2; |
| | | ---------------------------------------------------------------------------------------------- 08.æ¥è¯¢ç©ºé´æ°æ® |
| | | select to_char(create_time, 'yyyy-mm-dd hh24:mi:ss') from lf.sys_meta; |
| | | select to_timestamp('2018-08-15 12:10:10', 'yyyy-MM-dd hh24:mi:ss'); |
| | | select a.*,fn_uname(a.create_user) uname from lf.sys_token a |
| | | select distinct ns,tab,fn_get_entity(tab) entity,tab_desc,tabletype from lf.sys_dict order by tab; |
| | | |
| | | -- 3248ï¼POINT(95.8046 34.1386) |
| | | select * from bd.dlg_agnp; |
| | | select count(*) from bd.dlg_agnp; |
| | | delete from bd.dlg_agnp; |
| | | select ST_AsText(geom) from bd.dlg_agnp limit 1; |
| | | |
| | | -- 7348ï¼MULTILINESTRING((113.6007 6.9434,113.6015 6.9444,113.6007 6.9434)) |
| | | select * from bd.dlg_25w_boul; |
| | | select count(*) from bd.dlg_25w_boul; |
| | | delete from bd.dlg_25w_boul; |
| | | select ST_AsText(geom) from bd.dlg_25w_boul limit 1; |
| | | |
| | | -- 156847ï¼MULTIPOLYGON(((108.6790 19.0108,108.6791 19.0104,108.6796 19.0104,108.6790 19.0108))) |
| | | select * from bd.dlg_25w_resa; |
| | | select count(*) from bd.dlg_25w_resa; |
| | | delete from bd.dlg_25w_resa; |
| | | select ST_AsText(geom) from bd.dlg_25w_resa limit 1; |
| | | |
| | | -- MultiLineString MultiPolygon Point |
| | | select GeometryType(geom) from bd.dlg_25w_boul where gid=20; |
| | | select st_srid(geom) from bd.dlg_25w_boul where gid=20 limit 1; |
| | | select ST_AsText(geom) from bd.dlg_agnp where gid=20; |
| | | |
| | | select * from lf.sys_dict where ns='bd' and tab='dlg_25w_boul' and field='geom'; |
| | | select * from lf.sys_meta; -- delete from lf.sys_meta where id<113; |
| | | select * from lf.sys_meta_file; -- delete from lf.sys_meta_file where metaid<113; |
| | | |
| | | select * from lf.sys_meta_file a where metaid in (113,120,121,122); |
| | | alter sequence bd.dlg_agnp_gid_seq restart with 4000; |
| | | select max(gid) from bd.dlg_agnp; |
| | | ---------------------------------------------------------------------------------------------- 09.ç®¡çº¿åæ |
| | | select ST_SRID(geom), ST_GeometryType(geom) from bd.dlg_25w_hydl limit 1; |
| | | select ST_SRID(geom), ST_GeometryType(geom) from bd.dlg_25w_lrdl limit 1; |
| | | select ST_SRID(geom), ST_GeometryType(geom) from bd.dlg_25w_lrrl limit 1; |
| | | select ST_SRID(geom), ST_GeometryType(geom) from bd.dlg_25w_hyda limit 1; |
| | | select ST_SRID(geom), ST_GeometryType(geom) from bs.m_pipesegment limit 1; |
| | | |
| | | SELECT a.name as acrossName, b.remarks, b.pipename as pipeName, |
| | | st_length( st_geographyfromtext( st_astext( st_intersection( ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) ) ) AS acrossLength, |
| | | st_astext(b.geom) as wkt |
| | | FROM bd.dlg_25w_hyda AS a, (SELECT * FROM bs.m_pipesegment WHERE segname = 'DD' ) AS b WHERE ST_Intersects(a.geom, b.geom); |
| | | |
| | | select row_number() over() as gid, a.name as acrossName, b.segname as segName, b.remarks, b.pipename as pipeName, |
| | | cast( st_length( st_geographyfromtext( st_astext( st_intersection(ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) ) ) as decimal(12, 3) ) AS acrossLength, |
| | | st_astext( st_intersection( ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) as wkt |
| | | from bd.dlg_25w_hyda as a, (select segname, remarks, pipename, geom from bs.m_pipesegment where gid = 24) as b |
| | | where ST_Intersects(a.geom, b.geom); |
| | | |
| | | select *, st_astext(geom) as wkt from bs.m_pipesegment; |
| | | select pipename,segname from bs.m_pipesegment where gid = 24; |
| | | ---------------------------------------------------------------------------------------------- 10.æ¥è¯¢ä½ç½® |
| | | select 'å½' "key", cname "value" from bs.th_globe_country where ST_Intersects(ST_PointFromText('POINT(114.178955 38.991743)', 4490), geom) |
| | | union all |
| | | select 'ç' "key", cname "value" from bs.th_province_area where ST_Intersects(ST_PointFromText('POINT(114.178955 38.991743)', 4490), geom) |
| | | union all |
| | | select 'å¸' "key", cname "value" from bs.th_district_area where ST_Intersects(ST_PointFromText('POINT(114.178955 38.991743)', 4490), geom) |
| | | union all |
| | | select 'å¿' "key", cname "value" from bs.th_county_area where ST_Intersects(ST_PointFromText('POINT(114.178955 38.991743)', 4490), geom); |
| | | ---------------------------------------------------------------------------------------------- 11.æ ¹æ®ç¨æ·IDæ¥è¯¢æé |
| | | select * from lf.sys_role a inner join lf.sys_role_user b on a.id=b.roleid inner join lf.sys_user c on b.userid=c.id |
| | | where c.uid = 'kc'; |
| | | |
| | | select distinct e.id,e.pid,e.cn_name,e.en_name,e.url,e.perms,e.type,e.css,e.icon,e.level,e.order_num,e.is_show |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | where a.uid = 'kc' |
| | | order by e.order_num; |
| | | |
| | | with recursive rs as( |
| | | select a.* from lf.sys_menu a where a.id = 64 |
| | | union |
| | | select a.* from lf.sys_menu a, rs b where a.pid = b.id |
| | | ) |
| | | select * FROM rs where rs.id in ( |
| | | select * |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | inner join lf.sys_auth f on d.authid = f.id |
| | | where a.uid = 'admin') |
| | | order by order_num; |
| | | ---------------------------------------------------------------------------------------------- 12.æ¥è¯¢ |
| | | select depid from bd.dlg_25w_boul where depid > 0 and depid != ALL(fn_rec_array(38, 'dep')) |
| | | and ST_Intersects(geom, ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 4490)) |
| | | group by depid; |
| | | |
| | | select * from lf.sys_dir where id in (select min(id) from lf.sys_dir where name in ('æµéï¼ESVï¼','åå¯ï¼EGEï¼','å°ç¾ï¼EGDï¼','æ´åºï¼EGDï¼') group by name); |
| | | |
| | | select * from lf.sys_token where create_time >= '2022-09-29' and create_time <= '2022-09-30'; |
| | | |
| | | select * from lf.sys_token where to_char(create_time,'yyyy-MM-dd') = '2022-09-30'; |
| | | |
| | | select fn_rec_query(depid,'dep') depName,fn_rec_query(dirid,'dir') dirName,fn_ver(verid) verName,fn_uname(createuser) createName,fn_uname(updateuser) updateName from bd.dlg_agnp limit 5; |
| | | ---------------------------------------------------------------------------------------------- -1.æµè¯ |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | ----------------------------------------------------------------------------------------------------- a.æ¥è¯¢è¿æ¥æ° |
| | | show max_connections; |
| | | select count(1) from pg_stat_activity; |
| | | |
| | | select c.relname "tab", cast(obj_description(c.oid) as varchar) "desc", a.attnum "num", a.attname "col", |
| | | t.typname "type",concat_ws('', t.typname,SUBSTRING(format_type(a.atttypid, a.atttypmod) from '(.*)')) "type2", d.description "bak" -- select * |
| | | from pg_attribute a left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum left join pg_class c |
| | | on a.attrelid = c.oid left join pg_type t on a.atttypid = t.oid where a.attnum >= 0 and reltype>0 and relnamespace in (29257,20582)--135502,69701 |
| | | order by c.relname desc, a.attnum asc; |
| | | |
| | | select pg_constraint.conname as pk_name,pg_attribute.attname as colname,pg_type.typname as typename from pg_constraint inner join pg_class |
| | | on pg_constraint.conrelid = pg_class.oid inner join pg_attribute on pg_attribute.attrelid = pg_class.oid and pg_attribute.attnum = pg_constraint.conkey[1] |
| | | inner join pg_type on pg_type.oid = pg_attribute.atttypid where pg_class.relname = 'sys_user' and pg_constraint.contype='p'; |
| | | |
| | | st_length( st_geographyfromtext( st_astext( st_intersection( ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) ) ) AS acrossLength |
| | | ----------------------------------------------------------------------------------------------------- b.é彿¥è¯¢ |
| | | with recursive rs as( |
| | | select * from lf.sys_menu where cn_name='管éåºç¡å¤§æ°æ®å¹³å°' |
| | | union |
| | | select a.* from lf.sys_menu a, rs b where a.pid=b.id |
| | | ) select * FROM rs order by order_num; -- æ¥è¯¢èå |
| | | |
| | | with recursive rs as( |
| | | select * from lf.sys_dep where name='ä¸å½ç³æ²¹å¤©ç¶æ°ç®¡éå·¥ç¨æéå
¬å¸' |
| | | union |
| | | select a.* from lf.sys_dep a, rs b where a.pid=b.id |
| | | ) select * FROM rs order by order_num; -- æ¥è¯¢åä½ |
| | | |
| | | with recursive rs as( |
| | | select * from lf.sys_dir where name='ä¸ä¿ä¸çº¿ç®¡éå·¥ç¨å段' |
| | | union |
| | | select a.* from lf.sys_dir a, rs b where a.pid=b.id |
| | | ) select * FROM rs order by order_num; -- æ°æ®ç®å½ |
| | | ----------------------------------------------------------------------------------------------------- c.æ¥è¯¢è¡¨ç»æ |
| | | select * from pg_tables; select * from pg_class order by relnamespace; |
| | | select relnamespace,relkind,relname from pg_class where relnamespace in (select oid from pg_namespace) and relkind='r' order by 1,2; |
| | | |
| | | select c.relname as "表å", cast(obj_description(c.oid) as varchar) as "表åæè¿°",a.attnum as "åºå·", a.attname as "åå", |
| | | concat_ws('', t.typname, SUBSTRING(format_type(a.atttypid, a.atttypmod) from '\(.*\)')) as "åæ®µç±»å",d.description as "夿³¨" |
| | | from pg_attribute a left join pg_description d on d.objoid = a.attrelid and d.objsubid = a.attnum |
| | | left join pg_class c on a.attrelid = c.oid left join pg_type t on a.atttypid = t.oid |
| | | where a.attnum >= 0 and c.relname like 'sys_%' and obj_description(c.oid) is not null --and relnamespace=20582 |
| | | order by c.relname desc, a.attnum asc; |
| | | ----------------------------------------------------------------------------------------------------- d.GUIDçæå½æ° |
| | | ----------------------------------------------------------------------------------------------------- 01.GUIDçæå½æ° |
| | | -- drop function new_guid(); |
| | | create or replace function new_guid() |
| | | returns "pg_catalog"."varchar" as $body$ |
| | | returns "pg_catalog"."varchar" as $body$ |
| | | declare |
| | | v_seed_value varchar(32); |
| | | begin |
| | |
| | | $body$ language 'plpgsql' volatile security definer; |
| | | |
| | | select new_guid(); |
| | | ----------------------------------------------------------------------------------------------------- e.é彿¥è¯¢å½æ° |
| | | ----------------------------------------------------------------------------------------------------- 02.é彿¥è¯¢å½æ° |
| | | -- drop function rec_query_dep(id integer, tab varchar); |
| | | create or replace function fn_rec_query(id integer, tab varchar) |
| | | returns varchar as $$ |
| | |
| | | end; |
| | | $$ language plpgsql; |
| | | |
| | | select fn_rec_query(1, 'dep'); select fn_rec_query(21, 'dep'); select fn_rec_query(null, 'dep'); |
| | | select fn_rec_query(10, 'dir'); select fn_rec_query(28, 'dir'); |
| | | ----------------------------------------------------------------------------------------------------- f.æ¥è¯¢ç¨æ·å |
| | | select fn_rec_query(1, 'dep'); select fn_rec_query(null, 'dep'); select fn_rec_query(10, 'dir'); |
| | | ----------------------------------------------------------------------------------------------------- 03.æ¥è¯¢ç¨æ·å |
| | | -- execute format('select uname from lf.sys_user where id = %s', id) into str; |
| | | -- drop function fn_uname(id integer); |
| | | create or replace function fn_uname(id integer) |
| | |
| | | $$ language plpgsql; |
| | | |
| | | select fn_uname(null); select fn_uname(1); |
| | | ----------------------------------------------------------------------------------------------------- g.æ¥è¯¢çæ¬å |
| | | ----------------------------------------------------------------------------------------------------- 04.æ¥è¯¢çæ¬å |
| | | -- drop function fn_ver(id integer); |
| | | create or replace function fn_ver(id integer) |
| | | returns varchar as $$ |
| | |
| | | $$ language plpgsql; |
| | | |
| | | select fn_ver(0); |
| | | ----------------------------------------------------------------------------------------------------- h.é彿¥è¯¢IDæ°ç» |
| | | ----------------------------------------------------------------------------------------------------- 05.é彿¥è¯¢IDæ°ç» |
| | | -- drop function fn_rec_array(id integer, tab varchar); |
| | | create or replace function fn_rec_array(id integer, tab varchar) |
| | | returns integer[] as $$ |
| | |
| | | $$ language plpgsql; |
| | | |
| | | select fn_rec_array(1, 'dep'); select fn_rec_array(10, 'dir'); |
| | | select * from lf.sys_user a where a.depid=ANY(fn_rec_array(15,'dep')); |
| | | ----------------------------------------------------------------------------------------------------- i.è·åå®ä½å |
| | | create or replace function fn_get_entity(tab varchar) |
| | | select * from lf.sys_user a where a.depid = ANY(fn_rec_array(15,'dep')); |
| | | ----------------------------------------------------------------------------------------------------- 06.æ¥è¯¢ç®å½IDæ°ç» |
| | | -- drop function fn_dir_arrs(pids varchar); |
| | | create or replace function fn_dir_arrs(pids varchar) returns integer[] as $$ |
| | | declare |
| | | ids integer[]; |
| | | sid integer; |
| | | begin |
| | | for sid in execute |
| | | 'with recursive rs as(select id, pid from lf.sys_dir where id in (' || pids || ') ' || |
| | | 'union select a.id,a.pid from lf.sys_dir a, rs b where a.pid = b.id) ' || |
| | | 'select distinct id from rs order by id' |
| | | loop |
| | | select array_append(ids, sid) into ids; |
| | | end loop; |
| | | |
| | | return ids; |
| | | end; |
| | | $$ language plpgsql; |
| | | |
| | | select fn_dir_arrs('2,5,7,9,12'); |
| | | select * from lf.sys_meta where dirid = ANY(fn_dir_arrs('2,5,7,9,12')); |
| | | ----------------------------------------------------------------------------------------------------- 07.è·åå®ä½å |
| | | /*create or replace function fn_get_entity(tab varchar) |
| | | returns varchar as $$ |
| | | declare |
| | | str varchar; |
| | |
| | | |
| | | return rs; |
| | | end; |
| | | $$ language plpgsql; |
| | | $$ language plpgsql;*/ |
| | | |
| | | create or replace function fn_get_entity(tab varchar) |
| | | returns varchar as $$ |
| | |
| | | end; |
| | | $$ language plpgsql; |
| | | |
| | | select fn_get_entity('dlg_25w_boua_s'); select fn_get_entity('dlg_25w_vega'); |
| | | ----------------------------------------------------------------------------------------------------- j.FMEæ¥å¿è§¦åå¨ * |
| | | create or replace trigger fme_log_trigger after insert on lf.sys_fme_log |
| | | for each row execute procedure fn_meta_insert(); |
| | | |
| | | select fn_get_entity('dlg_25w_boua_s'); |
| | | ----------------------------------------------------------------------------------------------------- 08.FMEæ¥å¿è§¦åå¨ * |
| | | create or replace function fn_meta_insert() returns trigger as $$ |
| | | begin |
| | | update lf.sys_meta set tab = new.pg_ns || '.' || new.tcdm, layer = new.tcmc, rows = new.count where eventid = new.parentid; |
| | |
| | | end; |
| | | $$ language plpgsql; |
| | | |
| | | create or replace trigger fme_log_trigger after insert on lf.sys_fme_log |
| | | for each row execute procedure fn_meta_insert(); |
| | | |
| | | select * from lf.sys_meta; |
| | | /*insert into lf.sys_fme_log (parentid,dirpath,pg_ns,tcmc,tcdm,count) values |
| | | ('8fb3c3dd-6a12-488d-80ae-a93cc7e8b2e3','','bs','ä¸çº¿ææè¡¨','m_pipelinepoint',0); |
| | | select * from bs.m_pipelinepoint where parentid='8fb3c3dd-6a12-488d-80ae-a93cc7e8b2e3';*/ |
| | | ----------------------------------------------------------------------------------------------------- 09.è·¯å¾åæ |
| | | -- å é¤å·²åå¨ç彿° |
| | | drop function pgr_fromAtoB(varchar, double precision, double precision, double precision, double precision); |
| | | |
| | | select id,eventid,name,tab,rows,dirid,depid,verid,create_user,create_time from lf.sys_meta where eventid='8fb3c3dd-6a12-488d-80ae-a93cc7e8b2e3'; |
| | | select * from lf.sys_fme_log where tcmc = 'ä¸çº¿ææè¡¨'; |
| | | insert into lf.sys_fme_log (parentid,dirpath,pg_ns,tcmc,tcdm,count) values ('8fb3c3dd-6a12-488d-80ae-a93cc7e8b2e3','','bs','ä¸çº¿ææè¡¨','m_pipelinepoint',0); |
| | | select * from bs.m_pipelinepoint where parentid='8fb3c3dd-6a12-488d-80ae-a93cc7e8b2e3'; |
| | | ----------------------------------------------------------------------------------------------------- k.ç´¢å¼ |
| | | alter table lf.sys_role_user add constraint idx_unique_role_user unique (roleid, userid); -- èåå¯ä¸ç´¢å¼ |
| | | insert into lf.sys_role_user (roleid,userid) values (1,1); -- æµè¯ |
| | | select * from lf.sys_role_user; |
| | | -- åºäºä»»æä¸¤ç¹ä¹é´çæçè·¯å¾åæ |
| | | create or replace function pgr_fromAtoB ( |
| | | in tbl varchar, -- æ°æ®åºè¡¨å |
| | | in x1 double precision, -- èµ·ç¹xåæ |
| | | in y1 double precision, -- èµ·ç¹yåæ |
| | | in x2 double precision, -- ç»ç¹xåæ |
| | | in y2 double precision, -- ç»ç¹yåæ |
| | | out seq integer, -- éè·¯åºå· |
| | | out gid integer, |
| | | out name text, -- éè·¯å |
| | | out heading double precision, |
| | | out cost double precision, -- æ¶è |
| | | out geom geometry -- éè·¯å ä½éå |
| | | ) returns setof record as $body$ |
| | | declare |
| | | sql text; |
| | | rec record; |
| | | source integer; |
| | | target integer; |
| | | point integer; |
| | | begin |
| | | -- æ¥è¯¢è·ç¦»åºåç¹æè¿çéè·¯èç¹ |
| | | execute 'select id::integer from ' || quote_ident(tbl) |
| | | || '_vertices_pgr order by the_geom <-> st_geometryfromtext(''point(' |
| | | || x1 || ' ' || y1 || ')'',4490) limit 1' into rec; |
| | | source := rec.id; |
| | | |
| | | alter table lf.sys_menu_auth add constraint idx_unique_menu_auth unique (menuid, authid); -- èåå¯ä¸ç´¢å¼ |
| | | insert into lf.sys_menu_auth (menuid, authid) values (1,1); -- æµè¯ |
| | | select * from lf.sys_menu_auth; |
| | | -- æ¥è¯¢è·ç¦»ç®çå°æè¿çéè·¯èç¹ |
| | | execute 'select id::integer from ' || quote_ident(tbl) |
| | | || '_vertices_pgr order by the_geom <-> st_geometryfromtext(''point(' |
| | | || x2 || ' ' || y2 || ')'',4490) limit 1' into rec; |
| | | target := rec.id; |
| | | |
| | | alter table lf.sys_role_res add constraint idx_unique_role_res unique (roleid,resid); -- èåå¯ä¸ç´¢å¼ |
| | | insert into lf.sys_role_res (roleid,resid) values (1,1); |
| | | select * from lf.sys_role_res; |
| | | -- æçè·¯å¾æ¥è¯¢ |
| | | seq := 0; |
| | | sql := 'select gid, geom, node as name, cost, source, target, st_reverse(geom) as flip_geom from ' |
| | | || 'pgr_dijkstra(''select gid as id,source::integer,target::integer,' |
| | | || 'length::float as cost from ' |
| | | || quote_ident(tbl) || ''', ' |
| | | || source || ', ' || target |
| | | || ' ,false) as di, ' |
| | | || quote_ident(tbl) || ' where di.edge = gid order by seq'; |
| | | |
| | | alter table lf.sys_role_menu_auth add constraint idx_unique_role_menu_auth unique (roleid,menu_auth_id); -- èåå¯ä¸ç´¢å¼ |
| | | insert into lf.sys_role_menu_auth (roleid,menu_auth_id) values (1,1); |
| | | select * from lf.sys_role_menu_auth; |
| | | ----------------------------------------------------------------------------------------------------- l.èåæ¥è¯¢ |
| | | select a.*,fn_uname(a.create_user) createUserName,fn_uname(a.update_user) updateUserName from lf.sys_blacklist a order by a.id; |
| | | select * from lf.sys_user a where uname like '%' and a.depid=ANY(fn_rec_array(1,'dep')); |
| | | select * from lf.sys_user a left join lf.sys_role_user b on a.id=b.userid; |
| | | -- remember start point |
| | | point := source; |
| | | for rec in execute sql |
| | | loop |
| | | -- flip geometry (if required) |
| | | if ( point != rec.source ) then |
| | | rec.geom := rec.flip_geom; |
| | | point := rec.source; |
| | | else |
| | | point := rec.target; |
| | | end if; |
| | | |
| | | select a.* from lf.sys_user a where not exists (select b.id from lf.sys_role_user b where b.userid = a.id and b.roleid = 1) |
| | | and uname like '%室%' and a.depid = ANY(fn_rec_array(1, 'dep')) |
| | | order by a.id limit 10 offset 0; |
| | | -- calculate heading (simplified) |
| | | execute 'select degrees( st_azimuth(st_startpoint(''' || rec.geom::text |
| | | || '''),st_endpoint(''' || rec.geom::text || ''') ) )' into heading; |
| | | |
| | | select a.*,fn_rec_query(a.depid, 'dep') depName,fn_rec_query(a.dirid, 'dir') dirName from lf.sys_style a; |
| | | ------------------------------------------------------------ |
| | | select * from lf.sys_auth a left join lf.sys_menu; |
| | | select a.* from lf.sys_auth a where not exists (select b.id from lf.sys_menu_auth b where b.authid = a.id and b.menuid = 1); |
| | | -- return record |
| | | seq := seq + 1; |
| | | gid := rec.gid; |
| | | name := rec.name; |
| | | cost := rec.cost; |
| | | geom := rec.geom; |
| | | return next; |
| | | end loop; |
| | | return; |
| | | end; |
| | | $body$ language 'plpgsql' volatile strict; |
| | | |
| | | select a.* from lf.sys_res a where not exists (select b.id from lf.sys_role_res b where b.resid = a.id and b.roleid = 1); |
| | | |
| | | select a.*,c.name from lf.sys_menu_auth a inner join lf.sys_auth c on a.authid = c.id |
| | | where not exists (select b.id from lf.sys_role_menu_auth b where b.menu_auth_id = a.id and b.roleid = 1) and a.menuid = 1 order by c.id; |
| | | |
| | | select a.*,b.menuid,c.name from lf.sys_role_menu_auth a inner join lf.sys_menu_auth b on a.menu_auth_id = b.id |
| | | inner join lf.sys_auth c on b.authid = c.id where a.roleid = 1 and b.menuid = 1 order by c.id; |
| | | ----------------------------------------------------------------------------------------------------- |
| | | update lf.sys_operate set modular1='è¿ç»´ç®¡ç',modular2='èå管ç' where position('/Menu/select' in url)>0 and (modular1 is null or modular2 is null); |
| | | update lf.sys_operate set modular1='è¿ç»´ç®¡ç',modular2='ç¨æ·ç®¡ç' where position('/user/select' in url)>0 and (modular1 is null or modular2 is null); |
| | | update lf.sys_operate set modular1='è¿ç»´ç®¡ç',modular2='èµæºç®¡ç' where position('/res/select' in url)>0 and (modular1 is null or modular2 is null); |
| | | |
| | | delete from lf.sys_operate where modular1 is null or modular2 is null; |
| | | ----------------------------------------------------------------------------------------------------- m.æ¥è¯¢ææ |
| | | select gid,gb,name,st_astext(a.geom) from bd.dlg_agnp a; |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢èµæº |
| | | select distinct d.id,d.name,d.server from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_res c on b.roleid = c.roleid |
| | | inner join lf.sys_res d on c.resid = d.id |
| | | where a.uid = 'admin'; |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢èå |
| | | select distinct e.id,e.pid,e.cn_name,e.en_name,e.url,e.type,e.icon,e.level,e.order_num,e.is_show |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | where a.uid = 'admin'; |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢æé |
| | | select distinct f.id,e.cn_name,f.name,e.perms,f.tag |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | inner join lf.sys_auth f on d.authid = f.id |
| | | where a.uid = 'admin'; |
| | | |
| | | -- æ ¹æ®ç¨æ·Uidæ¥è¯¢æé2 |
| | | select distinct e.perms || f.tag as "perms" |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | inner join lf.sys_auth f on d.authid = f.id |
| | | where a.uid = 'admin'; |
| | | ---------------------------------------------------------------------------------------------- n.æ°æ®ç»è®¡ |
| | | select modular2,count(*) from lf.sys_operate group by modular2; |
| | | |
| | | select to_char(optime,'yyyy-mm-dd') as optime,count(*) from lf.sys_login where optime between (select optime - interval '30 day') |
| | | and optime group by to_char(optime, 'yyyy-mm-dd') order by to_char(optime, 'yyyy-mm-dd') asc; |
| | | |
| | | select a.*,coalesce(a.native,'') from lf.sys_user a; |
| | | select ST_PointFromText('POINT(95.80461853400004 34.13862467200005)'); |
| | | select ST_LineFromText('LINESTRING(04.98985101830993 37.43840773692756,104.99318913447104 37.43883729720358)', 4326); |
| | | select ST_PolygonFromText('POLYGON((104.9907822932683 37.43532941961706,104.99088987736599 37.43532941961706,104.9908670336867 37.4349030213574,104.99078327712658 37.4349030213574,104.9907822932683 37.43532941961706))',4326); |
| | | ---------------------------------------------------------------------------------------------- |
| | | -- 114msï¼180/3248 |
| | | select count(1) from bd.dlg_agnp a where ST_Intersects(geom, |
| | | ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 4326)) |
| | | |
| | | -- 1101ï¼gid >= 50 and name like 'å¿' and objectid < 5000.0 and pac = '360430' |
| | | select count(*) from bd.dlg_agnp where gid >= 50 and name like '%å¿%' and objectid < 5000 --and pac = '360430' |
| | | and ST_Intersects(geom, |
| | | ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 4326)) |
| | | |
| | | select a.* from lf.sys_domain a inner join lf.sys_dict b on a.dom_name = b.domain_na |
| | | where b.ns = 'bd' and b.tab = 'dlg_25w_aanp' and b.domain_na is not null; |
| | | |
| | | select * from lf.sys_dict where ns = 'bd' and tab = 'dlg_25w_aanp' and domain_na is not null; |
| | | select * from lf.sys_domain where dom_name='dlg25gbcode'; |
| | | select * from bd.dlg_25w_aanp limit 10; |
| | | |
| | | select * from bd.dlg_25w_agnp |
| | | where ST_Intersects(geom, |
| | | ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 0)) |
| | | limit 10; |
| | | select st_srid(geom) from bd.dlg_25w_agnp limit 1; |
| | | select * from bd.dlg_25w_agnp where class != 'BB' limit 1; |
| | | |
| | | select a.* from lf.sys_domain a where exists (select * from lf.sys_dict b where b.ns = 'bd' and b.tab = 'dlg_25w_hyda') and a.dom_code like '210%' order by a.id |
| | | select * from lf.sys_download a where create_user = 1 and type = 2; |
| | | ---------------------------------------------------------------------------------------------- o.æ¥è¯¢ç©ºé´æ°æ® |
| | | select to_char(create_time, 'yyyy-mm-dd hh24:mi:ss') from lf.sys_meta; |
| | | select to_timestamp('2018-08-15 12:10:10', 'yyyy-MM-dd hh24:mi:ss'); |
| | | select a.*,fn_uname(a.create_user) uname from lf.sys_token a |
| | | select distinct ns,tab,fn_get_entity(tab) entity,tab_desc,tabletype from lf.sys_dict order by tab; |
| | | |
| | | -- 3248ï¼POINT(95.8046 34.1386) |
| | | select * from bd.dlg_agnp; |
| | | select count(*) from bd.dlg_agnp; |
| | | delete from bd.dlg_agnp; |
| | | select ST_AsText(geom) from bd.dlg_agnp limit 1; |
| | | |
| | | -- 7348ï¼MULTILINESTRING((113.6007 6.9434,113.6015 6.9444,113.6007 6.9434)) |
| | | select * from bd.dlg_25w_boul; |
| | | select count(*) from bd.dlg_25w_boul; |
| | | delete from bd.dlg_25w_boul; |
| | | select ST_AsText(geom) from bd.dlg_25w_boul limit 1; |
| | | |
| | | -- 156847ï¼MULTIPOLYGON(((108.6790 19.0108,108.6791 19.0104,108.6796 19.0104,108.6790 19.0108))) |
| | | select * from bd.dlg_25w_resa; |
| | | select count(*) from bd.dlg_25w_resa; |
| | | delete from bd.dlg_25w_resa; |
| | | select ST_AsText(geom) from bd.dlg_25w_resa limit 1; |
| | | |
| | | -- MultiLineString MultiPolygon Point |
| | | select GeometryType(geom) from bd.dlg_25w_boul where gid=20; |
| | | select st_srid(geom) from bd.dlg_25w_boul where gid=20 limit 1; |
| | | select ST_AsText(geom) from bd.dlg_agnp where gid=20; |
| | | |
| | | select * from lf.sys_dict where ns='bd' and tab='dlg_25w_boul' and field='geom'; |
| | | select * from lf.sys_meta; -- delete from lf.sys_meta where id<113; |
| | | select * from lf.sys_meta_file; -- delete from lf.sys_meta_file where metaid<113; |
| | | |
| | | select * from lf.sys_meta_file a where metaid in (113,120,121,122); |
| | | alter sequence bd.dlg_agnp_gid_seq restart with 4000; |
| | | select max(gid) from bd.dlg_agnp; |
| | | ---------------------------------------------------------------------------------------------- p.æµè¯ |
| | | select * from bd.dlg_25w_boul where gid<11; -- delete from bd.dlg_25w_boul where gid>10; alter sequence bd.dlg_25w_boul_gid_seq restart with 20; |
| | | select * from bd.dlg_25w_resa where gid<12; -- delete from bd.dlg_25w_resa where gid>11; alter sequence bd.dlg_25w_resa_gid_seq restart with 20; |
| | | select * from bd.dlg_agnp where gid<13; -- delete from bd.dlg_agnp where gid>12; alter sequence bd.dlg_agnp_gid_seq restart with 20; |
| | | select gb,name,classes,pinyin,pac,bsm,geom,eventid,dirid,depid,verid,createtime,createuser,updateuser,updatetime from bd.dlg_agnp; |
| | | select * from lf.sys_token where create_time >= '2022-09-29' and create_time <= '2022-09-30'; |
| | | select * from lf.sys_token where to_char(create_time,'yyyy-MM-dd') = '2022-09-30'; |
| | | select fn_rec_query(depid,'dep') depName,fn_rec_query(dirid,'dir') dirName,fn_ver(verid) verName,fn_uname(createuser) createName,fn_uname(updateuser) updateName from bd.dlg_agnp limit 10; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | select ST_astext(ST_Union(geom)) as route from pgr_fromAtoB('lrdl'::text, 116.78999, 39.9468, 116.80458, 39.94758); |
| | | select st_astext(geom) route from pgr_fromAtoB('lrdl', 116.78999, 39.9468, 116.80458, 39.94758); |
| | | ----------------------------------------------------------------------------------------------------- |
| | |
| | | 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; |
| | | |
| | |
| | | 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; |
| | |
| | | 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.ç»å½æ¥å¿è¡¨ |
| | |
| | | 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.èµæºæä½è¡¨ |
| | |
| | | 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; |
| | | 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 * from lf.sys_dict order by ns,tab,order_num limit 10 offset 0; |
| | |
| | | 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.æ¶æ¯éç¥è¡¨ |
| | |
| | | select depid from bd.dlg_25w_boul where depid > 0 and depid != ALL(fn_rec_array(38, 'dep')) |
| | | and ST_Intersects(geom, ST_PolygonFromText('POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))', 4490)) |
| | | group by depid; |
| | | -- 1:25ä¸è¡æ¿åºå线 |
| | | select * from lf.sys_dict where ns='bd' and tab='dlg_25w_boul'; |
| | | |
| | | select c.* from lf.sys_role a inner join lf.sys_role_user b on a.id = b.roleid inner join lf.sys_user c on b.userid = c.id |
| | | where a.is_admin = 2 and a.depid = 55 order by c.id limit 1 |
| | |
| | | select a.*, fn_rec_query(a.depid, 'dep') depName,fn_uname(a.create_user) createName,fn_uname(a.update_user) updateName |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid inner join lf.sys_role c on b.roleid = c.id |
| | | where c.id = 15 |
| | | ----------------------------------------------------------------------- 管ç½åæ |
| | | select *, st_astext(geom) as wkt from bs.m_pipesegment; |
| | | select ST_SRID(geom), ST_GeometryType(geom) from bd.dlg_25w_hydl limit 1; |
| | | select ST_SRID(geom), ST_GeometryType(geom) from bd.dlg_25w_lrdl limit 1; |
| | | select ST_SRID(geom), ST_GeometryType(geom) from bd.dlg_25w_lrrl limit 1; |
| | | select ST_SRID(geom), ST_GeometryType(geom) from bd.dlg_25w_hyda limit 1; |
| | | select ST_SRID(geom), ST_GeometryType(geom) from bs.m_pipesegment limit 1; |
| | | |
| | | SELECT a.name as acrossName, b.remarks, b.pipename as pipeName, |
| | | st_length( st_geographyfromtext( st_astext( st_intersection( ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) ) ) AS acrossLength, |
| | | st_astext(b.geom) as wkt |
| | | FROM bd.dlg_25w_hyda AS a, (SELECT * FROM bs.m_pipesegment WHERE segname = 'DD' ) AS b WHERE ST_Intersects(a.geom, b.geom); |
| | | |
| | | select row_number() over() as gid, a.name as acrossName, b.segname as segName, b.remarks, b.pipename as pipeName, |
| | | cast( st_length( st_geographyfromtext( st_astext( st_intersection(ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) ) ) as decimal(12, 3) ) AS acrossLength, |
| | | st_astext( st_intersection( ST_MakeValid(a.geom), ST_MakeValid(b.geom) ) ) as wkt |
| | | from bd.dlg_25w_hyda as a, (select segname, remarks, pipename, geom from bs.m_pipesegment where gid = 24) as b |
| | | where ST_Intersects(a.geom, b.geom); |
| | | |
| | | select pipename,segname from bs.m_pipesegment where gid = 24; |
| | | ----------------------------------------------------------------------- æ¥è¯¢ 57, 163 |
| | | select fn_rec_query(a.id, 'dir'), a.* from lf.sys_dir a where id = ANY(fn_rec_array(163, 'dir')); |
| | | select * from lf.sys_dir where pid = 0; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | -- delete from lf.sys_operate where optime < '2023-01-10'; |
| | | select * from lf.sys_login where optime < '2023-01-10'; |
| | | -- delete from lf.sys_login where optime < '2023-01-10'; |
| | | ------------------------------------------------------ |
| | | ------------------------------------------------------ æ¥è¯¢URL |
| | | select * from lf.sys_menu where position('http://' in url) > 0; |
| | | select url, replace(url, 'pipe.cppe.com', '{host}') from lf.sys_menu where position('http://' in url) > 0; |
| | | update lf.sys_menu set url = replace(url, 'pipe.cppe.com', '{host}') where position('http://' in url) > 0; |
| | |
| | | select fn_rec_query(a.dirid,'dir'),a.* from lf.sys_meta_new a where dirid = ANY(fn_rec_array((select id from rs), 'dir')); |
| | | |
| | | select * from lf.sys_meta where substr(path,1,2) = '2\'; |
| | | ------------------------------------------------------ æ ¹æ®ç¨æ·IDæ¥è¯¢æé |
| | | select * from lf.sys_menu order by id; |
| | | select * from lf.sys_coord where epsgcode = 'EPSG:4490'; |
| | | |
| | | select * from lf.sys_role a inner join lf.sys_role_user b on a.id=b.roleid inner join lf.sys_user c on b.userid=c.id |
| | | where c.uid = 'kc'; |
| | | |
| | | select distinct e.id,e.pid,e.cn_name,e.en_name,e.url,e.perms,e.type,e.css,e.icon,e.level,e.order_num,e.is_show |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | where a.uid = 'kc' |
| | | order by e.order_num; |
| | | |
| | | with recursive rs as( |
| | | select a.* from lf.sys_menu a where a.id = 64 |
| | | union |
| | | select a.* from lf.sys_menu a, rs b where a.pid = b.id |
| | | ) |
| | | select * FROM rs where rs.id in ( |
| | | select * |
| | | from lf.sys_user a inner join lf.sys_role_user b on a.id = b.userid |
| | | inner join lf.sys_role_menu_auth c on b.roleid = c.roleid |
| | | inner join lf.sys_menu_auth d on c.menu_auth_id = d.id |
| | | inner join lf.sys_menu e on d.menuid = e.id |
| | | inner join lf.sys_auth f on d.authid = f.id |
| | | where a.uid = 'admin') |
| | | order by order_num; |
| | | --------------------------------------------------------- æ¥è¯¢ä½ç½® |
| | | select 'å½' "key", cname "value" from bs.th_globe_country where ST_Intersects(ST_PointFromText('POINT(114.178955 38.991743)', 4490), geom) |
| | | union all |
| | | select 'ç' "key", cname "value" from bs.th_province_area where ST_Intersects(ST_PointFromText('POINT(114.178955 38.991743)', 4490), geom) |
| | | union all |
| | | select 'å¸' "key", cname "value" from bs.th_district_area where ST_Intersects(ST_PointFromText('POINT(114.178955 38.991743)', 4490), geom) |
| | | union all |
| | | select 'å¿' "key", cname "value" from bs.th_county_area where ST_Intersects(ST_PointFromText('POINT(114.178955 38.991743)', 4490), geom); |
| | | --------------------------------------------------------- |
| | | select * from lf.sys_fme_log; |
| | | select * from lf.sys_meta; |
| | | -- delete from lf.sys_meta where id> 31; |
| | | -- delete from lf.sys_meta; alter sequence lf.sys_meta_id_seq restart with 1; |
| | | |
| | | |
| | | |
| | | |
| | | -- delete from lf.sys_meta; |
| | | -- alter sequence lf.sys_meta_id_seq restart with 1; |
| | | |
| | | |
| | | |