From eb1af5f77f2c16e580173553e548ff4e41653e4e Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 02 十一月 2022 17:02:13 +0800
Subject: [PATCH] 1

---
 data/db_fn.sql |   36 +++++++++++++++++++++++++++---------
 1 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/data/db_fn.sql b/data/db_fn.sql
index 1b57438..f9966dd 100644
--- a/data/db_fn.sql
+++ b/data/db_fn.sql
@@ -1,4 +1,4 @@
------------------------------------------------------------------------------------------------------ 1.鏌ヨ杩炴帴鏁�
+----------------------------------------------------------------------------------------------------- 0.鏌ヨ杩炴帴鏁�
 show max_connections;
 select count(1) from pg_stat_activity;
 
@@ -152,7 +152,27 @@
 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'));
------------------------------------------------------------------------------------------------------ g.绱㈠紩
+----------------------------------------------------------------------------------------------------- g.鑾峰彇瀹炰綋鍚�
+create or replace function fn_get_entity(tab varchar)
+returns varchar as $$
+  declare
+	str varchar;
+	rs varchar = '';
+  begin
+	foreach str in array (select string_to_array(tab, '_')) loop
+	  if (length(rs) = 0 or length(str) = 1) then
+	    rs = rs || str;
+	  else
+		rs = rs || initcap(str);
+	  end if;
+	end loop;
+	
+	return rs;
+  end;
+$$ language plpgsql;
+
+select fn_get_entity('dlg_25w_boua_s'); select fn_get_entity('dlg_25w_vega'); 
+----------------------------------------------------------------------------------------------------- h.绱㈠紩
 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;
@@ -168,7 +188,7 @@
 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;
------------------------------------------------------------------------------------------------------ 
+----------------------------------------------------------------------------------------------------- i.鑱斿悎鏌ヨ
 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
@@ -195,7 +215,7 @@
 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;
------------------------------------------------------------------------------------------------------ 
+----------------------------------------------------------------------------------------------------- j.鏌ヨ鎺堟潈
 select gid,gb,name,st_astext(a.geom) from bd.dlg_agnp a;
 
 -- 鏍规嵁鐢ㄦ埛Uid鏌ヨ璧勬簮
@@ -229,7 +249,7 @@
 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';
----------------------------------------------------------------------------------------------- 鏁版嵁缁熻 
+---------------------------------------------------------------------------------------------- k.鏁版嵁缁熻 
 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')
@@ -249,11 +269,9 @@
 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 st_astext(geom) from bd.dlg_25w_hfcl limit 10;
 
-select * from lf.sys_attach where 1=1 limit 1
-select * from lf.sys_download;
-select * from lf.sys_user;
+
+
 
 
 

--
Gitblit v1.9.3