------------------------------------------------------ 补充字段 *
-- alter table lf.sys_meta rename column bstab to tab; alter table lf.sys_meta drop column mdtab;
alter table lf.sys_fme_log add column create_time timestamp(6) without time zone default now();
alter table lf.sys_meta add column layer varchar(50);
comment on column lf.sys_meta.layer is '图层';
select * from lf.sys_fme_log;
select * from lf.sys_meta order by guid,tab; -- delete from lf.sys_meta where id> 31;
-- delete from lf.sys_meta; alter sequence lf.sys_meta_id_seq restart with 1;

select * from lf.sys_token where create_time < '2023-01-10';
-- delete from lf.sys_token where create_time < '2023-01-10';
select * from lf.sys_operate where optime < '2023-01-10';
-- 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 * from lf.sys_menu where cn_name = '数据库监控';
-- update lf.sys_menu set url = 'http://pipe.cppe.com:8088/server/druid/index.html' where cn_name = '数据库监控';

select * from lf.sys_user; -- Admin@1234_lf
-- update lf.sys_user set pwd = 'd4d25475a81ef4db4b28ce4034500f896169f15c0c68da5d';

select * from lf.sys_menu order by id;
update lf.sys_menu set url = 'http://pipe.cppe.com:88/dataxdi/#/schema/list?tags=入库质检&embed=true&theme=dark&lang=zh&token=' where cn_name = '入库质检';
update lf.sys_menu set url = 'http://pipe.cppe.com:88/dataxdi/#/schema/list?tags=成果质检&embed=true&theme=dark&lang=zh&token=' where cn_name = '成果质检';
update lf.sys_menu set url = 'http://pipe.cppe.com:88/dataxdi/#/task/list?embed=true&theme=dark&lang=zh&token=' where cn_name = '任务状态' and id = 69;

update lf.sys_menu set url = 'http://pipe.cppe.com:88/dataxdi/#/schema/list?tags=数据交换&embed=true&theme=dark&lang=zh&token=' where cn_name = '格式转换';
update lf.sys_menu set url = 'http://pipe.cppe.com:88/dataxdi/#/schema/list?tags=坐标转换&embed=true&theme=dark&lang=zh&token=' where cn_name = '坐标转换';
update lf.sys_menu set url = 'http://pipe.cppe.com:88/dataxdi/#/schema/list?tags=数据分发&embed=true&theme=dark&lang=zh&token=' where cn_name = '数据分发';
update lf.sys_menu set url = 'http://pipe.cppe.com:88/dataxdi/#/schema/list?tags=数据治理&embed=true&theme=dark&lang=zh&token=' where cn_name = '数据治理';
update lf.sys_menu set url = 'http://pipe.cppe.com:88/dataxdi/#/task/list?embed=true&theme=dark&lang=zh&token=' where cn_name = '任务状态' and id = 74;

update lf.sys_menu set url = 'http://pipe.cppe.com:88/resm/#/resourceManage?embed=true&theme=dark&lang=zh&token=' where cn_name = '我的资源';
update lf.sys_menu set url = 'http://pipe.cppe.com:88/resm/#/resapproval?embed=true&theme=dark&lang=zh&token=' where cn_name = '资源审核';
------------------------------------------------------ FME_数据质检
select * from lf.sys_menu where cn_name = '入库质检';
update lf.sys_menu set url = 'http://10.7.0.186:88/dataxdi/#/schema/list?tags=入库质检&embed=true&token=' where cn_name = '入库质检';

select * from lf.sys_menu where cn_name = '成果质检';
update lf.sys_menu set url = 'http://10.7.0.186:88/dataxdi/#/schema/list?tags=成果质检&embed=true&token=' where cn_name = '成果质检';

select * from lf.sys_menu where cn_name = '任务状态' and id = 69;
update lf.sys_menu set url = 'http://10.7.0.186:88/dataxdi/#/task/list?embed=true&token=' where cn_name = '任务状态' and id = 69;
------------------------------------------------------ FME_数据交换
select * from lf.sys_menu where cn_name = '格式转换';
update lf.sys_menu set url = 'http://10.7.0.186:88/dataxdi/#/schema/list?tags=数据交换&embed=true&token=' where cn_name = '格式转换';

select * from lf.sys_menu where cn_name = '坐标转换';
update lf.sys_menu set url = 'http://10.7.0.186:88/dataxdi/#/schema/list?tags=坐标转换&embed=true&token=' where cn_name = '坐标转换';

select * from lf.sys_menu where cn_name = '数据分发';
update lf.sys_menu set url = 'http://10.7.0.186:88/dataxdi/#/schema/list?tags=数据分发&embed=true&token=' where cn_name = '数据分发';

