ALTER TABLE `rec_loan`.`biz_record_result` DROP COLUMN `sys_name`;

-- 删除表
DROP TABLE rec_accounting_tmp;
DROP TABLE rec_accounting_his;
DROP TABLE biz_accounting;
DROP TABLE biz_core_keep;
DROP TABLE biz_core_keep_obj_map;
DROP TABLE rec_accounting_sub_tmp;
DROP TABLE rec_accounting_sub_his;
DROP TABLE rec_accounting_sub_check;
DROP TABLE rec_lending_detail_tmp;
DROP TABLE rec_lending_detail_his;
DROP TABLE rec_loan_detail_tmp;
DROP TABLE rec_loan_detail_his;
DROP TABLE rec_repay_plan_tmp;
DROP TABLE rec_repay_plan_his;
DROP TABLE fac_loan_repay_plan;
DROP TABLE rec_repay_loan_detail_tmp;
DROP TABLE rec_repay_loan_detail_his;
DROP TABLE rec_repay_instmnt_detail_tmp;
DROP TABLE rec_repay_instmnt_detail_his;
DROP TABLE pls_repay_plan_detail;
DROP TABLE rec_exempt_loan_detail_tmp;
DROP TABLE rec_exempt_loan_detail_his;
DROP TABLE rec_exempt_instmnt_detail_tmp;
DROP TABLE rec_exempt_instmnt_detail_his;
DROP TABLE rec_loan_fin_tmp;
DROP TABLE rec_loan_fin_his;
DROP TABLE rec_instmnt_fin_tmp;
DROP TABLE rec_instmnt_fin_his;
DROP TABLE rec_ar_status_change_tmp;
DROP TABLE rec_ar_status_change_his;
DROP TABLE rec_fund_detail_tmp;
DROP TABLE rec_fund_detail_his;
DROP TABLE rec_loan_int_calc_tmp;
DROP TABLE rec_loan_int_calc_his;
DROP TABLE rec_charge_detail_tmp;
DROP TABLE rec_charge_detail_his;
DROP TABLE rec_fund_title_bal_tmp;
DROP TABLE rec_fund_title_bal_his;
DROP TABLE rec_file_check;
DROP TABLE rec_fund_file_check;
DROP TABLE rec_supv_contract_tmp;
DROP TABLE rec_supv_contract_his;
DROP TABLE rec_supv_cust_tmp;
DROP TABLE rec_supv_cust_his;
DROP TABLE rec_client_info_tmp;
DROP TABLE rec_client_info_his;
DROP TABLE rec_check_client_info;
DROP TABLE rec_credit_detail_his;
DROP TABLE rec_credit_detail_check;
DROP TABLE biz_return_code_map;
DROP TABLE rec_wd_credit_lmt_tmp;
DROP TABLE rec_wd_credit_lmt_his;
DROP TABLE lmt_ext_used_lmt_his;
DROP TABLE lmt_ext_used_biz_rel;
DROP TABLE lmt_ext_used_lmt;
DROP TABLE rec_credit_detail_tmp;
DROP TABLE rec_fund_bal_tmp;
DROP TABLE rec_fund_bal_his;
DROP TABLE finsih_limit;
DROP TABLE finsih_limit_list;
DROP TABLE lmt_first_audit;
DROP TABLE lmt_last_audit;
DROP TABLE bam_image_index;
DROP TABLE cus_info;
DROP TABLE ob_crd_app_info;
DROP TABLE ob_credit_app_info;
DROP TABLE ob_final_app_info;
DROP TABLE ob_first_app_info;
DROP TABLE wsd_loan_detail;
DROP TABLE biz_coop_sftp_config;
DROP TABLE lmt_change_credit;
DROP TABLE cus_file_fail;
DROP TABLE cus_file_list;
DROP TABLE credit_err;



-- 删除列字段
ALTER TABLE biz_tran_record drop index `idx_bz_tr_rc_up_tm`;

ALTER TABLE `rec_loan`.`pls_repay_result`
    MODIFY COLUMN `rpy_no` varchar(32) NOT NULL COMMENT '还款流水号' AFTER `id`;

