From 3bdfa819470bb0c3ec0ec840895a9f0cbd6c51ff Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期一, 26 九月 2022 09:05:36 +0800 Subject: [PATCH] 1 --- data/db.sql | 639 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 2 files changed, 630 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 549e00a..67a2fab 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ ### VS Code ### .vscode/ +/data/*.backup diff --git a/data/db.sql b/data/db.sql index 5315287..e536642 100644 --- a/data/db.sql +++ b/data/db.sql @@ -1,4 +1,22 @@ ------------------------------------------------------------------------------------------------------ 鑿滃崟琛� +----------------------------------------------------------------------------------------------------- 0.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(); +----------------------------------------------------------------------------------------------------- 1.鑿滃崟琛� -- DROP TABLE IF EXISTS lf.sys_menu; create table lf.sys_menu( id serial primary key, @@ -20,7 +38,7 @@ ); comment on table lf.sys_menu is '鑿滃崟琛�'; -comment on column lf.sys_menu.id is '涓婚敭'; +comment on column lf.sys_menu.id is '涓婚敭ID'; comment on column lf.sys_menu.pid is '鐖禝D,鏍硅妭鐐�-0'; comment on column lf.sys_menu.cn_name is '涓枃鍚嶇О'; comment on column lf.sys_menu.en_name is '鑻辨枃鍚嶇О'; @@ -42,7 +60,7 @@ --update lf.sys_menu set bak=null,create_time=now() where 1=1; select * from lf.sys_menu; ------------------------------------------------------------------------------------------------------ 缁勭粐鏈烘瀯琛� +----------------------------------------------------------------------------------------------------- 2.鍗曚綅琛� -- DROP TABLE IF EXISTS lf.sys_dep; create table lf.sys_dep( id serial primary key, @@ -67,7 +85,7 @@ ); comment on table lf.sys_dep is '鍗曚綅琛�'; -comment on column lf.sys_dep.id is '涓婚敭'; +comment on column lf.sys_dep.id is '涓婚敭ID'; comment on column lf.sys_dep.pid is '鐖禝D,鏍硅妭鐐�-0'; comment on column lf.sys_dep.name is '鍚嶇О'; comment on column lf.sys_dep.sname is '绠�绉�'; @@ -93,14 +111,14 @@ --update lf.sys_dep set bak=null,create_time=now() where 1=1; select * from lf.sys_dep; ------------------------------------------------------------------------------------------------------ 鐩綍绠$悊琛� +----------------------------------------------------------------------------------------------------- 3.鐩綍琛� -- DROP TABLE IF EXISTS lf.sys_dir; create table lf.sys_dir( id serial primary key, pid integer, name varchar(150), - code varchar(50), - descr varchar(1024), + code varchar(50), + descr varchar(1024), level integer, order_num integer, create_user integer, @@ -110,8 +128,8 @@ bak varchar(1024) ); -comment on table lf.sys_dir is '鐩綍绠$悊琛�'; -comment on column lf.sys_dir.id is '涓婚敭'; +comment on table lf.sys_dir is '鐩綍琛�'; +comment on column lf.sys_dir.id is '涓婚敭ID'; comment on column lf.sys_dir.pid is '鐖禝D,鏍硅妭鐐�-0'; comment on column lf.sys_dir.name is '鍚嶇О'; comment on column lf.sys_dir.code is '鐩綍缂栫爜'; @@ -128,16 +146,617 @@ --update lf.sys_dir set bak=null,create_time=now(),code=id where 1=1; select * from lf.sys_dir; ------------------------------------------------------------------------------------------------------------ +----------------------------------------------------------------------------------------------------- 4.鐢ㄦ埛琛� +-- DROP TABLE IF EXISTS lf.sys_user; +create table lf.sys_user( + id serial primary key, + depid integer default 1, + uid varchar(20) unique, + uname varchar(50), + pwd varchar(200), + salt varchar(20), + sex smallint default 1, + native varchar(50) default '姹�', + contact varchar(50), + job varchar(50), + email varchar(50), + addr varchar(300), + edu varchar(20), + idcard varchar(20), + status smallint default 0, + create_user integer, + create_time timestamp(6) without time zone default now(), + update_user integer, + 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.uid is '鐢ㄦ埛ID'; +comment on column lf.sys_user.uname is '鐢ㄦ埛鍚�'; +comment on column lf.sys_user.pwd is 'MD5瀵嗙爜'; +comment on column lf.sys_user.salt is 'MD5鐩�'; +comment on column lf.sys_user.sex is '鎬у埆锛�0-濂�,1-鐢�,-1-鏈煡'; +comment on column lf.sys_user.native is '绫嶈疮'; +comment on column lf.sys_user.contact is '鑱旂郴鏂瑰紡'; +comment on column lf.sys_user.job is '宸ヤ綔'; +comment on column lf.sys_user.email is '鐢靛瓙閭欢'; +comment on column lf.sys_user.addr is '鍦板潃'; +comment on column lf.sys_user.edu is '鏁欒偛'; +comment on column lf.sys_user.idcard is '璇佷欢鍙�'; +comment on column lf.sys_user.status is '鐘舵�侊細0-姝e父,1-绂佺敤,2-鍒犻櫎,3-鐢宠,4-鎷掓壒'; +comment on column lf.sys_user.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_user.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_user.update_user is '鏇存柊浜篒D'; +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); +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);*/ +select * from lf.sys_user; +----------------------------------------------------------------------------------------------------- 5.鐧诲綍鏃ュ織琛� +-- DROP TABLE IF EXISTS lf.sys_login; +create table lf.sys_login( + id serial8, + appid integer default 1, + ip varchar(30), + type smallint default 1, + status smallint default 1, + browser varchar(100), + userid integer default 1, + optime timestamp(6) without time zone default now() +) partition by range(optime); +create table lf.sys_login_2022 partition of lf.sys_login for values from ('2022-01-01') to ('2023-01-01'); +create INDEX index_sys_login_2022_optime on lf.sys_login_2022 (optime); +create table lf.sys_login_2023 partition of lf.sys_login for values from ('2023-01-01') to ('2024-01-01'); +create INDEX index_sys_login_2023_optime on lf.sys_login_2022 (optime); +create table lf.sys_login_2024 partition of lf.sys_login for values from ('2024-01-01') to ('2025-01-01'); +create INDEX index_sys_login_2024_optime on lf.sys_login_2022 (optime); +create table lf.sys_login_2025 partition of lf.sys_login for values from ('2025-01-01') to ('2026-01-01'); +create INDEX index_sys_login_2025_optime on lf.sys_login_2022 (optime); +create table lf.sys_login_2026 partition of lf.sys_login for values from ('2026-01-01') to ('2027-01-01'); +create INDEX index_sys_login_2026_optime on lf.sys_login_2022 (optime); +create table lf.sys_login_2027 partition of lf.sys_login for values from ('2027-01-01') to ('2028-01-01'); +create INDEX index_sys_login_2027_optime on lf.sys_login_2022 (optime); +comment on table lf.sys_login is '鐧诲綍鏃ュ織琛�'; +comment on column lf.sys_login.id is '涓婚敭ID'; +comment on column lf.sys_login.appid is '搴旂敤绋嬪簭ID锛�1-绠¢亾鍩虹澶ф暟鎹钩鍙�,2-澶栭儴绯荤粺闆嗘垚'; +comment on column lf.sys_login.ip is 'IP鍦板潃'; +comment on column lf.sys_login.type is '绫诲埆:1-鐧诲綍,2-鏍¢獙,3-鐧诲嚭'; +comment on column lf.sys_login.status is '鐘舵��:1-鎴愬姛,0-澶辫触'; +comment on column lf.sys_login.browser is '娴忚鍣�'; +comment on column lf.sys_login.userid is '鐧诲綍浜篒D'; +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; +----------------------------------------------------------------------------------------------------- 6.鎿嶄綔鏃ュ織琛� +-- DROP TABLE IF EXISTS lf.sys_operate; +create table lf.sys_operate( + id serial8, + modular varchar(60), + url varchar(256), + ip varchar(30), + type smallint default 1, + userid integer default 1, + optime timestamp(6) without time zone default now() +) partition by range(optime); +create table lf.sys_operate_2022 partition of lf.sys_operate for values from ('2022-01-01') to ('2023-01-01'); +create INDEX index_sys_operate_2022_optime on lf.sys_operate_2022 (optime); +create table lf.sys_operate_2023 partition of lf.sys_operate for values from ('2023-01-01') to ('2024-01-01'); +create INDEX index_sys_operate_2023_optime on lf.sys_operate_2022 (optime); +create table lf.sys_operate_2024 partition of lf.sys_operate for values from ('2024-01-01') to ('2025-01-01'); +create INDEX index_sys_operate_2024_optime on lf.sys_operate_2022 (optime); +create table lf.sys_operate_2025 partition of lf.sys_operate for values from ('2025-01-01') to ('2026-01-01'); +create INDEX index_sys_operate_2025_optime on lf.sys_operate_2022 (optime); +create table lf.sys_operate_2026 partition of lf.sys_operate for values from ('2026-01-01') to ('2027-01-01'); +create INDEX index_sys_operate_2026_optime on lf.sys_operate_2022 (optime); +create table lf.sys_operate_2027 partition of lf.sys_operate for values from ('2027-01-01') to ('2028-01-01'); +create INDEX index_sys_operate_2027_optime on lf.sys_operate_2022 (optime); +comment on table lf.sys_operate is '鎿嶄綔鏃ュ織琛�'; +comment on column lf.sys_operate.id is '涓婚敭ID'; +comment on column lf.sys_operate.modular is '鎿嶄綔妯″潡,濡�:鏁版嵁绠$悊\鐩綍绠$悊'; +comment on column lf.sys_operate.url is '鎿嶄綔缃戝潃'; +comment on column lf.sys_operate.ip is 'IP鍦板潃'; +comment on column lf.sys_operate.type is '绫诲埆:1-鏌ョ湅,2-鏂板,3-淇敼,4-鍒犻櫎,5-涓婁紶,6-涓嬭浇'; +comment on column lf.sys_operate.userid is '鎿嶄綔浜篒D'; +comment on column lf.sys_operate.optime is '鎿嶄綔鏃堕棿'; + +/*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');*/ + +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( + id serial8, + token varchar(40), + duration integer default 240, + expire timestamp(6) without time zone default now()::timestamp + '4 hour', + type smallint default 0, + ip varchar(30), + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + update_user integer, + update_time timestamp(6) without time zone +) partition by range(create_time); + +create table lf.sys_token_2022 partition of lf.sys_token for values from ('2022-01-01') to ('2023-01-01'); +create INDEX index_sys_token_2022_create_time on lf.sys_token_2022 (create_time); +create table lf.sys_token_2023 partition of lf.sys_token for values from ('2023-01-01') to ('2024-01-01'); +create INDEX index_sys_token_2023_create_time on lf.sys_token_2022 (create_time); +create table lf.sys_token_2024 partition of lf.sys_token for values from ('2024-01-01') to ('2025-01-01'); +create INDEX index_sys_token_2024_create_time on lf.sys_token_2022 (create_time); +create table lf.sys_token_2025 partition of lf.sys_token for values from ('2025-01-01') to ('2026-01-01'); +create INDEX index_sys_token_2025_create_time on lf.sys_token_2022 (create_time); +create table lf.sys_token_2026 partition of lf.sys_token for values from ('2026-01-01') to ('2027-01-01'); +create INDEX index_sys_token_2026_create_time on lf.sys_token_2022 (create_time); +create table lf.sys_token_2027 partition of lf.sys_token for values from ('2027-01-01') to ('2028-01-01'); +create INDEX index_sys_token_2027_create_time on lf.sys_token_2022 (create_time); + +comment on table lf.sys_token is '浠ょ墝琛�'; +comment on column lf.sys_token.id is '涓婚敭ID'; +comment on column lf.sys_token.token is '浠ょ墝'; +comment on column lf.sys_token.duration is '浣跨敤鏃堕棿,榛樿4灏忔椂,240鍒嗛挓'; +comment on column lf.sys_token.expire is '澶辨晥鏃堕棿'; +comment on column lf.sys_token.type is '绫诲瀷锛�0-涓存椂锛�1-鍥哄畾'; +comment on column lf.sys_token.ip is 'IP鍦板潃'; +comment on column lf.sys_token.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_token.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_token.update_user is '鏇存柊浜篒D'; +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; +select * from lf.sys_token_2022; +select * from lf.sys_token_2023; +----------------------------------------------------------------------------------------------------- 8.璧勬簮琛� +-- DROP TABLE IF EXISTS lf.sys_res; +create table lf.sys_res( + id serial primary key, + name varchar(50), + server varchar(300), + source varchar(300), + depid integer default 1, + dirid integer default 1, + code varchar(30), + descr varchar(200), + img varchar(40), + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + update_user integer, + 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.server is '鏈嶅姟鍦板潃'; +comment on column lf.sys_res.source is '鍘熷鍦板潃'; +comment on column lf.sys_res.depid is '鍗曚綅ID'; +comment on column lf.sys_res.dirid is '鐩綍ID'; +comment on column lf.sys_res.code is '缂栫爜'; +comment on column lf.sys_res.descr is '鎻忚堪'; +comment on column lf.sys_res.img is '棰勮鍥�'; +comment on column lf.sys_res.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_res.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_res.update_user is '鏇存柊浜篒D'; +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; +----------------------------------------------------------------------------------------------------- 9.璧勬簮鎿嶄綔琛� +-- DROP TABLE IF EXISTS lf.sys_res_op; +create table lf.sys_res_op( + id serial8, + resid integer, + type smallint default 1, + ip varchar(30), + userid integer default 1, + optime timestamp(6) without time zone default now() +) partition by range(optime); + +create table lf.sys_res_op_2022 partition of lf.sys_res_op for values from ('2022-01-01') to ('2023-01-01'); +create INDEX index_sys_res_op_2022_optime on lf.sys_res_op_2022 (optime); +create table lf.sys_res_op_2023 partition of lf.sys_res_op for values from ('2023-01-01') to ('2024-01-01'); +create INDEX index_sys_res_op_2023_optime on lf.sys_res_op_2022 (optime); +create table lf.sys_res_op_2024 partition of lf.sys_res_op for values from ('2024-01-01') to ('2025-01-01'); +create INDEX index_sys_res_op_2024_optime on lf.sys_res_op_2022 (optime); +create table lf.sys_res_op_2025 partition of lf.sys_res_op for values from ('2025-01-01') to ('2026-01-01'); +create INDEX index_sys_res_op_2025_optime on lf.sys_res_op_2022 (optime); +create table lf.sys_res_op_2026 partition of lf.sys_res_op for values from ('2026-01-01') to ('2027-01-01'); +create INDEX index_sys_res_op_2026_optime on lf.sys_res_op_2022 (optime); +create table lf.sys_res_op_2027 partition of lf.sys_res_op for values from ('2027-01-01') to ('2028-01-01'); +create INDEX index_sys_res_op_2027_optime on lf.sys_res_op_2022 (optime); + +comment on table lf.sys_res_op is '璧勬簮鎿嶄綔琛�'; +comment on column lf.sys_res_op.id is '涓婚敭ID'; +comment on column lf.sys_res_op.resid is '璧勬簮ID'; +comment on column lf.sys_res_op.type is '鎿嶄綔绫诲瀷:1-鏌ョ湅,2-鏂板,3-淇敼,4-鍒犻櫎,5-涓婁紶,6-涓嬭浇'; +comment on column lf.sys_res_op.ip is 'IP鍦板潃'; +comment on column lf.sys_res_op.userid is '鎿嶄綔浜篒D'; +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,optime) values (1,'192.168.20.107',4,'2024-01-02');*/ + +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( + id serial primary key, + name varchar(100), + tag varchar(100), + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + update_user integer, + 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.tag is '鏍囪瘑'; +comment on column lf.sys_auth.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_auth.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_auth.update_user is '鏇存柊浜篒D'; +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'); +insert into lf.sys_auth (name,tag) values ('鍒犻櫎','delete'); +insert into lf.sys_auth (name,tag) values ('涓婁紶','upload'); +insert into lf.sys_auth (name,tag) values ('涓嬭浇','download');*/ + +select * from lf.sys_auth; +----------------------------------------------------------------------------------------------------- 11.瑙掕壊琛� +-- DROP TABLE IF EXISTS lf.sys_role; +create table lf.sys_role( + id serial primary key, + depid integer default 1, + name varchar(100), + descr varchar(100), + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + update_user integer, + 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.name is '鍚嶇О'; +comment on column lf.sys_role.descr is '鎻忚堪'; +comment on column lf.sys_role.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_role.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_role.update_user is '鏇存柊浜篒D'; +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; +----------------------------------------------------------------------------------------------------- 12.瑙掕壊-鐢ㄦ埛琛� +-- DROP TABLE IF EXISTS lf.sys_role_user; +create table lf.sys_role_user( + id serial primary key, + roleid integer, + userid integer, + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + 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.userid is '鐢ㄦ埛ID'; +comment on column lf.sys_role_user.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_role_user.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_role_user.update_user is '鏇存柊浜篒D'; +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; +----------------------------------------------------------------------------------------------------- 13.瑙掕壊-璧勬簮琛� +-- DROP TABLE IF EXISTS lf.sys_role_res; +create table lf.sys_role_res( + id serial primary key, + roleid integer, + resid integer, + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + 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.resid is '璧勬簮ID'; +comment on column lf.sys_role_res.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_role_res.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_role_res.update_user is '鏇存柊浜篒D'; +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; +----------------------------------------------------------------------------------------------------- 14.瑙掕壊-鑿滃崟琛� +-- DROP TABLE IF EXISTS lf.sys_role_menu; +create table lf.sys_role_menu( + id serial primary key, + roleid integer, + menuid integer, + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + update_user integer, + update_time timestamp(6) without time zone +); + +comment on table lf.sys_role_menu is '瑙掕壊-鑿滃崟琛�'; +comment on column lf.sys_role_menu.id is '涓婚敭ID'; +comment on column lf.sys_role_menu.roleid is '瑙掕壊ID'; +comment on column lf.sys_role_menu.menuid is '鑿滃崟ID'; +comment on column lf.sys_role_menu.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_role_menu.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_role_menu.update_user is '鏇存柊浜篒D'; +comment on column lf.sys_role_menu.update_time is '鏇存柊鏃堕棿'; + +--insert into lf.sys_role_menu (roleid,menuid) values (1,1); + +select * from lf.sys_role_menu; +----------------------------------------------------------------------------------------------------- 15.鑿滃崟-鏉冮檺琛� +-- DROP TABLE IF EXISTS lf.sys_menu_auth; +create table lf.sys_menu_auth( + id serial primary key, + menuid integer, + authid integer, + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + 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.authid is '鏉冮檺ID'; +comment on column lf.sys_menu_auth.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_menu_auth.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_menu_auth.update_user is '鏇存柊浜篒D'; +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; +----------------------------------------------------------------------------------------------------- 16.鍏冩暟鎹〃 +-- DROP TABLE IF EXISTS lf.sys_meta; +create table lf.sys_meta( + id serial primary key, + dirid integer, + depid integer, + name varchar(256), + descr varchar(256), + guid varchar(40) default null, + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + update_user integer, + update_time timestamp(6) without time zone, + geo geometry default null, + CONSTRAINT enforce_dims_geom CHECK (st_ndims(geo) = 2), + CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geo) = 'POLYGON'::text OR geo IS NULL), + 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.depid is '鍗曚綅ID'; +comment on column lf.sys_meta.name is '鍚嶇О'; +comment on column lf.sys_meta.descr is '鎻忚堪'; +comment on column lf.sys_meta.guid is 'GUID'; +comment on column lf.sys_meta.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_meta.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_meta.update_user is '鏇存柊浜篒D'; +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( + id serial primary key, + metaid integer, + name varchar(256), + guid varchar(40) default new_guid(), + path varchar(512), + fileid integer default 0, + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + 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 '鍏冩暟鎹甀D'; +comment on column lf.sys_meta_file.name is '鏂囦欢鍚�'; +comment on column lf.sys_meta_file.guid is 'GUID'; +comment on column lf.sys_meta_file.path is '瀛樺偍璺緞'; +comment on column lf.sys_meta_file.fileid is '鐖舵枃浠禝D锛�0-娌℃湁'; +comment on column lf.sys_meta_file.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_meta_file.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_meta_file.update_user is '鏇存柊浜篒D'; +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; +----------------------------------------------------------------------------------------------------- 18.闄勪欢琛� +-- DROP TABLE IF EXISTS lf.sys_attach; +create table lf.sys_attach( + id serial primary key, + name varchar(256), + tab varchar(100), + guid varchar(40) default new_guid(), + path varchar(512), + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + 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.tab is '琛ㄥ悕锛屽锛歱ublic.data_dir'; +comment on column lf.sys_attach.guid is 'GUID'; +comment on column lf.sys_attach.path is '瀛樺偍璺緞'; +comment on column lf.sys_attach.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_attach.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_attach.update_user is '鏇存柊浜篒D'; +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; +----------------------------------------------------------------------------------------------------- 19.鐗堟湰琛� +-- DROP TABLE IF EXISTS lf.sys_ver; +create table lf.sys_ver( + id serial primary key, + dirid integer, + name varchar(50), + descr varchar(256), + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + 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.name is '鍚嶇О'; +comment on column lf.sys_ver.descr is '鎻忚堪'; +comment on column lf.sys_ver.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_ver.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_ver.update_user is '鏇存柊浜篒D'; +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; +----------------------------------------------------------------------------------------------------- 20.瀛楀吀琛� +-- DROP TABLE IF EXISTS lf.sys_dict; + +----------------------------------------------------------------------------------------------------- 21.鏍峰紡琛� +-- DROP TABLE IF EXISTS lf.sys_style; +create table lf.sys_style( + id serial primary key, + name varchar(50), + guid varchar(40) default new_guid(), + fileid integer, + viewid integer, + descr varchar(256), + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + update_user integer, + 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.guid is 'GUID'; +comment on column lf.sys_style.fileid is '鏍峰紡鏂囦欢ID'; +comment on column lf.sys_style.viewid is '棰勮鏂囦欢ID'; +comment on column lf.sys_style.descr is '鎻忚堪'; +comment on column lf.sys_style.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_style.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_style.update_user is '鏇存柊浜篒D'; +comment on column lf.sys_style.update_time is '鏇存柊鏃堕棿'; +comment on column lf.sys_style.bak is '澶囨敞'; + +--insert into lf.sys_style (name,fileid,viewid) values ('pp.edp',1,1); + +select * from lf.sys_style; +----------------------------------------------------------------------------------------------------- 22.涓撻鍥惧嚭鍥捐〃 +-- DROP TABLE IF EXISTS lf.sys_drawing; + +----------------------------------------------------------------------------------------------------- 23.涓嬭浇璁板綍琛� +-- DROP TABLE IF EXISTS lf.sys_download; + +----------------------------------------------------------------------------------------------------- 24.娑堟伅閫氱煡琛� +-- DROP TABLE IF EXISTS lf.sys_msg; + +----------------------------------------------------------------------------------------------------- 25.鍙傛暟璁剧疆琛� +-- DROP TABLE IF EXISTS lf.sys_args; +create table lf.sys_args( + id serial primary key, + name varchar(50), + cvalue integer default 0, + dvalue integer default 0, + descr varchar(256), + create_user integer default 1, + create_time timestamp(6) without time zone default now(), + 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.cvalue is '褰撳墠鍊�'; +comment on column lf.sys_args.dvalue is '榛樿鍊�'; +comment on column lf.sys_args.descr is '鎻忚堪'; +comment on column lf.sys_args.create_user is '鍒涘缓浜篒D'; +comment on column lf.sys_args.create_time is '鍒涘缓鏃堕棿'; +comment on column lf.sys_args.update_user is '鏇存柊浜篒D'; +comment on column lf.sys_ver.update_time is '鏇存柊鏃堕棿'; + +/*insert into lf.sys_args (name,cvalue,dvalue,descr) values ('鑷姩鐧诲嚭鏃堕棿',15,15,'榛樿鐢ㄦ埛15鍒嗛挓涓嶆搷浣滐紝灏辫嚜鍔ㄧ櫥鍑虹郴缁熴��'); +insert into lf.sys_args (name,cvalue,dvalue,descr) values ('浠ょ墝鏈夋晥鏈�',240,240,'涓存椂浠ょ墝榛樿鏈夋晥鏈熶负240鍒嗛挓锛�4灏忔椂锛夛紝瓒呮椂灏嗗け鏁堛��'); +insert into lf.sys_args (name,cvalue,dvalue,descr) values ('缂撳瓨鏈夋晥鏈�',1440,1440,'缂撳瓨榛樿鏈夋晥鏈熶负1440鍒嗛挓锛�1澶╋級锛岃秴鏃跺皢澶辨晥銆�');*/ + +select * from lf.sys_args; +------------------------------------------------------------------------------------------------------------------ -- Gitblit v1.9.3