#创建临时表 create table gxtterms_ces_cloud_saas_storage.temp_fileconvert_info as select * from gxtterms_ces_cloud_saas_storage.t_fileconvert_file_info where 1=2; #插入转换基础数据 INSERT INTO gxtterms_ces_cloud_saas_storage.temp_fileconvert_info( id,orgin_file_path,file_name,file_catalog,source_file_format, convert_flag,target_file_format,target_file_path, tenant_id,bucket_name,file_storage_id,is_uploaded,is_encryption) select lower(RAWTOHEX(sys_guid())),file_storage_locate,name ,'1' ,upper(file_type), '0' ,'PDF',CONCAT( SUBSTRING_INDEX(file_storage_locate, '.', 1), '_L.pdf'), '2' ,'dc01-gxtterms-qas-01',id ,'0','0' from gxtterms_ces_cloud_saas_storage.apma_file_storage_2 where is_delete=0 ---------多个表的话按顺序重复这一部分操作,直到表里的数据全部更新 开始--------------------------- --更新D表的ID和全宗号,注意修改里面的D表 --待分类(3条语句一次执行完) UPDATE gxtterms_ces_cloud_saas_storage.temp_fileconvert_info f JOIN gxtterms_db_0.t_2_ws_dfl_32_d d ON f.file_storage_id = d.file_storage_id and d.file_size < 524288000 SET f.archive_id = d.id ,f.fonds_code='DQ001'; --更新archive_type_code,注意修改里面的D表 update gxtterms_ces_cloud_saas_storage.temp_fileconvert_info f set archive_type_code = (select archive_type_code from ces_cloud_saas_app.apma_archive_table where storage_locate='t_2_ws_dfl_32_d') where f.archive_id is not null and f.archive_type_code is null; --更新template_table_id,注意修改里面的D表 update gxtterms_ces_cloud_saas_storage.temp_fileconvert_info f set template_table_id = (select template_table_id from ces_cloud_saas_app.apma_archive_table where storage_locate='t_2_ws_dfl_32_d') where f.archive_id is not null and f.template_table_id is null; --文书同步信息3条语句一次执行完) UPDATE gxtterms_ces_cloud_saas_storage.temp_fileconvert_info f JOIN gxtterms_db_0.t_2_ws_ws_14_d d ON f.file_storage_id = d.file_storage_id and d.file_size < 524288000 SET f.archive_id = d.id ,f.fonds_code='DQ001'; --更新archive_type_code,注意修改里面的D表 update gxtterms_ces_cloud_saas_storage.temp_fileconvert_info f set archive_type_code = (select archive_type_code from ces_cloud_saas_app.apma_archive_table where storage_locate='t_2_ws_ws_14_d') where f.archive_id is not null and f.archive_type_code is null; --更新template_table_id,注意修改里面的D表 update gxtterms_ces_cloud_saas_storage.temp_fileconvert_info f set template_table_id = (select template_table_id from ces_cloud_saas_app.apma_archive_table where storage_locate='t_2_ws_ws_14_d') where f.archive_id is not null and f.template_table_id is null; #---------------------------多个表的话重复这一段,直到表里的数据全部更新 结束--------------------------- #插入到最终的格式转换表 insert into gxtterms_ces_cloud_saas_storage.t_fileconvert_file_info (id,orgin_file_path,file_name,file_catalog,source_file_format,convert_flag,target_file_format,target_file_path,tenant_id,bucket_name,file_storage_id,is_uploaded,archive_id,archive_type_code,template_table_id,fonds_code,is_encryption) select id,orgin_file_path,file_name,file_catalog,source_file_format,convert_flag,target_file_format,target_file_path,tenant_id,bucket_name,file_storage_id,is_uploaded,archive_id,archive_type_code,template_table_id,fonds_code,is_encryption from gxtterms_ces_cloud_saas_storage.temp_fileconvert_info where archive_id is not null