ALTER TABLE `rec_loan`.`pay_credit_app`
    MODIFY COLUMN `tran_seq` varchar(32) DEFAULT NULL COMMENT '交易流水' AFTER `tran_time`;

ALTER TABLE `rec_loan`.`pay_payout_app`
    MODIFY COLUMN `tran_seq` varchar(32) DEFAULT NULL COMMENT '交易流水' AFTER `tran_time`;

--  CTR_LMT_CONT 	授信合同信息
ALTER TABLE `rec_loan`.`CTR_LMT_CONT` DROP COLUMN `acct_type`;
--  CTR_LOAN_CONT	用信合同信息
ALTER TABLE `rec_loan`.`CTR_LOAN_CONT` DROP COLUMN `acct_type` ;

--  CUS_LIST	名单列表
ALTER TABLE `rec_loan`.`CUS_LIST` DROP COLUMN `acct_type`;
--  LMT_CRDT_APP 	授信申请
ALTER TABLE `rec_loan`.`LMT_CRDT_APP` DROP COLUMN `acct_type`;
--  LMT_CRDT_LMT	授信额度
ALTER TABLE `rec_loan`.`LMT_CRDT_LMT` DROP COLUMN `acct_type`;
--  LMT_CRDT_RISK 	授信风控审批信息
ALTER TABLE `rec_loan`.`LMT_CRDT_RISK` DROP COLUMN `acct_type`;
--  PAY_PAYOUT_APP	放款申请
ALTER TABLE `rec_loan`.`PAY_PAYOUT_APP` DROP COLUMN `acct_type`;
--  PRD_BASE_INFO	产品基本信息
ALTER TABLE `rec_loan`.`PRD_BASE_INFO` DROP COLUMN `acct_type`;
--  LMT_CRDT_AGR	授信批复
ALTER TABLE `rec_loan`.`LMT_CRDT_AGR` DROP COLUMN `acct_type`;
--  PAY_CREDIT_APP	用信申请
ALTER TABLE `rec_loan`.`PAY_CREDIT_APP` DROP COLUMN `acct_type`;
--  FAC_LOAN_DUEBILL 	借据信息
ALTER TABLE `rec_loan`.`FAC_LOAN_DUEBILL` DROP COLUMN `acct_type`;
--  BIZ_CUS_ACCT 	贷款账户信息
ALTER TABLE `rec_loan`.`BIZ_CUS_ACCT` DROP COLUMN `acct_type`;
--  BIZ_CHANNEL	渠道信息
ALTER TABLE `rec_loan`.`BIZ_CHANNEL` DROP COLUMN `acct_type`;
--  GRT_GUAR_CONT 	担保合同信息
ALTER TABLE `rec_loan`.`GRT_GUAR_CONT` DROP COLUMN `acct_type`;
--  BIZ_GRT_CONT_REL	担保合同关联信息
ALTER TABLE `rec_loan`.`BIZ_GRT_CONT_REL` DROP COLUMN `acct_type`;
--  GRT_GUARANTEE 	保证人
ALTER TABLE `rec_loan`.`GRT_GUARANTEE` DROP COLUMN `acct_type`;
--  pls_repay_result 还款结果信息
ALTER TABLE `rec_loan`.`pls_repay_result` DROP COLUMN `acct_type`;

ALTER TABLE `rec_loan`.`lmt_crdt_app` DROP COLUMN `cust_ip_id`;

ALTER TABLE `rec_loan`.`biz_tran_config` DROP COLUMN `retry_times`;
ALTER TABLE `rec_loan`.`biz_tran_config` DROP COLUMN `retry_space`;
ALTER TABLE `rec_loan`.`biz_tran_config` DROP COLUMN `retry`;
ALTER TABLE `rec_loan`.`biz_tran_config` DROP COLUMN `wait_end`;

ALTER TABLE `rec_loan`.`biz_coop_prd_config` DROP COLUMN `account_id`;

ALTER TABLE `rec_loan`.`prd_base_info` DROP COLUMN `depart`;

