|
@@ -285,100 +285,95 @@
|
|
FROM
|
|
FROM
|
|
tb_rst_customer_info c
|
|
tb_rst_customer_info c
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- '3' AS customerIsSolve,
|
|
|
|
- renewed_id AS relationId,
|
|
|
|
- customer_id AS customerId,
|
|
|
|
- tb_rst_relation_order.sales_id AS orderId,
|
|
|
|
- signclosed_id AS signclosedId,
|
|
|
|
- renewed_back_status AS relationBackStatus,
|
|
|
|
- renewed_send_status AS relationSendStatus,
|
|
|
|
- renewed_send_logistics_no AS relationSendLogisticsNo,
|
|
|
|
- renewed_send_logistics_company AS relationSendLogisticsCompany,
|
|
|
|
- renewed_back_logistics_no AS relationBackLogisticsNo,
|
|
|
|
- renewed_back_logistics_company AS relationBackLogisticsCompany
|
|
|
|
- FROM
|
|
|
|
- tb_rst_renewed
|
|
|
|
- LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_renewed.renewed_id
|
|
|
|
- AND tb_rst_relation_order.relation_type = '3'
|
|
|
|
- )
|
|
|
|
- UNION ALL
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- '4' AS customerIsSolve,
|
|
|
|
- repair_id AS relationId,
|
|
|
|
- customer_id AS customerId,
|
|
|
|
- tb_rst_relation_order.sales_id AS orderId,
|
|
|
|
- signclosed_id AS signclosedId,
|
|
|
|
- repair_back_status AS relationBackStatus,
|
|
|
|
- repair_send_status AS relationSendStatus,
|
|
|
|
- repair_send_logistics_no AS relationSendLogisticsNo,
|
|
|
|
- repair_send_logistics_company AS relationSendLogisticsCompany,
|
|
|
|
- repair_back_logistics_no AS relationBackLogisticsNo,
|
|
|
|
- repair_back_logistics_company AS relationBackLogisticsCompany
|
|
|
|
- FROM
|
|
|
|
- tb_rst_repair
|
|
|
|
- LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_repair.repair_id
|
|
|
|
- AND tb_rst_relation_order.relation_type = '4'
|
|
|
|
- )
|
|
|
|
- UNION ALL
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- '5' AS customerIsSolve,
|
|
|
|
- reissue_id AS relationId,
|
|
|
|
- customer_id AS customerId,
|
|
|
|
- tb_rst_relation_order.sales_id AS orderId,
|
|
|
|
- NULL AS signclosedId,
|
|
|
|
- NULL AS relationBackStatus,
|
|
|
|
- reissue_send_status AS relationSendStatus,
|
|
|
|
- reissue_send_logistics_no AS relationSendLogisticsNo,
|
|
|
|
- reissue_send_logistics_company AS relationSendLogisticsCompany,
|
|
|
|
- NULL AS relationBackLogisticsNo,
|
|
|
|
- NULL AS relationBackLogisticsCompany
|
|
|
|
- FROM
|
|
|
|
- tb_rst_reissue
|
|
|
|
- LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_reissue.reissue_id
|
|
|
|
- AND tb_rst_relation_order.relation_type = '5'
|
|
|
|
- )
|
|
|
|
- UNION ALL
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- '6' AS customerIsSolve,
|
|
|
|
- back_goods_id AS relationId,
|
|
|
|
- customer_id AS customerId,
|
|
|
|
- tb_rst_relation_order.sales_id AS orderId,
|
|
|
|
- signclosed_id AS signclosedId,
|
|
|
|
- back_goods_back_status AS relationBackStatus,
|
|
|
|
- NULL AS relationSendStatus,
|
|
|
|
- NULL AS relationSendLogisticsNo,
|
|
|
|
- NULL AS relationSendLogisticsCompany,
|
|
|
|
- back_goods_back_logistics_no AS relationBackLogisticsNo,
|
|
|
|
- back_goods_back_logistics_company AS relationBackLogisticsCompany
|
|
|
|
- FROM
|
|
|
|
- tb_rst_back_goods
|
|
|
|
- LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_back_goods.back_goods_id
|
|
|
|
- AND tb_rst_relation_order.relation_type = '6'
|
|
|
|
- )
|
|
|
|
- UNION ALL
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- '7' AS customerIsSolve,
|
|
|
|
- noreason_back_id AS relationId,
|
|
|
|
- customer_id AS customerId,
|
|
|
|
- tb_rst_relation_order.sales_id AS orderId,
|
|
|
|
- signclosed_id AS signclosedId,
|
|
|
|
- noreason_back_back_status AS relationBackStatus,
|
|
|
|
- NULL AS relationSendStatus,
|
|
|
|
- NULL AS relationSendLogisticsNo,
|
|
|
|
- NULL AS relationSendLogisticsCompany,
|
|
|
|
- noreason_back_back_logistics_no AS relationBackLogisticsNo,
|
|
|
|
- noreason_back_back_logistics_company AS relationBackLogisticsCompany
|
|
|
|
- FROM
|
|
|
|
- tb_rst_noreason_back
|
|
|
|
- LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_noreason_back.noreason_back_id
|
|
|
|
- AND tb_rst_relation_order.relation_type = '7'
|
|
|
|
- )
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ xx.*
|
|
|
|
+ FROM
|
|
|
|
+ (
|
|
|
|
+ SELECT
|
|
|
|
+ '3' AS customerIsSolve,
|
|
|
|
+ renewed_id AS relationId,
|
|
|
|
+ customer_id AS customerId,
|
|
|
|
+ tb_rst_relation_order.sales_id AS orderId,
|
|
|
|
+ signclosed_id AS signclosedId,
|
|
|
|
+ renewed_back_status AS relationBackStatus,
|
|
|
|
+ renewed_send_status AS relationSendStatus,
|
|
|
|
+ renewed_send_logistics_no AS relationSendLogisticsNo,
|
|
|
|
+ renewed_send_logistics_company AS relationSendLogisticsCompany,
|
|
|
|
+ renewed_back_logistics_no AS relationBackLogisticsNo,
|
|
|
|
+ renewed_back_logistics_company AS relationBackLogisticsCompany
|
|
|
|
+ FROM
|
|
|
|
+ tb_rst_renewed
|
|
|
|
+ LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_renewed.renewed_id
|
|
|
|
+ AND tb_rst_relation_order.relation_type = '3'
|
|
|
|
+ UNION ALL
|
|
|
|
+ SELECT
|
|
|
|
+ '4' AS customerIsSolve,
|
|
|
|
+ repair_id AS relationId,
|
|
|
|
+ customer_id AS customerId,
|
|
|
|
+ tb_rst_relation_order.sales_id AS orderId,
|
|
|
|
+ signclosed_id AS signclosedId,
|
|
|
|
+ repair_back_status AS relationBackStatus,
|
|
|
|
+ repair_send_status AS relationSendStatus,
|
|
|
|
+ repair_send_logistics_no AS relationSendLogisticsNo,
|
|
|
|
+ repair_send_logistics_company AS relationSendLogisticsCompany,
|
|
|
|
+ repair_back_logistics_no AS relationBackLogisticsNo,
|
|
|
|
+ repair_back_logistics_company AS relationBackLogisticsCompany
|
|
|
|
+ FROM
|
|
|
|
+ tb_rst_repair
|
|
|
|
+ LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_repair.repair_id
|
|
|
|
+ AND tb_rst_relation_order.relation_type = '4'
|
|
|
|
+ UNION ALL
|
|
|
|
+ SELECT
|
|
|
|
+ '5' AS customerIsSolve,
|
|
|
|
+ reissue_id AS relationId,
|
|
|
|
+ customer_id AS customerId,
|
|
|
|
+ tb_rst_relation_order.sales_id AS orderId,
|
|
|
|
+ NULL AS signclosedId,
|
|
|
|
+ NULL AS relationBackStatus,
|
|
|
|
+ reissue_send_status AS relationSendStatus,
|
|
|
|
+ reissue_send_logistics_no AS relationSendLogisticsNo,
|
|
|
|
+ reissue_send_logistics_company AS relationSendLogisticsCompany,
|
|
|
|
+ NULL AS relationBackLogisticsNo,
|
|
|
|
+ NULL AS relationBackLogisticsCompany
|
|
|
|
+ FROM
|
|
|
|
+ tb_rst_reissue
|
|
|
|
+ LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_reissue.reissue_id
|
|
|
|
+ AND tb_rst_relation_order.relation_type = '5'
|
|
|
|
+ UNION ALL
|
|
|
|
+ SELECT
|
|
|
|
+ '6' AS customerIsSolve,
|
|
|
|
+ back_goods_id AS relationId,
|
|
|
|
+ customer_id AS customerId,
|
|
|
|
+ tb_rst_relation_order.sales_id AS orderId,
|
|
|
|
+ signclosed_id AS signclosedId,
|
|
|
|
+ back_goods_back_status AS relationBackStatus,
|
|
|
|
+ NULL AS relationSendStatus,
|
|
|
|
+ NULL AS relationSendLogisticsNo,
|
|
|
|
+ NULL AS relationSendLogisticsCompany,
|
|
|
|
+ back_goods_back_logistics_no AS relationBackLogisticsNo,
|
|
|
|
+ back_goods_back_logistics_company AS relationBackLogisticsCompany
|
|
|
|
+ FROM
|
|
|
|
+ tb_rst_back_goods
|
|
|
|
+ LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_back_goods.back_goods_id
|
|
|
|
+ AND tb_rst_relation_order.relation_type = '6'
|
|
|
|
+ UNION ALL
|
|
|
|
+ SELECT
|
|
|
|
+ '7' AS customerIsSolve,
|
|
|
|
+ noreason_back_id AS relationId,
|
|
|
|
+ customer_id AS customerId,
|
|
|
|
+ tb_rst_relation_order.sales_id AS orderId,
|
|
|
|
+ signclosed_id AS signclosedId,
|
|
|
|
+ noreason_back_back_status AS relationBackStatus,
|
|
|
|
+ NULL AS relationSendStatus,
|
|
|
|
+ NULL AS relationSendLogisticsNo,
|
|
|
|
+ NULL AS relationSendLogisticsCompany,
|
|
|
|
+ noreason_back_back_logistics_no AS relationBackLogisticsNo,
|
|
|
|
+ noreason_back_back_logistics_company AS relationBackLogisticsCompany
|
|
|
|
+ FROM
|
|
|
|
+ tb_rst_noreason_back
|
|
|
|
+ LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_noreason_back.noreason_back_id
|
|
|
|
+ AND tb_rst_relation_order.relation_type = '7'
|
|
|
|
+ ) xx
|
|
) cc ON cc.customerId = c.customer_id
|
|
) cc ON cc.customerId = c.customer_id
|
|
LEFT JOIN tb_rst_visit v ON v.customer_id = c.customer_id
|
|
LEFT JOIN tb_rst_visit v ON v.customer_id = c.customer_id
|
|
LEFT JOIN tb_rst_sales_order_info oi ON cc.orderId = oi.sales_id
|
|
LEFT JOIN tb_rst_sales_order_info oi ON cc.orderId = oi.sales_id
|
|
@@ -440,27 +435,7 @@
|
|
and c.customer_create_time < #{endTime}
|
|
and c.customer_create_time < #{endTime}
|
|
</if>
|
|
</if>
|
|
<if test="sendLogisticsNo != null and sendLogisticsNo != ''">
|
|
<if test="sendLogisticsNo != null and sendLogisticsNo != ''">
|
|
- and c.customer_id in (
|
|
|
|
- SELECT customer_id
|
|
|
|
- FROM tb_rst_renewed trr
|
|
|
|
- WHERE renewed_send_logistics_no = #{sendLogisticsNo} OR renewed_back_logistics_no = #{sendLogisticsNo}
|
|
|
|
- UNION ALL
|
|
|
|
- SELECT customer_id
|
|
|
|
- FROM tb_rst_repair
|
|
|
|
- WHERE repair_send_logistics_no =#{sendLogisticsNo} OR repair_back_logistics_no = #{sendLogisticsNo}
|
|
|
|
- UNION ALL
|
|
|
|
- SELECT customer_id
|
|
|
|
- FROM tb_rst_reissue
|
|
|
|
- WHERE reissue_send_logistics_no = #{sendLogisticsNo}
|
|
|
|
- UNION ALL
|
|
|
|
- SELECT customer_id
|
|
|
|
- FROM tb_rst_back_goods
|
|
|
|
- WHERE back_goods_back_logistics_no = #{sendLogisticsNo}
|
|
|
|
- UNION ALL
|
|
|
|
- SELECT customer_id
|
|
|
|
- FROM tb_rst_noreason_back
|
|
|
|
- WHERE noreason_back_back_logistics_no = #{sendLogisticsNo}
|
|
|
|
- )
|
|
|
|
|
|
+ AND cc.relationSendLogisticsNo = #{sendLogisticsNo} OR cc.relationBackLogisticsNo = #{sendLogisticsNo}
|
|
</if>
|
|
</if>
|
|
<if test="backStatus != null and backStatus != ''">
|
|
<if test="backStatus != null and backStatus != ''">
|
|
and c.customer_id in (
|
|
and c.customer_id in (
|