select thisTab.id, thisTab.system_no, thisTab.related_bill_no, thisTab.source_system, thisTab.business_sector, thisTab.document_type, thisTab.document_no, thisTab.is_internal_settlement, thisTab.internal_settlement_unit, thisTab.customer_name, thisTab.project_name, thisTab.business_time, thisTab.receivable_confirm_time, thisTab.receivable_amount, thisTab.receivable_amount_str, thisTab.status, thisTab.remark, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.deleted, thisTab.customer_id from receivable_fee_management AS thisTab select count(0) from receivable_fee_management as thisTab and thisTab.system_no = #{systemNo} and thisTab.related_bill_no = #{relatedBillNo} and thisTab.source_system = #{sourceSystem} and thisTab.business_sector = #{businessSector} and thisTab.document_type = #{documentType} and thisTab.document_no = #{documentNo} and thisTab.is_internal_settlement = #{isInternalSettlement} and thisTab.internal_settlement_unit = #{internalSettlementUnit} and thisTab.customer_name like concat('%', #{customerName}, '%') and thisTab.project_name like concat('%', #{projectName}, '%') and thisTab.business_time = #{businessTime} and thisTab.receivable_confirm_time = #{receivableConfirmTime} and thisTab.receivable_amount = #{receivableAmount} and thisTab.status = #{status} and thisTab.deleted = #{deleted} and thisTab.customer_id = #{customerId} insert into receivable_fee_management system_no, related_bill_no, source_system, business_sector, document_type, document_no, is_internal_settlement, internal_settlement_unit, customer_name, project_name, business_time, receivable_confirm_time, receivable_amount, receivable_amount_str, status, remark, create_by, create_time, update_by, update_time, deleted, customer_id, #{systemNo}, #{relatedBillNo}, #{sourceSystem}, #{businessSector}, #{documentType}, #{documentNo}, #{isInternalSettlement}, #{internalSettlementUnit}, #{customerName}, #{projectName}, #{businessTime}, #{receivableConfirmTime}, #{receivableAmount}, #{receivableAmountStr}, #{status}, #{remark}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{deleted}, #{customerId}, insert into receivable_fee_management id,system_no,related_bill_no,source_system,business_sector,document_type,document_no,is_internal_settlement,internal_settlement_unit,customer_name,project_name,business_time,receivable_confirm_time,receivable_amount,receivable_amount_str,status,remark,create_by,create_time,update_by,update_time,deleted,customer_id, #{item.id},#{item.systemNo},#{item.relatedBillNo},#{item.sourceSystem},#{item.businessSector},#{item.documentType},#{item.documentNo},#{item.isInternalSettlement},#{item.internalSettlementUnit},#{item.customerName},#{item.projectName},#{item.businessTime},#{item.receivableConfirmTime},#{item.receivableAmount},#{item.receivableAmountStr},#{item.status},#{item.remark},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.deleted},#{item.customerId}, update receivable_fee_management system_no = #{systemNo}, related_bill_no = #{relatedBillNo}, source_system = #{sourceSystem}, business_sector = #{businessSector}, document_type = #{documentType}, document_no = #{documentNo}, is_internal_settlement = #{isInternalSettlement}, internal_settlement_unit = #{internalSettlementUnit}, customer_name = #{customerName}, project_name = #{projectName}, business_time = #{businessTime}, receivable_confirm_time = #{receivableConfirmTime}, receivable_amount = #{receivableAmount}, receivable_amount_str = #{receivableAmountStr}, status = #{status}, remark = #{remark}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, deleted = #{deleted}, customer_id = #{customerId}, where id = #{id} update receivable_fee_management system_no = #{item.systemNo}, related_bill_no = #{item.relatedBillNo}, source_system = #{item.sourceSystem}, business_sector = #{item.businessSector}, document_type = #{item.documentType}, document_no = #{item.documentNo}, is_internal_settlement = #{item.isInternalSettlement}, internal_settlement_unit = #{item.internalSettlementUnit}, customer_name = #{item.customerName}, project_name = #{item.projectName}, business_time = #{item.businessTime}, receivable_confirm_time = #{item.receivableConfirmTime}, receivable_amount = #{item.receivableAmount}, receivable_amount_str = #{item.receivableAmountStr}, status = #{item.status}, remark = #{item.remark}, create_by = #{item.createBy}, create_time = #{item.createTime}, update_by = #{item.updateBy}, update_time = #{item.updateTime}, deleted = #{item.deleted}, customer_id = #{item.customerId}, where id = #{item.id} delete from receivable_fee_management where id = #{id} delete from receivable_fee_management where id in #{id} update receivable_fee_management set related_bill_no = null, status = '0', update_time = now() where related_bill_no = #{relatedBillNo}