ÎļþÃû´Ó data/db.sql ÐÞ¸Ä |
| | |
| | | update_time timestamp(6) without time zone, |
| | | bak varchar(1024) |
| | | ); |
| | | |
| | | comment on table lf.sys_menu is 'èå表'; |
| | | comment on column lf.sys_menu.id is '主é®ID'; |
| | | comment on column lf.sys_menu.pid is 'ç¶IDï¼0-æ ¹èç¹'; |
| | |
| | | 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 bak type varchar(1024); |
| | | --alter sequence lf.sys_menu_id_seq restart with 45; |
| | | --update lf.sys_menu set bak=null,create_time=now() where 1=1; |
| | | delete from lf.sys_menu where id=40; |
| | | update lf.sys_menu set cn_name='é»/ç½åå',en_name='Black/White List' where id=41; |
| | | update lf.sys_menu set url='http://192.168.20.39:12316/sign/toDruid?token=',bak='databaseMonitoring' where id=42; |
| | | |
| | | select * from lf.sys_menu order by id; |
| | | ----------------------------------------------------------------------------------------------------- 2.åä½è¡¨ |
| | |
| | | update_time timestamp(6) without time zone, |
| | | bak varchar(1024) |
| | | ); |
| | | |
| | | comment on table lf.sys_dep is 'åä½è¡¨'; |
| | | comment on column lf.sys_dep.id is '主é®ID'; |
| | | comment on column lf.sys_dep.pid is 'ç¶IDï¼0-æ ¹èç¹'; |
| | |
| | | comment on column lf.sys_dep.update_user is 'æ´æ°äººID'; |
| | | 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); |
| | | --update lf.sys_dep set bak=null,create_time=now() where 1=1; |
| | | --alter table lf.sys_dep rename short to sname; alter table lf.sys_dep alter column bak type varchar(1024); |
| | | |
| | | select * from lf.sys_dep order by id; |
| | | ----------------------------------------------------------------------------------------------------- 3.ç®å½è¡¨ |
| | |
| | | update_time timestamp(6) without time zone, |
| | | bak varchar(1024) |
| | | ); |
| | | |
| | | comment on table lf.sys_dir is 'ç®å½è¡¨'; |
| | | comment on column lf.sys_dir.id is '主é®ID'; |
| | | comment on column lf.sys_dir.pid is 'ç¶IDï¼0-æ ¹èç¹'; |
| | |
| | | comment on column lf.sys_dir.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_dir.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column lf.sys_dir.bak is '夿³¨'; |
| | | |
| | | --alter sequence lf.sys_dir_id_seq restart with 124; |
| | | --update lf.sys_dir set bak=null,create_time=now(),code=id where 1=1; |
| | | |
| | | select * from lf.sys_dir order by id; |
| | | ----------------------------------------------------------------------------------------------------- 4.ç¨æ·è¡¨ |
| | |
| | | update_time timestamp(6) without time zone, |
| | | bak varchar(1024) |
| | | ); |
| | | |
| | | comment on table lf.sys_user is 'ç¨æ·è¡¨'; |
| | | comment on column lf.sys_user.id is '主é®ID'; |
| | | comment on column lf.sys_user.depid is 'åä½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 '夿³¨'; |
| | | |
| | | -- alter table lf.sys_user add unique(uid); |
| | | /*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); |
| | |
| | | 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');*/ |
| | | |
| | | select * from lf.sys_login; |
| | | select * from lf.sys_login_2022; |
| | | select * 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; |
| | | ----------------------------------------------------------------------------------------------------- 6.æä½æ¥å¿è¡¨ |
| | | -- DROP TABLE IF EXISTS lf.sys_operate; |
| | |
| | | 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 '夿³¨'; |
| | | |
| | | alter table lf.sys_operate add column modular1 varchar(50); |
| | | alter table lf.sys_operate add column modular2 varchar(50); |
| | | alter table lf.sys_operate drop column modular; |
| | | select split_part(modular,'\',1),split_part(modular,'\',2) from lf.sys_operate; |
| | | update lf.sys_operate set modular1=split_part(modular,'\',1),modular2=split_part(modular,'\',2); |
| | | delete from lf.sys_operate where modular is null and modular2 is null; |
| | | /*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');*/ |
| | | |
| | | 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; |
| | | update lf.sys_operate set modular1=split_part(modular,'\',1),modular2=split_part(modular,'\',2); |
| | | |
| | | 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; |
| | | select * from lf.sys_operate; select * from lf.sys_operate_2022; select * from lf.sys_operate_2024; |
| | | ----------------------------------------------------------------------------------------------------- 7.令ç表 |
| | | -- DROP TABLE IF EXISTS lf.sys_token; |
| | | create table lf.sys_token( |
| | |
| | | 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 'æ´æ°æ¶é´'; |
| | | |
| | | --select now()::timestamp + '1 year 4 hour'; |
| | | /*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');*/ |
| | | |
| | | 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); |
| | | |
| | | select * from lf.sys_token; |
| | | select * from lf.sys_token_2022; |
| | | select * from lf.sys_token_2023; |
| | | 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.èµæºè¡¨ |
| | | -- DROP TABLE IF EXISTS lf.sys_res; |
| | | create table lf.sys_res( |
| | |
| | | update_time timestamp(6) without time zone, |
| | | bak varchar(1024) |
| | | ); |
| | | |
| | | comment on table lf.sys_res is 'èµæºè¡¨'; |
| | | comment on column lf.sys_res.id is '主é®ID'; |
| | | comment on column lf.sys_res.name is 'åç§°'; |
| | |
| | | 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 ('天å°å¾å½±å'); |
| | | |
| | | select * from lf.sys_res; |
| | |
| | | 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',1); |
| | | insert into lf.sys_res_op (resid,ip,type,optime) values (1,'192.168.20.107',4,'2024-01-02');*/ |
| | | |
| | | 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; |
| | | |
| | | select * from lf.sys_res_op; |
| | | select * from lf.sys_res_op_2022; |
| | | select * from lf.sys_res_op_2024; |
| | | select * from lf.sys_res_op; select * from lf.sys_res_op_2022; select * from lf.sys_res_op_2024; |
| | | ----------------------------------------------------------------------------------------------------- 10.æé表 |
| | | -- DROP TABLE IF EXISTS lf.sys_auth; |
| | | create table lf.sys_auth( |
| | |
| | | update_time timestamp(6) without time zone, |
| | | bak varchar(1024) |
| | | ); |
| | | |
| | | comment on table lf.sys_auth is 'æé表'; |
| | | comment on column lf.sys_auth.id is '主é®ID'; |
| | | comment on column lf.sys_auth.name is 'åç§°'; |
| | |
| | | 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'); |
| | |
| | | update_time timestamp(6) without time zone, |
| | | bak varchar(1024) |
| | | ); |
| | | |
| | | comment on table lf.sys_role is 'è§è²è¡¨'; |
| | | comment on column lf.sys_role.id is '主é®ID'; |
| | | comment on column lf.sys_role.depid is 'åä½ID'; |
| | |
| | | comment on column lf.sys_role.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_role.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column lf.sys_role.bak is '夿³¨'; |
| | | |
| | | --insert into lf.sys_role (depid,name,descr) values (1,'Admin','ç³»ç»ç®¡çå'); |
| | | |
| | | select * from lf.sys_role; |
| | | |
| | | select a.*,b.name depname |
| | | from lf.sys_role a inner join lf.sys_dep b |
| | | on a.depid = b.id |
| | | order by a.id limit 10 offset 0; |
| | | select a.*,b.name depname from lf.sys_role a inner join lf.sys_dep b on a.depid = b.id order by a.id limit 10 offset 0; |
| | | ----------------------------------------------------------------------------------------------------- 12.è§è²-ç¨æ·è¡¨ |
| | | -- DROP TABLE IF EXISTS lf.sys_role_user; |
| | | create table lf.sys_role_user( |
| | |
| | | update_user integer, |
| | | update_time timestamp(6) without time zone |
| | | ); |
| | | |
| | | comment on table lf.sys_role_user is 'è§è²-ç¨æ·è¡¨'; |
| | | comment on column lf.sys_role_user.id is '主é®ID'; |
| | | comment on column lf.sys_role_user.roleid is 'è§è²ID'; |
| | |
| | | comment on column lf.sys_role_user.create_time is 'å建æ¶é´'; |
| | | comment on column lf.sys_role_user.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_role_user.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | --insert into lf.sys_role_user (roleid,userid) values (1,1); |
| | | |
| | | select * from lf.sys_role_user; |
| | |
| | | update_user integer, |
| | | update_time timestamp(6) without time zone |
| | | ); |
| | | |
| | | comment on table lf.sys_role_res is 'è§è²-èµæºè¡¨'; |
| | | comment on column lf.sys_role_res.id is '主é®ID'; |
| | | comment on column lf.sys_role_res.roleid is 'è§è²ID'; |
| | |
| | | comment on column lf.sys_role_res.create_time is 'å建æ¶é´'; |
| | | comment on column lf.sys_role_res.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_role_res.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | --insert into lf.sys_role_res (roleid,resid) values (1,1); |
| | | |
| | | select * from lf.sys_role_res; |
| | |
| | | update_user integer, |
| | | update_time timestamp(6) without time zone |
| | | ); |
| | | |
| | | comment on table lf.sys_menu_auth is 'èå-æé表'; |
| | | comment on column lf.sys_menu_auth.id is '主é®ID'; |
| | | comment on column lf.sys_menu_auth.menuid is 'èåID'; |
| | |
| | | comment on column lf.sys_menu_auth.create_time is 'å建æ¶é´'; |
| | | comment on column lf.sys_menu_auth.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_menu_auth.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | --insert into lf.sys_menu_auth (menuid,authid) values (1,1); |
| | | |
| | | select * from lf.sys_menu_auth; |
| | |
| | | update_user integer, |
| | | update_time timestamp(6) without time zone |
| | | ); |
| | | |
| | | comment on table lf.sys_role_menu_auth is 'è§è²-èå表'; |
| | | comment on column lf.sys_role_menu_auth.id is '主é®ID'; |
| | | comment on column lf.sys_role_menu_auth.roleid is 'è§è²ID'; |
| | |
| | | comment on column lf.sys_role_menu_auth.create_time is 'å建æ¶é´'; |
| | | comment on column lf.sys_role_menu_auth.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_role_menu_auth.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | --insert into lf.sys_role_menu_auth (roleid,menu_auth_id) values (1,1); |
| | | |
| | | select * from lf.sys_role_menu_auth; |
| | |
| | | CONSTRAINT enforce_srid_geom CHECK (st_srid(geo) = 4490) |
| | | ); |
| | | create index index_sys_meta_geo on lf.sys_meta using gist (geo); |
| | | |
| | | comment on table lf.sys_meta is 'å
æ°æ®è¡¨'; |
| | | comment on column lf.sys_meta.id is '主é®ID'; |
| | | comment on column lf.sys_meta.dirid is 'ç®å½ID'; |
| | |
| | | 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) values (1,1,'Test',ST_PolygonFromText('POLYGON ((100 0,120 0,120 20,100 20,100 0))',4490)); |
| | | |
| | | select id,dirid,depid,name,descr,guid,create_user,create_time,update_user,update_time,st_astext(geo) from lf.sys_meta; |
| | | select * from lf.sys_meta; |
| | | ----------------------------------------------------------------------------------------------------- 17.å
æ°æ®æä»¶è¡¨ |
| | | -- DROP TABLE IF EXISTS lf.sys_meta_file; |
| | | create table lf.sys_meta_file( |
| | |
| | | update_user integer, |
| | | update_time timestamp(6) without time zone |
| | | ); |
| | | |
| | | comment on table lf.sys_meta_file is 'å
æ°æ®æä»¶è¡¨'; |
| | | comment on column lf.sys_meta_file.id is '主é®ID'; |
| | | comment on column lf.sys_meta_file.metaid is 'å
æ°æ®ID'; |
| | |
| | | comment on column lf.sys_meta_file.create_time is 'å建æ¶é´'; |
| | | comment on column lf.sys_meta_file.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_meta_file.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | --insert into lf.sys_meta_file (metaid,name,path) values (1,'a.jpg','c:\a.jpg'); |
| | | |
| | | select * from lf.sys_meta_file; |
| | |
| | | update_user integer, |
| | | update_time timestamp(6) without time zone |
| | | ); |
| | | |
| | | comment on table lf.sys_attach is 'é件表'; |
| | | comment on column lf.sys_attach.id is '主é®ID'; |
| | | comment on column lf.sys_attach.name is 'æä»¶å'; |
| | |
| | | comment on column lf.sys_attach.create_time is 'å建æ¶é´'; |
| | | 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'); |
| | | |
| | | select length(guid) from lf.sys_attach limit 1; |
| | | select * from lf.sys_attach; |
| | | select length(guid) from lf.sys_attach limit 1; select * from lf.sys_attach; |
| | | ----------------------------------------------------------------------------------------------------- 19.çæ¬è¡¨ |
| | | -- DROP TABLE IF EXISTS lf.sys_ver; |
| | | create table lf.sys_ver( |
| | |
| | | update_user integer, |
| | | update_time timestamp(6) without time zone |
| | | ); |
| | | |
| | | comment on table lf.sys_ver is 'é件表'; |
| | | comment on column lf.sys_ver.id is '主é®ID'; |
| | | comment on column lf.sys_ver.dirid is 'ç®å½ID'; |
| | |
| | | comment on column lf.sys_ver.create_time is 'å建æ¶é´'; |
| | | comment on column lf.sys_ver.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_ver.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | --insert into lf.sys_ver (dirid,name) values (1003,'2020-02-01'); |
| | | |
| | | select * from lf.sys_ver; |
| | |
| | | update_time timestamp(6) without time zone, |
| | | bak varchar(1024) |
| | | ); |
| | | |
| | | comment on table lf.sys_dict is 'é件表'; |
| | | comment on column lf.sys_dict.id is '主é®ID'; |
| | | comment on column lf.sys_dict.ns 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.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=' '; */ |
| | |
| | | update_time timestamp(6) without time zone, |
| | | bak varchar(1024) |
| | | ); |
| | | |
| | | comment on table lf.sys_style is 'æ ·å¼è¡¨'; |
| | | comment on column lf.sys_style.id is '主é®ID'; |
| | | comment on column lf.sys_style.name is 'åç§°'; |
| | |
| | | comment on column lf.sys_style.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_style.update_time is 'æ´æ°æ¶é´'; |
| | | comment on column lf.sys_style.bak is '夿³¨'; |
| | | |
| | | --insert into lf.sys_style (name,type,precision,descr) values ('line.edp','edp','1:1000','管éä¸å¿çº¿æ ·å¼æä»¶'); |
| | | |
| | | select count(*) from lf.sys_style where name like '%.edp'; |
| | |
| | | CONSTRAINT enforce_srid_geom CHECK (st_srid(geo) = 4490) |
| | | ); |
| | | create index index_sys_download_geo on lf.sys_download using gist (geo); |
| | | |
| | | comment on table lf.sys_download is 'ä¸è½½è®°å½è¡¨'; |
| | | comment on column lf.sys_download.id is '主é®ID'; |
| | | comment on column lf.sys_download.name is 'åç§°'; |
| | |
| | | comment on column lf.sys_download.download_time is 'ä¸è½½æ¶é´'; |
| | | comment on column lf.sys_download.geo is '空é´'; |
| | | comment on column lf.sys_download.bak is '夿³¨'; |
| | | |
| | | -- insert into lf.sys_download (name,pwd,url,descr) values ('2022-09-27','123456','','æµè¯ä¸è½½'); |
| | | |
| | | select * from lf.sys_download; |
| | |
| | | update_user integer, |
| | | update_time timestamp(6) without time zone |
| | | ); |
| | | |
| | | comment on table lf.sys_msg is 'æ¶æ¯éç¥è¡¨'; |
| | | comment on column lf.sys_msg.id is '主é®ID'; |
| | | comment on column lf.sys_msg.title is 'æ é¢'; |
| | |
| | | comment on column lf.sys_msg.create_time is 'å建æ¶é´'; |
| | | comment on column lf.sys_msg.update_user is 'æ¥å人ID'; |
| | | comment on column lf.sys_msg.update_time is 'æ¥åæ¶é´'; |
| | | |
| | | --insert into lf.sys_msg (title,msg,guid,update_user) values ('2022-09-26','æ°æ®ä¸è½½',new_guid(),2); |
| | | |
| | | select * from lf.sys_msg; |
| | |
| | | update_user integer, |
| | | update_time timestamp(6) without time zone |
| | | ); |
| | | |
| | | comment on table lf.sys_args is 'åæ°è®¾ç½®è¡¨'; |
| | | comment on column lf.sys_args.id is '主é®ID'; |
| | | comment on column lf.sys_args.name is 'åç§°'; |
| | |
| | | comment on column lf.sys_args.create_time is 'å建æ¶é´'; |
| | | comment on column lf.sys_args.update_user is 'æ´æ°äººID'; |
| | | comment on column lf.sys_args.update_time is 'æ´æ°æ¶é´'; |
| | | |
| | | /* insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,descr) values ('èªå¨ç»åºæ¶é´',15,15,3,1440,'é»è®¤ç¨æ·15åé䏿ä½ï¼å°±èªå¨ç»åºç³»ç»ã'); |
| | | insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,descr) values ('ä»¤çæææ',240,240,60,1440,'临æ¶ä»¤çé»è®¤æææä¸º240åéï¼4å°æ¶ï¼ï¼è¶
æ¶å°å¤±æã'); |
| | | insert into lf.sys_args (name,cvalue,dvalue,min_value,max_value,descr) values ('ç¼åæææ',240,240,60,1440,'ç¼åé»è®¤æææä¸º1440åéï¼1天ï¼ï¼è¶
æ¶å°å¤±æã'); */ |
| | |
| | | update_user integer, |
| | | update_time timestamp(6) without time zone |
| | | ); |
| | | |
| | | comment on table lf.sys_blacklist is 'é»åå表'; |
| | | comment on column lf.sys_blacklist.id is '主é®ID'; |
| | | comment on column lf.sys_blacklist.ip is 'IPå°å'; |
| | |
| | | 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); */ |
| | | |
| | | select * from lf.sys_blacklist; |
| | | ----------------------------------------------------------------------------------------------------- é彿¥è¯¢ |
| | | --------------------------------------------------------- æ¥è¯¢èå |
| | | select * from lf.sys_menu order by order_num; |
| | | |
| | | 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; |
| | | --------------------------------------------------------- æ¥è¯¢åä½ |
| | | select * from lf.sys_dep 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; |
| | | --------------------------------------------------------- æ°æ®ç®å½ |
| | | select * from lf.sys_dir 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; |
| | | ----------------------------------------------------------------------------------------------------- a.æ¥è¯¢è¿æ¥æ° |
| | | show max_connections; |
| | | select count(1) from pg_stat_activity; |
| | | ----------------------------------------------------------------------------------------------------- b.æ¥è¯¢è¡¨ç»æ |
| | | 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; |
| | | ----------------------------------------------------------------------------------------------------- c.GUIDçæå½æ° |
| | | CREATE or REPLACE FUNCTION new_guid() |
| | | RETURNS "pg_catalog"."varchar" AS $BODY$ |
| | | DECLARE |
| | | v_seed_value varchar(32); |
| | | BEGIN |
| | | select md5(inet_client_addr()::varchar || timeofday() || inet_server_addr()::varchar || to_hex(inet_client_port())) |
| | | into v_seed_value; |
| | | |
| | | return (substr(v_seed_value,1,8) || '-' || |
| | | substr(v_seed_value,9,4) || '-' || |
| | | substr(v_seed_value,13,4) || '-' || |
| | | substr(v_seed_value,17,4) || '-' || |
| | | substr(v_seed_value,21,12)); |
| | | END; |
| | | $BODY$ LANGUAGE 'plpgsql' VOLATILE SECURITY DEFINER; |
| | | |
| | | select new_guid(); |
| | | ----------------------------------------------------------------------------------------------------- d.é彿¥è¯¢å½æ° |
| | | -- drop function rec_query_dep(id integer, tab varchar); |
| | | create or replace function fn_rec_query(id integer, tab varchar) |
| | | returns varchar as $$ |
| | | declare |
| | | str varchar = ''; |
| | | rec varchar = ''; |
| | | begin |
| | | for rec in execute 'with recursive rs as(' || |
| | | 'select id,pid,name from lf.sys_' || tab || ' where id=' || id || |
| | | ' union select a.id,a.pid,a.name from lf.sys_' || tab || ' a, rs b where a.id=b.pid '|| |
| | | ') select name from rs order by id' |
| | | loop |
| | | str = str || '\' || rec; |
| | | end loop; |
| | | |
| | | if (char_length(str) > 1) then |
| | | str = substring(str, 2); |
| | | end if; |
| | | |
| | | return str; |
| | | end; |
| | | $$ language plpgsql; |
| | | |
| | | select fn_rec_query(1, 'dep'); |
| | | select fn_rec_query(21, 'dep'); |
| | | select * from lf.sys_dep order by id; |
| | | |
| | | select fn_rec_query(10, 'dir'); |
| | | select fn_rec_query(28, 'dir'); |
| | | select * from lf.sys_dir order by id; |
| | | |
| | | select a.*, fn_rec_query(a.depid, 'dep') depName from lf.sys_user a order by a.id; |
| | | ----------------------------------------------------------------------------------------------------- e.æ¥è¯¢ç¨æ·å |
| | | -- 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) |
| | | returns varchar as $$ |
| | | declare |
| | | str varchar; |
| | | begin |
| | | if (id is null) then |
| | | return null; |
| | | end if; |
| | | |
| | | execute 'select uname from lf.sys_user where id = ' || id into str; |
| | | |
| | | return str; |
| | | end; |
| | | $$ language plpgsql; |
| | | |
| | | select fn_uname(null); |
| | | select uname from lf.sys_user where id = 1 limit 1; |
| | | ----------------------------------------------------------------------------------------------------- f.é彿¥è¯¢IDæ°ç» |
| | | -- drop function fn_rec_array(id integer, tab varchar); |
| | | create or replace function fn_rec_array(id integer, tab varchar) |
| | | returns integer[] as $$ |
| | | declare |
| | | ids integer[]; |
| | | sid integer; |
| | | begin |
| | | for sid in execute 'with recursive rs as(' || |
| | | 'select id,pid from lf.sys_' || tab || ' where id=' || id || |
| | | ' union select a.id,a.pid from lf.sys_' || tab || ' a, rs b where a.pid=b.id '|| |
| | | ') select id from rs order by id' |
| | | loop |
| | | select array_append(ids, sid) into ids; |
| | | end loop; |
| | | |
| | | return ids; |
| | | end; |
| | | $$ language plpgsql; |
| | | |
| | | select fn_rec_array(1, 'dep'); |
| | | select * from lf.sys_user a where a.depid=ANY(fn_rec_array(15,'dep')); |
| | | |
| | | select fn_rec_array(10, 'dir'); |
| | | ----------------------------------------------------------------------------------------------------- |
| | | select a.*,fn_uname(a.create_user) createUserName,fn_uname(a.update_user) updateUserName from lf.sys_blacklist a order by a.id; |
| | | ----------------------------------------------------------------------------------------------------- |