insert into business_pay_fee(
amount,operate,income_obj_id,fee_type_cd,start_time,end_time,community_id,b_id,fee_id,user_id,payer_obj_id
) values (
#{amount},#{operate},#{incomeObjId},#{feeTypeCd},#{startTime},#{endTime},#{communityId},#{bId},#{feeId},#{userId},#{payerObjId}
)
insert into pay_fee(
amount,income_obj_id,fee_type_cd,start_time,status_cd,end_time,community_id,b_id,fee_id,user_id,payer_obj_id
) select t.amount,t.income_obj_id,t.fee_type_cd,t.start_time,'0',t.end_time,t.community_id,t.b_id,t.fee_id,t.user_id,t.payer_obj_id from business_pay_fee t where 1=1
and t.amount= #{amount}
and t.operate= 'ADD'
and t.income_obj_id= #{incomeObjId}
and t.fee_type_cd= #{feeTypeCd}
and t.start_time= #{startTime}
and t.end_time= #{endTime}
and t.community_id= #{communityId}
and t.b_id= #{bId}
and t.fee_id= #{feeId}
and t.user_id= #{userId}
and t.payer_obj_id= #{payerObjId}
update pay_fee t set t.status_cd = #{statusCd}
,t.b_id = #{newBId}
, t.amount= #{amount}
, t.income_obj_id= #{incomeObjId}
, t.fee_type_cd= #{feeTypeCd}
, t.start_time= #{startTime}
, t.end_time= #{endTime}
, t.community_id= #{communityId}
, t.user_id= #{userId}
, t.payer_obj_id= #{payerObjId}
where 1=1
and t.b_id= #{bId}
and t.fee_id= #{feeId}