insert into
business_return_pay_fee(
reason,prime_rate,fee_type_cd,
pay_time,detail_id,receivable_amount,
cycles,remark,received_amount,
fee_id,return_fee_id,operate,
config_id,state,b_id,community_id) values (
#{reason},#{primeRate},#{feeTypeCd},#{payTime},#{detailId},#{receivableAmount},
#{cycles},#{remark},#{receivedAmount},#{feeId},#{returnFeeId},#{operate},#{configId},
#{state},#{bId},#{communityId})
insert into return_pay_fee(
reason,prime_rate,fee_type_cd,pay_time,detail_id,receivable_amount,cycles,
remark,status_cd,received_amount,fee_id,return_fee_id,config_id,state,b_id,community_id
) select t.reason,t.prime_rate,t.fee_type_cd,t.pay_time,t.detail_id,t.receivable_amount,t.cycles,t.remark,'0',
t.received_amount,t.fee_id,t.return_fee_id,t.config_id,t.state,t.b_id,t.community_id
from business_return_pay_fee t where 1=1
and t.reason= #{reason}
and t.prime_rate= #{primeRate}
and t.fee_type_cd= #{feeTypeCd}
and t.pay_time= #{payTime}
and t.detail_id= #{detailId}
and t.receivable_amount= #{receivableAmount}
and t.cycles= #{cycles}
and t.remark= #{remark}
and t.received_amount= #{receivedAmount}
and t.fee_id= #{feeId}
and t.return_fee_id= #{returnFeeId}
and t.operate= 'ADD'
and t.config_id= #{configId}
and t.state= #{state}
and t.b_id= #{bId}
and t.community_id= #{communityId}
update return_pay_fee t set t.status_cd = #{statusCd}
, t.state= #{state}
where 1=1
and t.return_fee_id= #{returnFeeId}
and t.b_id= #{bId}