| | |
| | | T1.payment_method, |
| | | T1.delivery_date, |
| | | DATEDIFF(T1.delivery_date, CURDATE()) AS delivery_days_diff, |
| | | IFNULL(shipping_status_counts.is_all_shipped, FALSE) AS is_fh, |
| | | IFNULL(production_exists.has_production, FALSE) AS has_production_record |
| | | IFNULL(shipping_status_counts.is_all_shipped, FALSE) AS is_fh |
| | | FROM sales_ledger T1 |
| | | LEFT JOIN sys_user T2 ON T1.entry_person = T2.user_id |
| | | LEFT JOIN ( |
| | |
| | | FROM shipping_info |
| | | GROUP BY sales_ledger_id |
| | | ) shipping_status_counts ON T1.id = shipping_status_counts.sales_ledger_id |
| | | LEFT JOIN ( |
| | | SELECT DISTINCT po.sales_ledger_id, |
| | | TRUE AS has_production |
| | | FROM product_order po |
| | | INNER JOIN product_work_order wo ON wo.product_order_id = po.id |
| | | INNER JOIN production_product_main pm ON pm.work_order_id = wo.id |
| | | ) production_exists ON T1.id = production_exists.sales_ledger_id |
| | | |
| | | <where> |
| | | <if test="salesLedgerDto.customerName != null and salesLedgerDto.customerName != '' "> |
| | | AND T1.customer_name LIKE CONCAT('%',#{salesLedgerDto.customerName},'%') |
| | |
| | | order by sl.execution_date desc |
| | | </select> |
| | | |
| | | </mapper> |
| | | </mapper> |