|
@@ -281,99 +281,41 @@
|
|
cc.relationSendLogisticsCompany AS sendLogisticsCompany,
|
|
cc.relationSendLogisticsCompany AS sendLogisticsCompany,
|
|
cc.relationBackLogisticsNo AS backLogisticsNo,
|
|
cc.relationBackLogisticsNo AS backLogisticsNo,
|
|
cc.relationBackLogisticsCompany AS backLogisticsCompany,
|
|
cc.relationBackLogisticsCompany AS backLogisticsCompany,
|
|
- oi.sales_pay_time AS salesTime
|
|
|
|
|
|
+ oi.sales_pay_time AS salesTime,
|
|
|
|
+ cc.procMethodId as procMethodId,
|
|
|
|
+ cc.procMethodName as procMethodName,
|
|
|
|
+ cc.procTypeId as procTypeId,
|
|
|
|
+ cc.procTypeName as procTypeName,
|
|
|
|
+ cc.customerIsSolve as customerIsSolve
|
|
FROM
|
|
FROM
|
|
tb_rst_cm_customer_info c
|
|
tb_rst_cm_customer_info c
|
|
LEFT JOIN (
|
|
LEFT JOIN (
|
|
- SELECT
|
|
|
|
|
|
+ SELECT
|
|
xx.*
|
|
xx.*
|
|
- FROM
|
|
|
|
|
|
+ FROM
|
|
(
|
|
(
|
|
- SELECT
|
|
|
|
- '3' AS customerIsSolve,
|
|
|
|
- renewed_id AS relationId,
|
|
|
|
- customer_id AS customerId,
|
|
|
|
- tb_rst_cm_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_cm_relation_order ON tb_rst_cm_relation_order.relation_id = tb_rst_renewed.renewed_id
|
|
|
|
- AND tb_rst_cm_relation_order.relation_type = '3'
|
|
|
|
- UNION ALL
|
|
|
|
- SELECT
|
|
|
|
- '4' AS customerIsSolve,
|
|
|
|
- repair_id AS relationId,
|
|
|
|
- customer_id AS customerId,
|
|
|
|
- tb_rst_cm_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_cm_relation_order ON tb_rst_cm_relation_order.relation_id = tb_rst_repair.repair_id
|
|
|
|
- AND tb_rst_cm_relation_order.relation_type = '4'
|
|
|
|
- UNION ALL
|
|
|
|
- SELECT
|
|
|
|
- '5' AS customerIsSolve,
|
|
|
|
- reissue_id AS relationId,
|
|
|
|
- customer_id AS customerId,
|
|
|
|
- tb_rst_cm_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_cm_relation_order ON tb_rst_cm_relation_order.relation_id = tb_rst_reissue.reissue_id
|
|
|
|
- AND tb_rst_cm_relation_order.relation_type = '5'
|
|
|
|
- UNION ALL
|
|
|
|
- SELECT
|
|
|
|
- '6' AS customerIsSolve,
|
|
|
|
- back_goods_id AS relationId,
|
|
|
|
- customer_id AS customerId,
|
|
|
|
- tb_rst_cm_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_cm_relation_order ON tb_rst_cm_relation_order.relation_id = tb_rst_back_goods.back_goods_id
|
|
|
|
- AND tb_rst_cm_relation_order.relation_type = '6'
|
|
|
|
- UNION ALL
|
|
|
|
- SELECT
|
|
|
|
- '7' AS customerIsSolve,
|
|
|
|
- noreason_back_id AS relationId,
|
|
|
|
- customer_id AS customerId,
|
|
|
|
- tb_rst_cm_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_cm_relation_order ON tb_rst_cm_relation_order.relation_id = tb_rst_noreason_back.noreason_back_id
|
|
|
|
- AND tb_rst_cm_relation_order.relation_type = '7'
|
|
|
|
- ) xx
|
|
|
|
|
|
+ SELECT
|
|
|
|
+ tb_rst_cm_proc_method.proc_type_id AS customerIsSolve,
|
|
|
|
+ tb_rst_cm_relation.relation_id AS relationId,
|
|
|
|
+ customer_id AS customerId,
|
|
|
|
+ tb_rst_cm_relation_order.sales_id AS orderId,
|
|
|
|
+ signclosed_id AS signclosedId,
|
|
|
|
+ relation_back_status AS relationBackStatus,
|
|
|
|
+ relation_send_status AS relationSendStatus,
|
|
|
|
+ relation_send_logistics_no AS relationSendLogisticsNo,
|
|
|
|
+ relation_send_logistics_company AS relationSendLogisticsCompany,
|
|
|
|
+ relation_back_logistics_no AS relationBackLogisticsNo,
|
|
|
|
+ relation_back_logistics_company AS relationBackLogisticsCompany,
|
|
|
|
+ tb_rst_cm_proc_method.proc_method_id AS procMethodId,
|
|
|
|
+ tb_rst_cm_proc_method.proc_method_name AS procMethodName,
|
|
|
|
+ tb_rst_cm_proc_type.proc_type_id AS procTypeId,
|
|
|
|
+ tb_rst_cm_proc_type.proc_type_name AS procTypeName
|
|
|
|
+ FROM
|
|
|
|
+ tb_rst_cm_relation
|
|
|
|
+ LEFT JOIN tb_rst_cm_proc_method ON tb_rst_cm_proc_method.proc_method_id = tb_rst_cm_relation.proc_method_id
|
|
|
|
+ LEFT JOIN tb_rst_cm_proc_type ON tb_rst_cm_proc_type.proc_type_id = tb_rst_cm_proc_method.proc_type_id
|
|
|
|
+ LEFT JOIN tb_rst_cm_relation_order ON tb_rst_cm_relation_order.relation_id = tb_rst_cm_relation.relation_id
|
|
|
|
+ ) xx
|
|
) cc ON cc.customerId = c.customer_id
|
|
) cc ON cc.customerId = c.customer_id
|
|
LEFT JOIN tb_rst_cm_visit v ON v.customer_id = c.customer_id
|
|
LEFT JOIN tb_rst_cm_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
|
|
@@ -393,7 +335,7 @@
|
|
c.customer_wechat_name like CONCAT('%',#{customerName},'%')
|
|
c.customer_wechat_name like CONCAT('%',#{customerName},'%')
|
|
</if>
|
|
</if>
|
|
<if test="customerIsSolve != null">
|
|
<if test="customerIsSolve != null">
|
|
- AND c.customer_is_solve = #{customerIsSolve}
|
|
|
|
|
|
+ AND cc.customerIsSolve = #{customerIsSolve}
|
|
</if>
|
|
</if>
|
|
<if test="customerTel != null and customerTel != ''">
|
|
<if test="customerTel != null and customerTel != ''">
|
|
and c.customer_tel like CONCAT('%',#{customerTel},'%')
|
|
and c.customer_tel like CONCAT('%',#{customerTel},'%')
|