--升级付款计划
update t_fa_lease_pay_plan set frealpayamount = 0 where frealpayamount is null;
update t_fa_lease_pay_plan set fplanunpay = frentwithtax - frealpayamount;
update t_fa_lease_pay_plan set frealunpay = frentwithtax - frealpayamount;
update t_fa_lease_pay_plan A set fcurrencyid = (select fcurrencyid from t_fa_lease_contract_new B where a.fid = b.fid)
where not exists (select 1 from t_fa_lease_contract_new B where a.fid = b.fid and B.fcurrencyid is null) AND (select fcurrencyid from t_fa_lease_contract_new B where a.fid = b.fid) IS NOT NULL
