| | |
| | | <mapper namespace="com.ruoyi.sales.mapper.InvoiceRegistrationMapper"> |
| | | <select id="invoiceRegistrationListPage" resultType="com.ruoyi.sales.dto.InvoiceRegistrationDto"> |
| | | SELECT |
| | | id , |
| | | sales_ledger_id , |
| | | sales_contract_no , |
| | | customer_id , |
| | | salesman , |
| | | project_name , |
| | | create_time , |
| | | create_user , |
| | | update_time , |
| | | update_user , |
| | | tenant_id |
| | | FROM invoice_registration |
| | | T1.id , |
| | | T1.sales_ledger_id , |
| | | T1.sales_contract_no , |
| | | T1.customer_id , |
| | | T1.salesman , |
| | | T1.project_name , |
| | | T1.create_time , |
| | | T1.create_user , |
| | | T1.update_time , |
| | | T1.update_user , |
| | | T1.tenant_id, |
| | | T2.customer_contract_no, |
| | | T3.customer_name, |
| | | T2.contract_amount, |
| | | CASE WHEN T4.noInvoiceAmountTotal IS NULL THEN 0 ELSE T4.noInvoiceAmountTotal END AS noInvoiceAmountTotal |
| | | FROM invoice_registration T1 |
| | | LEFT JOIN sales_ledger T2 ON T1.sales_ledger_id = T2.id |
| | | LEFT JOIN customer T3 ON T1.customer_id = T3.id |
| | | LEFT JOIN ( |
| | | SELECT |
| | | SUM( no_invoice_amount ) AS noInvoiceAmountTotal , |
| | | invoice_registration_id |
| | | FROM |
| | | invoice_registration_product |
| | | GROUP BY |
| | | invoice_registration_id |
| | | ) T4 ON T1.id = T4.invoice_registration_id |
| | | </select> |
| | | |
| | | </mapper> |