select er.*,rb.order_no as orderNo,o.tidan_no as tidanNo,
rb.order_id as orderId
from ecw_receipt er left join ecw_receivable rb
on rb.receipt_id=er.id and rb.deleted=0
left join ecw_order o on o.order_no=rb.order_no and o.deleted=0
where er.deleted = 0
SELECT
er.*,
rb.order_no AS orderNo,
o.tidan_no AS tidanNo,
rb.order_id AS orderId
FROM ecw_receipt er
LEFT JOIN ecw_receivable rb ON rb.receipt_id=er.id AND rb.deleted=0
LEFT JOIN ecw_order o ON o.order_no=rb.order_no AND o.deleted=0
WHERE er.deleted = 0
<iftest="query.detailStatus != null">
AND er.`detail_status` = #{query.detailStatus}
</if>
<iftest="query.invoicingStatus != null">
AND er.`invoicing_status` = #{query.invoicingStatus}
</if>
<iftest="query.invoiceDataStatus != null">
AND er.`invoice_data_status` = #{query.invoiceDataStatus}
</if>
<iftest="query.receiptNo != null">
AND er.`receipt_no` = #{query.receiptNo}
</if>
...
...
@@ -23,16 +35,17 @@
AND er.`state` = #{query.state}
</if>
<iftest="query.salesmanId != null">
AND (er.`salesman_id` = #{query.salesmanId} or er.`customer_id` in(select cus.id from ecw_customer cus where cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ))
AND (er.`salesman_id` = #{query.salesmanId} or er.`customer_id` in(select cus.id from ecw_customer cus where
cus.is_customer_service_confirmed = 1 and cus.customer_service = #{query.salesmanId} ))
</if>
<iftest="query.salesmanName != null">
AND er.`salesman_name` = #{query.salesmanName}
</if>
<iftest ="query.beginCreateTime != null and query.endCreateTime != null ">
<iftest="query.beginCreateTime != null and query.endCreateTime != null ">
AND er.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}
</if>
<iftest ="query.numberNo != null and query.numberNo != '' ">
and er.id in ( SELECT DISTINCT
<iftest="query.numberNo != null and query.numberNo != '' ">