ALTER TABLE `rec_loan`.`lmt_crdt_agr` DROP COLUMN `file_date`;
ALTER TABLE `rec_loan`.`lmt_crdt_agr` DROP COLUMN `file_bak`;


ALTER TABLE `rec_loan`.`lmt_crdt_app` DROP COLUMN `ip_addr`;
ALTER TABLE `rec_loan`.`lmt_crdt_app` DROP COLUMN `img_no`;
ALTER TABLE `rec_loan`.`lmt_crdt_app` DROP COLUMN `file_date`;
ALTER TABLE `rec_loan`.`lmt_crdt_app` DROP COLUMN `file_bak`;


ALTER TABLE `rec_loan`.`lmt_crdt_lmt` DROP COLUMN `ip_addr`;
ALTER TABLE `rec_loan`.`lmt_crdt_lmt` DROP COLUMN `file_date`;
ALTER TABLE `rec_loan`.`lmt_crdt_lmt` DROP COLUMN `file_bak`;

ALTER TABLE `rec_loan`.`lmt_cus_addr` DROP COLUMN `file_date`;
ALTER TABLE `rec_loan`.`lmt_cus_addr` DROP COLUMN `file_bak`;

ALTER TABLE `rec_loan`.`PAY_PAYOUT_EXP` DROP COLUMN `banlance_req_data`;
ALTER TABLE `rec_loan`.`PAY_PAYOUT_EXP` DROP COLUMN `banlance_resp_data`;

-- 数据删除
delete from `rec_loan`.`sys_option` where id in (
	'20584378333089759232',
	'20584378409321234432',
	'20590486462231748608',
	'20590487122784296960',
	'20590218936578998272',
	'20590231217752768512',
	'20591317868340051968',
	'20589915744305676288',
	'20590146387971145728',
	'20590193659165540352',
	'20590202863028797440',
	'20590601744510091264',
	'20590595735578214400',
	'20590611246001160192',
	'20590280694765191168',
	'20590561523454181376',
	'20590606656119767040',
	'20590591670467166208',
	'20590579829447852032',
	'20590570000163536896',
	'20591332139211948032',
	'20591285921484111872',
	'20591202704408182784',
	'20591275793083006976',
	'20591324216704368640',
	'20590619402802561024',
	'20591217353333669888',
	'20591301337380028416',
	'20590584235534843904',
	'20590284510482923520',
	'20595559058660917248',
    '20595559131901853696',
    '20595559206015205376',
    '20598096915912982528',
    '20598096968647966720',
    '20598097029717032960',
    '20598097071274196992',
    '20598097113611501568',
    '20598097212295086080',
    '20598097357011156992',
    '20598097412011065344',
    '20598097461449326592',
    '20598097500804481024',
    '20598097571436560384',
    '20598097712696524800',
    '20598118581279916032',
    '20598185802026975232',
    '20598185843873546240',
    '20598911349778546688',
    '20598911422138679296',
    '20598911475863519232',
    '20598911522390933504',
    '20598911584990920704',
    '20598911654431817728'
	);
	
delete from `rec_loan`.`sys_select` where id in 
(
	'20584378140646703104',
    '20590486051441614848',
    '20590218558512824320',
    '20590231001469288448',
    '20591317745866375168',
    '20589915531272781824',
    '20590146258652364800',
    '20590193463148937216',
    '20590202759546929152',
    '20590601619276562432',
    '20590595376797450240',
    '20590611113473736704',
    '20590280570542489600',
    '20590561035249778688',
    '20590606520836685824',
    '20590591485691297792',
    '20590579697025286144',
    '20590569828654252032',
    '20591332015677112320',
    '20591285776386359296',
    '20591202528390021120',
    '20591275344737075200',
    '20591324086924214272',
    '20590619103710937088',
    '20591217214086971392',
    '20591300799733170176',
    '20590584040642314240',
    '20590283774114136064',
    '20595558883322232832',
    '20598096685620527104',
    '20598118114768453632',
    '20598185597546266625',
    '20598911243041898496',
    '20601739240446885888',
    '20607610016291094528'
);

