insert into contract(a_link, a_contacts, amount, contract_type, store_id, operator, signing_time, b_contacts, party_a, b_link, party_b, contract_id, obj_id, contract_name, start_time, end_time, state, contract_code, obj_type, operator_link, contract_parent_id, obj_name, obj_person_name, obj_person_id, start_user_id,party_c,c_link,c_contacts ,a_partya_id,b_partya_id,c_partya_id,community_id, property_company,contract_term,is_archived,contract_reminder_date, signatory_address,contact_email,contact_wechat,remarks,has_supplement_agreement, community_name) values (#{aLink}, #{aContacts}, #{amount}, #{contractType}, #{storeId}, #{operator}, #{signingTime}, #{bContacts}, #{partyA}, #{bLink}, #{partyB}, #{contractId}, #{objId}, #{contractName}, #{startTime}, #{endTime}, #{state}, #{contractCode}, #{objType}, #{operatorLink}, #{contractParentId}, #{objName}, #{objPersonName}, #{objPersonId}, #{startUserId},#{partyC},#{cLink},#{cContacts} ,#{aPartyaId},#{bPartyaId},#{cPartyaId},#{communityId}, #{propertyCompany},#{contractTerm},#{isArchived},#{contractReminderDate}, #{signatoryAddress},#{contactEmail},#{contactWechat},#{remarks},#{hasSupplementAgreement},#{communityName}) update contract t set t.status_cd = #{statusCd} ,t.b_id = #{newBId} , t.a_link= #{aLink} , t.a_contacts= #{aContacts} , t.amount= #{amount} , t.contract_type= #{contractType} , t.store_id= #{storeId} , t.operator= #{operator} , t.signing_time= #{signingTime} , t.b_contacts= #{bContacts} , t.party_a= #{partyA} , t.b_link= #{bLink} , t.party_b= #{partyB} , t.obj_id= #{objId} , t.obj_name= #{objName} , t.obj_person_id= #{objPersonId} , t.obj_person_name= #{objPersonName} , t.contract_name= #{contractName} , t.start_time= #{startTime} , t.end_time= #{endTime} , t.state= #{state} , t.state_desc= #{stateDesc} , t.contract_code= #{contractCode} , t.obj_type= #{objType} , t.operator_link= #{operatorLink} , t.party_c= #{partyC} , t.c_link= #{cLink} , t.c_contacts= #{cContacts} , t.a_partya_id= #{aPartyaId} , t.b_partya_id= #{bPartyaId} , t.c_partya_id= #{cPartyaId} , t.community_id = #{communityId} , t.property_company= #{propertyCompany} , t.contract_term= #{contractTerm} , t.is_archived= #{isArchived} , t.contract_reminder_date= #{contractReminderDate} , t.signatory_address= #{signatoryAddress} , t.contact_email= #{contactEmail} , t.contact_wechat= #{contactWechat} , t.remarks= #{remarks} , t.has_supplement_agreement= #{hasSupplementAgreement} where 1=1 and t.contract_id= #{contractId} insert into ad_contract_info (id, contract_id, ad_type, sub_type, cooperation_form, building_elevator_count, online_quantity, facility_location) values (#{id}, #{contractId}, #{adType}, #{subType}, #{cooperationForm}, #{buildingElevatorCount}, #{onlineQuantity}, #{facilityLocation}) on duplicate key update ad_type = #{adType}, sub_type = #{subType}, cooperation_form = #{cooperationForm}, building_elevator_count = #{buildingElevatorCount}, online_quantity = #{onlineQuantity}, facility_location = #{facilityLocation} insert into contract_amount_detail (id, contract_id, total_contract_amount, unit_price, annual_amount, total_amount, settlement_method, settlement_amount, fee_type, account_info, main_meter_no, sub_meter_no, last_month_reading, current_month_reading, current_period_consumption, electricity_unit_price, electricity_fee, deposit, settlement_cycle, payment_remark) values (#{id}, #{contractId}, #{totalContractAmount}, #{unitPrice}, #{annualAmount}, #{totalAmount}, #{settlementMethod}, #{settlementAmount}, #{feeType}, #{accountInfo}, #{mainMeterNo}, #{subMeterNo}, #{lastMonthReading}, #{currentMonthReading}, #{currentPeriodConsumption}, #{electricityUnitPrice}, #{electricityFee}, #{deposit}, #{settlementCycle}, #{paymentRemark}) on duplicate key update total_contract_amount = #{totalContractAmount}, unit_price = #{unitPrice}, annual_amount = #{annualAmount}, total_amount = #{totalAmount}, settlement_method = #{settlementMethod}, settlement_amount = #{settlementAmount}, fee_type = #{feeType}, account_info = #{accountInfo}, main_meter_no = #{mainMeterNo}, sub_meter_no = #{subMeterNo}, last_month_reading = #{lastMonthReading}, current_month_reading = #{currentMonthReading}, current_period_consumption = #{currentPeriodConsumption}, electricity_unit_price = #{electricityUnitPrice}, electricity_fee = #{electricityFee}, deposit = #{deposit}, settlement_cycle = #{settlementCycle}, payment_remark = #{paymentRemark} insert into contract_management_share (id, contract_id, management_ratio, our_company_amount, our_committee_share, our_company_receivable) values (#{id}, #{contractId}, #{managementRatio}, #{ourCompanyAmount}, #{ourCommitteeShare}, #{ourCompanyReceivable}) on duplicate key update management_ratio = #{managementRatio}, our_company_amount = #{ourCompanyAmount}, our_committee_share = #{ourCommitteeShare}, our_company_receivable = #{ourCompanyReceivable} insert into contract_payment_status (id, contract_id, payment_status, receivable_amount, received_amount, unpaid_amount, special_discount, collection_progress, final_collection_deadline, collection_reminder_status, remark) values (#{id}, #{contractId}, #{paymentStatus}, #{receivableAmount}, #{receivedAmount}, #{unpaidAmount}, #{specialDiscount}, #{collectionProgress}, #{finalCollectionDeadline}, #{collectionReminderStatus}, #{remark}) on duplicate key update payment_status = #{paymentStatus}, receivable_amount = #{receivableAmount}, received_amount = #{receivedAmount}, unpaid_amount = #{unpaidAmount}, special_discount = #{specialDiscount}, collection_progress = #{collectionProgress}, final_collection_deadline = #{finalCollectionDeadline}, collection_reminder_status = #{collectionReminderStatus}, remark = #{remark}