select * from lf.sys_menu where cn_name = '数据治理';
update lf.sys_menu set url = 'http://10.7.0.186:88/dataxdi/#/schema/list?tags=数据治理&embed=true&token=' where cn_name = '数据治理';

select * from lf.sys_menu where cn_name = '任务状态' and id = 74;
update lf.sys_menu set url = 'http://10.7.0.186:88/dataxdi/#/task/list?embed=true&token=' where cn_name = '任务状态' and id = 74;
------------------------------------------------------ FME_服务管理
select * from lf.sys_menu where cn_name = '我的资源';
update lf.sys_menu set url = 'http://10.7.0.186:88/resm/#/resourceManage?embed=true&token=' where cn_name = '我的资源';

select * from lf.sys_menu where cn_name = '资源审核';
update lf.sys_menu set url = 'http://10.7.0.186:88/resm/#/resapproval?embed=true&token=' where cn_name = '资源审核';
------------------------------------------------------ 初始化元数据
insert into lf.sys_meta (name,dirid) values ('项目WBS导出.xlsx',57);
insert into lf.sys_meta (name,dirid) values ('00116BT02-CR001#ESV-DW-0101 封面.docx',62);
insert into lf.sys_meta (name,dirid) values ('00116BT02-CR001#ESV-DW-0101（大河沿河穿越地形图）0.dwg',62);
insert into lf.sys_meta (name,dirid) values ('00116BT02-CR001#ESV-DW-0101（大河沿河穿越地形图）0.dwl',62);
insert into lf.sys_meta (name,dirid) values ('00116BT02-CR001#ESV-DW-0101（大河沿河穿越地形图）0.dwl2',62);
insert into lf.sys_meta (name,dirid) values ('00116BT02-CR001#ESV-DW-0101（大河沿河穿越纵断面图）0.dwg',62);
insert into lf.sys_meta (name,dirid) values ('00116BT02-CR001#ESV-IN-0101（资料图纸目录）.doc',62);
insert into lf.sys_meta (name,dirid) values ('1类.gdb',74);
insert into lf.sys_meta (name,dirid) values ('2类.gdb',74);
insert into lf.sys_meta (name,dirid) values ('易燃易爆.gdb',74);
insert into lf.sys_meta (name,dirid) values ('地面线.xlsx',64);
insert into lf.sys_meta (name,dirid) values ('控制点.xlsx',64);
insert into lf.sys_meta (name,dirid) values ('离散点.xlsx',64);
insert into lf.sys_meta (name,dirid) values ('平面图索引文件.xlsx',64);
insert into lf.sys_meta (name,dirid) values ('中线成果表.xlsx',64);

update lf.sys_meta set depid=1,type='file',path='2\'||name,sizes=1;

insert into lf.sys_meta (name,dirid) values ('S318 洛陕线穿越工程地质剖面图.dwg',80);
insert into lf.sys_meta (name,dirid) values ('地质剖面图索引表.xlsx',80);
insert into lf.sys_meta (name,dirid) values ('地质资料表.xlsx',80);
insert into lf.sys_meta (name,dirid) values ('勘探点坐标表.xlsx',80);
insert into lf.sys_meta (name,dirid) values ('土壤电阻率表.xlsx',80);

update lf.sys_meta set depid=1,type='file',path='2\'||name,sizes=1 where path is null;

with rs as (select id from lf.sys_dir where name='西气东输四线天然气管道工程（吐鲁番-中卫）（00116BT02）')
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\';
--------------------------------------------------------- alter sequence lf.sys_meta_id_seq restart with 1;
update lf.sys_operate set modular2='源数据管理' where modular2='元数据';

delete from lf.sys_dep where id = 59;
update lf.sys_dep set bak = null where bak = ' ';
update lf.sys_dep set code = null;
update lf.sys_dep set code = '00' where pid = 0;
update lf.sys_dep set level = level + 1;
alter table lf.sys_dep alter column code type varchar(24);

select id,pid,name,code,level,order_num from lf.sys_dep where code is not null order by code;
---------------------------------------------------------
select * from lf.sys_dir  order by id;

alter table lf.sys_dir alter column code type varchar(200);
alter table lf.sys_dir rename column code to exts;
alter table lf.sys_dir alter column bak type varchar(100);
alter table lf.sys_dir rename column bak to checks;
alter table lf.sys_dir add column bak varchar(1024);
update lf.sys_dir set bak=checks where checks is not null and position('check' in checks)=0;
update lf.sys_dir set checks=null where position('check' in checks)=0;
alter table lf.sys_dir add column code varchar(24);

select id,pid,name,code,level,order_num from lf.sys_dir where code is not null order by code;
---------------------------------------------------------
select * from lf.sys_meta;









