diff --git a/emis-biz/src/main/resources/mapper/EmisSettleInvoiceRecordMapper.xml b/emis-biz/src/main/resources/mapper/EmisSettleInvoiceRecordMapper.xml index a7cd829fc..4bbd0925c 100644 --- a/emis-biz/src/main/resources/mapper/EmisSettleInvoiceRecordMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisSettleInvoiceRecordMapper.xml @@ -531,6 +531,17 @@ on rel.settle_bill_no = b.settle_bill_no and b.del_flag = '0' left join emis_settle_invoice_rel r on a.apply_seq_no = r.apply_seq_no and r.del_flag = '0' + left join ( + select ch1.* + from emis_settle_invoice_ch_record ch1 + inner join ( + select apply_seq_no, max(id) as max_id + from emis_settle_invoice_ch_record + where del_flag = '0' + group by apply_seq_no + ) ch2 on ch1.apply_seq_no = ch2.apply_seq_no and ch1.id = ch2.max_id + where ch1.del_flag = '0' + ) ch on a.apply_seq_no = ch.apply_seq_no where a.del_flag = '0' and find_in_set(a.apply_seq_no, #{applySeqNo})