diff --git a/emis-biz/src/main/resources/mapper/EmisSettlePayRelMapper.xml b/emis-biz/src/main/resources/mapper/EmisSettlePayRelMapper.xml index 5c581f0ee..675fd9e78 100644 --- a/emis-biz/src/main/resources/mapper/EmisSettlePayRelMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisSettlePayRelMapper.xml @@ -3,7 +3,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -32,16 +32,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" a.update_time, a.create_site, a.update_site, - (select r.apply_seq_no - from emis_settle_pay_invoice_rel r - where r.pay_id = a.pay_id and r.del_flag = '0' - limit 1) as apply_seq_no + ( + select r.apply_seq_no + from emis_settle_invoice_rel r + where r.bill_no = a.bill_no + and r.del_flag = '0' + and exists ( + select 1 from emis_settle_pay_invoice_rel p + where p.apply_seq_no = r.apply_seq_no + and p.pay_id = a.pay_id + and p.del_flag = '0' + ) + limit 1 + ) as apply_seq_no from emis_settle_pay_rel a - + - + insert into emis_settle_pay_rel @@ -164,4 +173,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} - \ No newline at end of file +