--升级已实现损益.损益币种（生命周期操作）
update T_TBO_PLINFO_ENTRYS e
set fbizbillplcurrencyid = (select b.fplcurrencyid from t_tm_businessbill b where b.fid = e.fbizbillid)
where exists (
    select b.fid from t_tm_businessbill b where b.fid = e.fbizbillid
)
and (e.fbizbillplcurrencyid = 0 or e.fbizbillplcurrencyid is null) ;

--升级已实现损益.损益币种（互换-买入结算）
update t_tbo_plinfo_entrys e
set fbizbillplcurrencyid = (select t.fplcurrencyid from t_tbo_plinfo p
					left join t_tm_trade_e t on t.fid = p.ftradebillid
					where e.fid = p.fid and p.ftradetypeid = 952722152971330560
					)
where exists (
    select t.fplcurrencyid from t_tbo_plinfo p
	left join t_tm_trade_e t on t.fid = p.ftradebillid
	where e.fid = p.fid and p.ftradetypeid = 952722152971330560
)
and (e.fbizbillplcurrencyid = 0 or e.fbizbillplcurrencyid is null)
and e.fbiztype = 'buysettle';