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.supplier_name, thisTab.project_name, thisTab.business_time, thisTab.payable_confirm_time, thisTab.payable_amount, thisTab.payable_amount_str, thisTab.status, thisTab.remark, thisTab.create_by, thisTab.create_time, thisTab.update_by, thisTab.update_time, thisTab.deleted from payable_fee_management AS thisTab
select count(0) from payable_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.supplier_name like concat('%', #{supplierName}, '%')
and thisTab.project_name like concat('%', #{projectName}, '%')
and thisTab.business_time = #{businessTime}
and thisTab.payable_confirm_time = #{payableConfirmTime}
and thisTab.payable_amount = #{payableAmount}
and thisTab.status = #{status}
and thisTab.deleted = #{deleted}
insert into payable_fee_management
system_no,
related_bill_no,
source_system,
business_sector,
document_type,
document_no,
is_internal_settlement,
internal_settlement_unit,
supplier_name,
project_name,
business_time,
payable_confirm_time,
payable_amount,
payable_amount_str,
status,
remark,
create_by,
create_time,
update_by,
update_time,
deleted,
#{systemNo},
#{relatedBillNo},
#{sourceSystem},
#{businessSector},
#{documentType},
#{documentNo},
#{isInternalSettlement},
#{internalSettlementUnit},
#{supplierName},
#{projectName},
#{businessTime},
#{payableConfirmTime},
#{payableAmount},
#{payableAmountStr},
#{status},
#{remark},
#{createBy},
#{createTime},
#{updateBy},
#{updateTime},
#{deleted},
insert into payable_fee_management
id,system_no,related_bill_no,source_system,business_sector,document_type,document_no,is_internal_settlement,internal_settlement_unit,supplier_name,project_name,business_time,payable_confirm_time,payable_amount,payable_amount_str,status,remark,create_by,create_time,update_by,update_time,deleted,
#{item.id},#{item.systemNo},#{item.relatedBillNo},#{item.sourceSystem},#{item.businessSector},#{item.documentType},#{item.documentNo},#{item.isInternalSettlement},#{item.internalSettlementUnit},#{item.supplierName},#{item.projectName},#{item.businessTime},#{item.payableConfirmTime},#{item.payableAmount},#{item.payableAmountStr},#{item.status},#{item.remark},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime},#{item.deleted},
update payable_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},
supplier_name = #{supplierName},
project_name = #{projectName},
business_time = #{businessTime},
payable_confirm_time = #{payableConfirmTime},
payable_amount = #{payableAmount},
payable_amount_str = #{payableAmountStr},
status = #{status},
remark = #{remark},
create_by = #{createBy},
create_time = #{createTime},
update_by = #{updateBy},
update_time = #{updateTime},
deleted = #{deleted},
where id = #{id}
update payable_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},
supplier_name = #{item.supplierName},
project_name = #{item.projectName},
business_time = #{item.businessTime},
payable_confirm_time = #{item.payableConfirmTime},
payable_amount = #{item.payableAmount},
payable_amount_str = #{item.payableAmountStr},
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},
where id = #{item.id}
delete from payable_fee_management where id = #{id}
delete from payable_fee_management where id in
#{id}
update payable_fee_management
set related_bill_no = null, status = '0', update_time = now()
where related_bill_no = #{relatedBillNo}