|
@@ -4,16 +4,18 @@
|
|
|
|
|
|
<sql id="list">
|
|
<sql id="list">
|
|
SELECT coi.*,
|
|
SELECT coi.*,
|
|
- c.`code` AS contractCode,
|
|
|
|
- c.tax_transportation_way as contractTaxTransportationWay,
|
|
|
|
- c.belong_type as contractBelongType,
|
|
|
|
- IFNULL(t1.modCount, 0) AS modCount,
|
|
|
|
- IFNULL(t1.sumQuantity, 0) AS sumQuantity
|
|
|
|
|
|
+ c.`code` AS contractCode,
|
|
|
|
+ c.tax_transportation_way as contractTaxTransportationWay,
|
|
|
|
+ c.belong_type as contractBelongType,
|
|
|
|
+ IFNULL(t1.modCount, 0) AS modCount,
|
|
|
|
+ IFNULL(t1.sumQuantity, 0) AS sumQuantity,
|
|
|
|
+ IFNULL(t1.sumTruckQuantity, 0) AS sumTruckQuantity
|
|
FROM contract_outbound_info coi
|
|
FROM contract_outbound_info coi
|
|
LEFT JOIN contract c ON coi.contract_id = c.id
|
|
LEFT JOIN contract c ON coi.contract_id = c.id
|
|
LEFT JOIN (SELECT cor.record_id,
|
|
LEFT JOIN (SELECT cor.record_id,
|
|
- count(cor.product_id) AS modCount,
|
|
|
|
- sum(cor.quantity) AS sumQuantity
|
|
|
|
|
|
+ count(cor.product_id) AS modCount,
|
|
|
|
+ sum(cor.quantity) AS sumQuantity,
|
|
|
|
+ sum(cor.truck_quantity) AS sumTruckQuantity
|
|
FROM contract_outbound_records cor
|
|
FROM contract_outbound_records cor
|
|
GROUP BY cor.record_id) t1 ON t1.record_id = coi.id
|
|
GROUP BY cor.record_id) t1 ON t1.record_id = coi.id
|
|
</sql>
|
|
</sql>
|