| | |
| | | ----------------------------------------------------------------------------------------------------- 递归查询 |
| | | ----------------------------------------------------------------------------------------------------- 1.查询连接数 |
| | | show max_connections; |
| | | select count(1) from pg_stat_activity; |
| | | ----------------------------------------------------------------------------------------------------- a.递归查询 |
| | | --------------------------------------------------------- 查询菜单 |
| | | select * from lf.sys_menu order by order_num; |
| | | |
| | |
| | | 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 fn_rec_array(10, 'dir'); |
| | | ----------------------------------------------------------------------------------------------------- g.索引 |
| | | -- 创建联合唯一索引 |
| | | 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); |
| | | 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; |
| | | ----------------------------------------------------------------------------------------------------- |
| | | 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 |
| | | where exist |
| | | |
| | | select * from lf.sys_user a where not exists (select id from lf.sys_role_user b where b.userid = a.id and b.roleid = 1) |
| | | 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_uname(a.userid) uname from lf.sys_role_user a order by a.id |
| | | select a.*,fn_uname(a.userid) uname from lf.sys_role_user a where a.id = 1 |
| | | 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; |
| | | select * from lf.sys_menu; |
| | | select * from lf.sys_menu_auth; |
| | | |
| | | 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 * from lf.sys_res; |
| | | select * from lf.sys_role; |
| | | select * from lf.sys_role_res;` ` |
| | | |
| | | 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 * from lf.sys_role; |
| | | select * from lf.sys_menu; |
| | | select * from lf.sys_auth; |
| | | select * from lf.sys_menu_auth; |
| | | select * from lf.sys_role_menu_auth; |
| | | |
| | | 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; |
| | | ----------------------------------------------------------------------------------------------------- |
| | | select * from lf.sys_user; |
| | | select gid,gb,name,st_astext(a.geom) from bd.dlg_agnp a; |
| | | |
| | | |
| | | |