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,fee_flag,state,config_id,payer_obj_type
) values (
#{amount},#{operate},#{incomeObjId},#{feeTypeCd},#{startTime},#{endTime},#{communityId},#{bId},#{feeId},#{userId},#{payerObjId},
#{feeFlag},#{state},#{configId},#{payerObjType}
)
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,fee_flag,state,config_id,payer_obj_type
) 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
,t.fee_flag,t.state,t.config_id,t.payer_obj_type
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}
and t.state= #{state}
and t.fee_flag= #{feeFlag}
and t.config_id= #{configId}
and t.payer_obj_type = #{payerObjType}
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}
, t.state= #{state}
, t.fee_flag= #{feeFlag}
where 1=1
and t.b_id= #{bId}
and t.fee_id= #{feeId}
INSERT INTO bill_owe_fee
(`owe_id`, `bill_id`, `fee_id`, `bill_amount_owed`, `amount_owed`, `fee_end_time`, `owner_id`, `owner_name`,
`owner_tel`, `payer_obj_name`, `payer_obj_type`, `community_id`, `state`,deadline_time)
VALUES (#{oweId}, #{billId}, #{feeId}, #{billAmountOwed}, #{amountOwed}, #{feeEndTime}, #{ownerId},
#{ownerName},
#{ownerTel}, #{payerObjName}, #{payerObjType}, #{communityId}, #{state},#{deadlineTime})
update bill_owe_fee t set t.state = #{state} where t.fee_id = #{feeId} and t.community_id=#{communityId}
and t.bill_id=#{billId}
INSERT INTO bill (`bill_id`, `bill_name`, `receivable`, `receipts`, `bill_time`, `community_id`, `config_id`,
`remark`, `cur_bill`, `cur_receivable`)
VALUES (#{billId}, #{billName}, #{receivable}, #{receipts}, #{billTime}, #{communityId}, #{configId},
#{remark}, #{curBill}, #{curReceivable})
update bill set cur_bill= 'F' where config_id = #{configId}
insert into pay_fee (amount,status_cd,income_obj_id,fee_type_cd,start_time,end_time,community_id,b_id,fee_id,
user_id,payer_obj_id,fee_flag,state,config_id,payer_obj_type)
VALUES
(#{item.amount},'0',#{item.incomeObjId},#{item.feeTypeCd},#{item.startTime},#{item.endTime},#{item.communityId},
'-1',#{item.feeId},#{item.userId},#{item.payerObjId},#{item.feeFlag},#{item.state},#{item.configId},#{item.payerObjType})