delete from `rec_loan`.`prd_tree` where id in (
	596666370645557248,
	596666441638346752,
	596714779444248576,
	596714903826333696,
	596715061288894464,
	596715403997085696,
	596715653931466752,
	596715801818431488,
	596716020203257856,
	596716345882574848,
	596716946032951296,
	596717067298668544,
	596717181949968384,
	596718011121926144,
	596718540334039040,
	596719060662616064,
	596719195677261824,
	596719298211217408,
	596719400413822976,
	596719595755143168,
	596719700788903936,
	596719816442642432,
	596720026816348160,
	596720482250653696,
	596720610277588992,
	596720877073072128,
	596721431446814720,
	596721667246391296,
	596721788906373120,
	597478229808250880
);

delete from `rec_loan`.`sys_option` where id in(
    '20601740362964271104',
    '20601740251550973952',
    '20601739895630725120',
    '20601740032591527936',
    '20601740141379190784',
    '20601739585101234176',
    '20601896522396729344',
    '20596996718008991744',
    '20596996612073455616',
    '20601737048927240192',
    '20596997311486230528',
    '20601931515286257664',
    '20596997077175631872',
    '20596997186688909312',
    '20600384014464843776',
    '20596997422383628288',
    '20594122701539377153',
    '20602097535284150272',
    '20590134004053704704',
    '20590134162422235136',
    '20596045753206439936'
    );

-- delete from `rec_loan`.`biz_coop_sftp_config` where coop_no in (
--     '572497489274470400',
--     '596707286303379456'
--     );


delete from `rec_loan`.`biz_tran_config` where id in (
      594214891372412928,
      594220391484882944,
      594630489210355712,
      594630824284913664,
      594634502886653952,
      595729439426347008,
      601054479541862400,
      604403148139790336
    );

delete from `rec_loan`.`bam_file_type` where id in (
    594097613012205568,
    594097713239293952,
    594098960440754176,
    602801162546053120
    );

delete from `rec_loan`.`bam_file_group` where id in (
                                                      594182234827653120,
                                                      594183617098285056,
                                                      601895814079447040
                                                  );


delete from `rec_loan`.`bam_file_grp_detail` where id in (
                                                          601895814092029952,
                                                          594182235230306304,
                                                          594182235624570880,
                                                          594183617496743936,
                                                          594183617895202816,
                                                          594183618306244608,
                                                          594183618713092096,
                                                          604035300313792512
    );

delete from `rec_loan`.`biz_coop_config` where id in (
    596707058078711810
    );

delete from `rec_loan`.`biz_coop_prd_config` where id in (
    596707422656004096
    );

delete from `rec_loan`.`sys_option` where id in (
    '20598828031523422208',
    '20607610328364089344',
    '20607610388023869440',
    '20607305938386288640'
    );

-- delete from `rec_loan`.`biz_return_code_map` where id in (
--                                                           1,
--                                                           2,
--                                                           3,
--                                                           4,
--                                                           5,
--                                                           6,
--                                                           7,
--                                                           8,
--                                                           9,
--                                                           10,
--                                                           11,
--                                                           12,
--                                                           13,
--                                                           14,
--                                                           15,
--                                                           16,
--                                                           17,
--                                                           18,
--                                                           19,
--                                                           20,
--                                                           21,
--                                                           22,
--                                                           23,
--                                                           24,
--                                                           25,
--                                                           26,
--                                                           28,
--                                                           29,
--                                                           30,
--                                                           31,
--                                                           32,
--                                                           33
--     );


delete from `rec_loan`.`sys_org_app` where id in (
    '609069397297856512',
    '609069397306245120',
    '609069397314633728'
    );

delete from `rec_loan`.`sys_app` where id in (
    '20595343766814982144',
    '20595343877783683072',
    '20595343961636208640'
    );


delete from sys_option where id = '20609113920828866561';

alter table `rec_loan`.`lmt_cus_indiv` drop index `idx_lm_cs_ind_cert_no`;
alter table `rec_loan`.`cus_base_info` drop index `idx_cs_bs_cert_no`;
alter table `rec_loan`.`lmt_cus_addr` drop index `idx_lm_cs_addr_ind_cust_no`;