select thisTab.id, thisTab.system_code, thisTab.contract_code, thisTab.contract_name, thisTab.contract_type, thisTab.sign_date, thisTab.contract_start_date, thisTab.contract_end_date, thisTab.contract_status, thisTab.party_a_name, thisTab.party_a_id, thisTab.party_a_contact, thisTab.party_a_contact_info, thisTab.party_b_name, thisTab.party_b_id, thisTab.party_b_contact, thisTab.party_b_contact_info, thisTab.contract_amount, thisTab.payment_method, thisTab.payment_cycle, thisTab.paid_amount, thisTab.unpaid_amount, thisTab.invoice_status, thisTab.fulfillment_status, thisTab.fulfillment_progress, thisTab.acceptance_status, thisTab.attachment_name, thisTab.attachment_path, thisTab.uploaded_by, thisTab.upload_time, thisTab.status, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.remark,thisTab.is_temp_contract, thisTab.cycle_type, thisTab.billing_cycle_last_month_day, thisTab.billing_cycle_current_month_day, thisTab.reconciliation_day, thisTab.invoice_day, thisTab.payment_day, thisTab.total_account_day from tms_contract AS thisTab select count(0) from tms_contract as thisTab and thisTab.system_code = #{systemCode} and thisTab.contract_code = #{contractCode} and thisTab.contract_name like concat('%', #{contractName}, '%') and thisTab.contract_type = #{contractType} and thisTab.sign_date = #{signDate} and thisTab.contract_start_date = #{contractStartDate} and thisTab.contract_end_date = #{contractEndDate} and thisTab.contract_status = #{contractStatus} and thisTab.party_a_name like concat('%', #{partyAName}, '%') and thisTab.party_a_id = #{partyAId} and thisTab.party_b_id = #{partyBId} and thisTab.party_b_name like concat('%', #{partyBName}, '%') and thisTab.contract_amount = #{contractAmount} and thisTab.payment_method = #{paymentMethod} and thisTab.invoice_status = #{invoiceStatus} and thisTab.fulfillment_status = #{fulfillmentStatus} and thisTab.acceptance_status = #{acceptanceStatus} and thisTab.status = #{status} and thisTab.is_temp_contract = #{isTempContract} and thisTab.cycle_type = #{cycleType} and thisTab.billing_cycle_last_month_day = #{billingCycleLastMonthDay} and thisTab.billing_cycle_current_month_day = #{billingCycleCurrentMonthDay} and thisTab.reconciliation_day = #{reconciliationDay} and thisTab.invoice_day = #{invoiceDay} and thisTab.payment_day = #{paymentDay} and thisTab.total_account_day = #{totalAccountDay} insert into tms_contract system_code, contract_code, contract_name, contract_type, sign_date, contract_start_date, contract_end_date, contract_status, party_a_name, party_a_id, party_a_contact, party_a_contact_info, party_b_name, party_b_id, party_b_contact, party_b_contact_info, contract_amount, payment_method, payment_cycle, paid_amount, unpaid_amount, invoice_status, fulfillment_status, fulfillment_progress, acceptance_status, attachment_name, attachment_path, uploaded_by, upload_time, status, create_by, create_time, update_by, update_time, remark, is_temp_contract, cycle_type, billing_cycle_last_month_day, billing_cycle_current_month_day, reconciliation_day, invoice_day, payment_day, total_account_day, #{systemCode}, #{contractCode}, #{contractName}, #{contractType}, #{signDate}, #{contractStartDate}, #{contractEndDate}, #{contractStatus}, #{partyAName}, #{partyAId}, #{partyAContact}, #{partyAContactInfo}, #{partyBName}, #{partyBId}, #{partyBContact}, #{partyBContactInfo}, #{contractAmount}, #{paymentMethod}, #{paymentCycle}, #{paidAmount}, #{unpaidAmount}, #{invoiceStatus}, #{fulfillmentStatus}, #{fulfillmentProgress}, #{acceptanceStatus}, #{attachmentName}, #{attachmentPath}, #{uploadedBy}, #{uploadTime}, #{status}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{remark}, #{isTempContract}, #{cycleType}, #{billingCycleLastMonthDay}, #{billingCycleCurrentMonthDay}, #{reconciliationDay}, #{invoiceDay}, #{paymentDay}, #{totalAccountDay}, insert into tms_contract id,system_code,contract_code,contract_name,contract_type,sign_date,contract_start_date,contract_end_date,contract_status,party_a_name,party_a_id,party_a_contact,party_a_contact_info,party_b_name,party_b_id,party_b_contact,party_b_contact_info,contract_amount,payment_method,payment_cycle,paid_amount,unpaid_amount,invoice_status,fulfillment_status,fulfillment_progress,acceptance_status,attachment_name,attachment_path,uploaded_by,upload_time,status,create_by,create_time,update_by,update_time,remark,is_temp_contract,cycle_type,billing_cycle_last_month_day,billing_cycle_current_month_day,reconciliation_day,invoice_day,payment_day,total_account_day, #{item.id},#{item.systemCode},#{item.contractCode},#{item.contractName},#{item.contractType},#{item.signDate},#{item.contractStartDate},#{item.contractEndDate},#{item.contractStatus},#{item.partyAName},#{item.partyAId},#{item.partyAContact},#{item.partyAContactInfo},#{item.partyBName},#{item.partyBId},#{item.partyBContact},#{item.partyBContactInfo},#{item.contractAmount},#{item.paymentMethod},#{item.paymentCycle},#{item.paidAmount},#{item.unpaidAmount},#{item.invoiceStatus},#{item.fulfillmentStatus},#{item.fulfillmentProgress},#{item.acceptanceStatus},#{item.attachmentName},#{item.attachmentPath},#{item.uploadedBy},#{item.uploadTime},#{item.status},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.remark},#{item.isTempContract},#{item.cycleType},#{item.billingCycleLastMonthDay},#{item.billingCycleCurrentMonthDay},#{item.reconciliationDay},#{item.invoiceDay},#{item.paymentDay},#{item.totalAccountDay}, update tms_contract system_code = #{systemCode}, contract_code = #{contractCode}, contract_name = #{contractName}, contract_type = #{contractType}, sign_date = #{signDate}, contract_start_date = #{contractStartDate}, contract_end_date = #{contractEndDate}, contract_status = #{contractStatus}, party_a_name = #{partyAName}, party_a_id = #{partyAId}, party_a_contact = #{partyAContact}, party_a_contact_info = #{partyAContactInfo}, party_b_name = #{partyBName}, party_b_id = #{partyBId}, party_b_contact = #{partyBContact}, party_b_contact_info = #{partyBContactInfo}, contract_amount = #{contractAmount}, payment_method = #{paymentMethod}, payment_cycle = #{paymentCycle}, paid_amount = #{paidAmount}, unpaid_amount = #{unpaidAmount}, invoice_status = #{invoiceStatus}, fulfillment_status = #{fulfillmentStatus}, fulfillment_progress = #{fulfillmentProgress}, acceptance_status = #{acceptanceStatus}, attachment_name = #{attachmentName}, attachment_path = #{attachmentPath}, uploaded_by = #{uploadedBy}, upload_time = #{uploadTime}, status = #{status}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, remark = #{remark}, is_temp_contract = #{isTempContract}, cycle_type = #{cycleType}, billing_cycle_last_month_day = #{billingCycleLastMonthDay}, billing_cycle_current_month_day = #{billingCycleCurrentMonthDay}, reconciliation_day = #{reconciliationDay}, invoice_day = #{invoiceDay}, payment_day = #{paymentDay}, total_account_day = #{totalAccountDay}, where id = #{id} update tms_contract system_code = #{item.systemCode}, contract_code = #{item.contractCode}, contract_name = #{item.contractName}, contract_type = #{item.contractType}, sign_date = #{item.signDate}, contract_start_date = #{item.contractStartDate}, contract_end_date = #{item.contractEndDate}, contract_status = #{item.contractStatus}, party_a_name = #{item.partyAName}, party_a_id = #{item.partyAId}, party_a_contact = #{item.partyAContact}, party_a_contact_info = #{item.partyAContactInfo}, party_b_name = #{item.partyBName}, party_b_id = #{item.partyBId}, party_b_contact = #{item.partyBContact}, party_b_contact_info = #{item.partyBContactInfo}, contract_amount = #{item.contractAmount}, payment_method = #{item.paymentMethod}, payment_cycle = #{item.paymentCycle}, paid_amount = #{item.paidAmount}, unpaid_amount = #{item.unpaidAmount}, invoice_status = #{item.invoiceStatus}, fulfillment_status = #{item.fulfillmentStatus}, fulfillment_progress = #{item.fulfillmentProgress}, acceptance_status = #{item.acceptanceStatus}, attachment_name = #{item.attachmentName}, attachment_path = #{item.attachmentPath}, uploaded_by = #{item.uploadedBy}, upload_time = #{item.uploadTime}, status = #{item.status}, create_by = #{item.createBy}, create_time = #{item.createTime}, update_by = #{item.updateBy}, update_time = #{item.updateTime}, remark = #{item.remark}, is_temp_contract = #{item.isTempContract}, cycle_type = #{item.cycleType}, billing_cycle_last_month_day = #{item.billingCycleLastMonthDay}, billing_cycle_current_month_day = #{item.billingCycleCurrentMonthDay}, reconciliation_day = #{item.reconciliationDay}, invoice_day = #{item.invoiceDay}, payment_day = #{item.paymentDay}, total_account_day = #{item.totalAccountDay}, where id = #{item.id} delete from tms_contract where id = #{id} delete from tms_contract where id in #{id}