|
@@ -233,6 +233,358 @@
|
|
|
|
|
|
ORDER BY c.customer_id desc
|
|
|
</select>
|
|
|
+ <!--<select id="listCustomer" parameterType="CustomerInfo" resultMap="customerMap">
|
|
|
+ SELECT
|
|
|
+ c.customer_id,
|
|
|
+ c.customer_counsel_type,
|
|
|
+ c.customer_area,
|
|
|
+ c.customer_in_TDS,
|
|
|
+ c.customer_out_TDS,
|
|
|
+ c.customer_is_solve,
|
|
|
+ c.customer_is_visit,
|
|
|
+ c.customer_create_time,
|
|
|
+ c.customer_desc,
|
|
|
+ c.customer_out_damaged,
|
|
|
+ c.customer_secondary_customer,
|
|
|
+ c.customer_last_id,
|
|
|
+ c.customer_initial_id,
|
|
|
+ c.customer_name,
|
|
|
+ c.customer_tel,
|
|
|
+ c.customer_wechat_name,
|
|
|
+ c.customer_source_type,
|
|
|
+ c.customer_source,
|
|
|
+ ct.complaint_class_name,
|
|
|
+ csc.small_class_name,
|
|
|
+ t.type_name,
|
|
|
+ a.admin_name,
|
|
|
+ qd.describe_title,
|
|
|
+ qd.describe_handle_desc,
|
|
|
+ qd.describe_content,
|
|
|
+ sc.company_name,
|
|
|
+ si.store_name,
|
|
|
+ v.visit_status,
|
|
|
+ v.visit_complete_date,
|
|
|
+ v.visit_name,
|
|
|
+ v.visit_tel,
|
|
|
+ v.visit_date,
|
|
|
+ v.visit_time_select,
|
|
|
+ v.visit_complete_name,
|
|
|
+ v.visit_complete_tel,
|
|
|
+ sa.admin_name AS visitDesignatedAdminName,
|
|
|
+ cq.question_profile,
|
|
|
+ cc.relationBackStatus AS backStatus,
|
|
|
+ cc.relationSendStatus AS sendStatus,
|
|
|
+ cc.relationSendLogisticsNo AS sendLogisticsNo,
|
|
|
+ cc.relationSendLogisticsCompany AS sendLogisticsCompany,
|
|
|
+ cc.relationBackLogisticsNo AS backLogisticsNo,
|
|
|
+ cc.relationBackLogisticsCompany AS backLogisticsCompany,
|
|
|
+ oi.sales_pay_time AS salesTime
|
|
|
+ FROM
|
|
|
+ tb_rst_customer_info c
|
|
|
+ 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_efast_order_id AS relationBackEfastOrderId,
|
|
|
+ renewed_back_name AS relationBackName,
|
|
|
+ renewed_back_tel AS relationBackTel,
|
|
|
+ renewed_back_status AS relationBackStatus,
|
|
|
+ renewed_back_logistics_company AS relationBackLogisticsCompany,
|
|
|
+ renewed_back_logistics_no AS relationBackLogisticsNo,
|
|
|
+ renewed_back_postage AS relationBackPostage,
|
|
|
+ renewed_back_machine_no AS relationBackMachineNo,
|
|
|
+ renewed_send_status AS relationSendStatus,
|
|
|
+ renewed_send_name AS relationSendName,
|
|
|
+ renewed_send_tel AS relationSendTel,
|
|
|
+ province_number AS provinceNumber,
|
|
|
+ city_number AS cityNumber,
|
|
|
+ area_number AS areaNumber,
|
|
|
+ renewed_send_merge_address AS relationSendMergeAddress,
|
|
|
+ renewed_send_address AS relationSendAddress,
|
|
|
+ renewed_send_logistics_company AS relationSendLogisticsCompany,
|
|
|
+ renewed_send_logistics_no AS relationSendLogisticsNo,
|
|
|
+ renewed_desc AS relationDesc,
|
|
|
+ renewed_state AS relationState,
|
|
|
+ renewed_alipay AS relationAlipay,
|
|
|
+ renewed_is_transfer AS relationIsTransfer,
|
|
|
+ renewed_alipay_name AS relationAlipayName,
|
|
|
+ renewed_back_receipt_date AS relationBackReceiptDate
|
|
|
+ FROM
|
|
|
+ tb_rst_renewed
|
|
|
+ LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_renewed.renewed_id
|
|
|
+ WHERE
|
|
|
+ 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_efast_order_id AS relationBackEfastOrderId,
|
|
|
+ repair_back_name AS relationBackName,
|
|
|
+ repair_back_tel AS relationBackTel,
|
|
|
+ repair_back_status AS relationBackStatus,
|
|
|
+ repair_back_logistics_company AS relationBackLogisticsCompany,
|
|
|
+ repair_back_logistics_no AS relationBackLogisticsNo,
|
|
|
+ repair_back_postage AS relationBackPostage,
|
|
|
+ repair_back_machine_no AS relationBackMachineNo,
|
|
|
+ repair_send_status AS relationSendStatus,
|
|
|
+ repair_send_name AS relationSendName,
|
|
|
+ repair_send_tel AS relationSendTel,
|
|
|
+ province_number AS provinceNumber,
|
|
|
+ city_number AS cityNumber,
|
|
|
+ area_number AS areaNumber,
|
|
|
+ repair_send_merge_address AS relationSendMergeAddress,
|
|
|
+ repair_send_address AS relationSendAddress,
|
|
|
+ repair_send_logistics_company AS relationSendLogisticsCompany,
|
|
|
+ repair_send_logistics_no AS relationSendLogisticsNo,
|
|
|
+ repair_desc AS relationDesc,
|
|
|
+ repair_state AS relationState,
|
|
|
+ repair_alipay AS relationAlipay,
|
|
|
+ repair_is_transfer AS relationIsTransfer,
|
|
|
+ repair_alipay_name AS relationAlipayName,
|
|
|
+ repair_back_receipt_date AS relationBackReceiptDate
|
|
|
+ FROM
|
|
|
+ tb_rst_repair
|
|
|
+ LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_repair.repair_id
|
|
|
+ WHERE
|
|
|
+ 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,
|
|
|
+ reissue_back_efast_order_id AS relationBackEfastOrderId,
|
|
|
+ NULL AS relationBackName,
|
|
|
+ NULL AS relationBackTel,
|
|
|
+ NULL AS relationBackStatus,
|
|
|
+ NULL AS relationBackLogisticsCompany,
|
|
|
+ NULL AS relationBackLogisticsNo,
|
|
|
+ NULL AS relationBackPostage,
|
|
|
+ NULL AS relationBackMachineNo,
|
|
|
+ reissue_send_status AS relationSendStatus,
|
|
|
+ reissue_send_name AS relationSendName,
|
|
|
+ reissue_send_tel AS relationSendTel,
|
|
|
+ province_number AS provinceNumber,
|
|
|
+ city_number AS cityNumber,
|
|
|
+ area_number AS areaNumber,
|
|
|
+ reissue_send_merge_address AS relationSendMergeAddress,
|
|
|
+ reissue_send_address AS relationSendAddress,
|
|
|
+ reissue_send_logistics_company AS relationSendLogisticsCompany,
|
|
|
+ reissue_send_logistics_no AS relationSendLogisticsNo,
|
|
|
+ reissue_desc AS relationDesc,
|
|
|
+ reissue_state AS relationState,
|
|
|
+ NULL AS relationAlipay,
|
|
|
+ NULL AS relationIsTransfer,
|
|
|
+ NULL AS relationAlipayName,
|
|
|
+ NULL AS relationBackReceiptDate
|
|
|
+ FROM
|
|
|
+ tb_rst_reissue
|
|
|
+ LEFT JOIN tb_rst_relation_order ON tb_rst_relation_order.relation_id = tb_rst_reissue.reissue_id
|
|
|
+ WHERE
|
|
|
+ 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,
|
|
|
+ NULL AS relationBackEfastOrderId,
|
|
|
+ back_goods_back_name AS relationBackName,
|
|
|
+ back_goods_back_tel AS relationBackTel,
|
|
|
+ back_goods_back_status AS relationBackStatus,
|
|
|
+ back_goods_back_logistics_company AS relationBackLogisticsCompany,
|
|
|
+ back_goods_back_logistics_no AS relationBackLogisticsNo,
|
|
|
+ back_goods_back_postage AS relationBackPostage,
|
|
|
+ back_goods_back_machine_no AS relationBackMachineNo,
|
|
|
+ NULL AS relationSendStatus,
|
|
|
+ NULL AS relationSendName,
|
|
|
+ NULL AS relationSendTel,
|
|
|
+ NULL AS provinceNumber,
|
|
|
+ NULL AS cityNumber,
|
|
|
+ NULL AS areaNumber,
|
|
|
+ NULL AS relationSendMergeAddress,
|
|
|
+ NULL AS relationSendAddress,
|
|
|
+ NULL AS relationSendLogisticsCompany,
|
|
|
+ NULL AS relationSendLogisticsNo,
|
|
|
+ back_goods_desc AS relationDesc,
|
|
|
+ back_goods_state AS relationState,
|
|
|
+ back_goods_alipay AS relationAlipay,
|
|
|
+ back_goods_is_transfer AS relationIsTransfer,
|
|
|
+ back_goods_alipay_name AS relationAlipayName,
|
|
|
+ back_goods_back_receipt_date AS relationBackReceiptDate
|
|
|
+ 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
|
|
|
+ WHERE
|
|
|
+ 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,
|
|
|
+ NULL AS relationBackEfastOrderId,
|
|
|
+ noreason_back_back_name AS relationBackName,
|
|
|
+ noreason_back_back_tel AS relationBackTel,
|
|
|
+ noreason_back_back_status AS relationBackStatus,
|
|
|
+ noreason_back_back_logistics_company AS relationBackLogisticsCompany,
|
|
|
+ noreason_back_back_logistics_no AS relationBackLogisticsNo,
|
|
|
+ noreason_back_back_postage AS relationBackPostage,
|
|
|
+ noreason_back_back_machine_no AS relationBackMachineNo,
|
|
|
+ NULL AS relationSendStatus,
|
|
|
+ NULL AS relationSendName,
|
|
|
+ NULL AS relationSendTel,
|
|
|
+ NULL AS provinceNumber,
|
|
|
+ NULL AS cityNumber,
|
|
|
+ NULL AS areaNumber,
|
|
|
+ NULL AS relationSendMergeAddress,
|
|
|
+ NULL AS relationSendAddress,
|
|
|
+ NULL AS relationSendLogisticsCompany,
|
|
|
+ NULL AS relationSendLogisticsNo,
|
|
|
+ noreason_back_desc AS relationDesc,
|
|
|
+ noreason_back_state AS relationState,
|
|
|
+ noreason_back_alipay AS relationAlipay,
|
|
|
+ noreason_back_is_transfer AS relationIsTransfer,
|
|
|
+ noreason_back_alipay_name AS relationAlipayName,
|
|
|
+ noreason_back_receipt_date AS relationBackReceiptDate
|
|
|
+ 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
|
|
|
+ WHERE
|
|
|
+ tb_rst_relation_order.relation_type = '7'
|
|
|
+ ) cc ON cc.customerId = 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_question_describe qd ON c.customer_id = qd.customer_id
|
|
|
+ LEFT JOIN tb_rst_complaint_question cq ON c.question_id = cq.question_id
|
|
|
+ LEFT JOIN tb_rst_complaint_small_class csc ON csc.small_class_id = cq.small_class_id
|
|
|
+ LEFT JOIN tb_rst_complaint_type ct ON ct.complaint_id = csc.complaint_id
|
|
|
+ LEFT JOIN tb_rst_sales_company sc ON c.company_id = sc.company_id
|
|
|
+ LEFT JOIN tb_rst_store_info si ON c.store_id = si.store_id
|
|
|
+ LEFT JOIN tb_rst_product_type t ON c.type_id = t.type_id
|
|
|
+ LEFT JOIN tb_rst_sys_admin a ON c.admin_id = a.admin_id
|
|
|
+ LEFT JOIN tb_rst_sys_admin sa ON v.designated_admin_id = sa.admin_id
|
|
|
+ <where>
|
|
|
+ <if test="customerName != null and customerName != ''">
|
|
|
+ c.customer_name like CONCAT('%',#{customerName},'%')
|
|
|
+ OR
|
|
|
+ c.customer_wechat_name like CONCAT('%',#{customerName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="customerIsSolve != null">
|
|
|
+ AND c.customer_is_solve = #{customerIsSolve}
|
|
|
+ </if>
|
|
|
+ <if test="customerTel != null and customerTel != ''">
|
|
|
+ and c.customer_tel like CONCAT('%',#{customerTel},'%')
|
|
|
+ </if>
|
|
|
+ <if test="describeTitle != null and describeTitle != ''">
|
|
|
+ and d.describe_title like CONCAT('%',#{describeTitle},'%')
|
|
|
+ </if>
|
|
|
+ <if test="questionId != null and questionId != ''">
|
|
|
+ and c.question_id = #{questionId}
|
|
|
+ </if>
|
|
|
+ <if test="customerSourceType != null and customerSourceType != ''">
|
|
|
+ and c.customer_source_type = #{customerSourceType}
|
|
|
+ </if>
|
|
|
+ <if test="complaintId != null and complaintId != ''">
|
|
|
+ and ct.complaint_id = #{complaintId}
|
|
|
+ </if>
|
|
|
+ <if test="smallClassId != null and smallClassId != ''">
|
|
|
+ and s.small_class_id = #{smallClassId}
|
|
|
+ </if>
|
|
|
+ <if test="customerIsVisit != null and customerIsVisit != ''">
|
|
|
+ and c.customer_is_visit = #{customerIsVisit}
|
|
|
+ </if>
|
|
|
+ <if test="adminId != null and adminId != ''">
|
|
|
+ and c.admin_id = #{adminId}
|
|
|
+ </if>
|
|
|
+ <if test="customerId != null and customerId != ''">
|
|
|
+ and c.customer_id = #{customerId}
|
|
|
+ </if>
|
|
|
+ <if test="typeId != null and typeId != ''">
|
|
|
+ and c.type_id = #{typeId}
|
|
|
+ </if>
|
|
|
+ <if test="visitDesignatedAdminId != null">
|
|
|
+ and v.designated_admin_id = #{visitDesignatedAdminId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null">
|
|
|
+ and c.customer_create_time > #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null">
|
|
|
+ and c.customer_create_time < #{endTime}
|
|
|
+ </if>
|
|
|
+ <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}
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="backStatus != null and backStatus != ''">
|
|
|
+ and c.customer_id in (
|
|
|
+ SELECT customer_id
|
|
|
+ FROM tb_rst_renewed trr
|
|
|
+ WHERE renewed_back_status = #{backStatus}
|
|
|
+ UNION ALL
|
|
|
+ SELECT customer_id
|
|
|
+ FROM tb_rst_repair
|
|
|
+ WHERE repair_back_status =#{backStatus}
|
|
|
+ UNION ALL
|
|
|
+ SELECT customer_id
|
|
|
+ FROM tb_rst_back_goods
|
|
|
+ WHERE back_goods_back_status = #{backStatus}
|
|
|
+ UNION ALL
|
|
|
+ SELECT customer_id
|
|
|
+ FROM tb_rst_noreason_back
|
|
|
+ WHERE noreason_back_back_status = #{backStatus}
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="backStatus == 1">
|
|
|
+ and c.customer_id in (
|
|
|
+ SELECT customer_id
|
|
|
+ FROM tb_rst_renewed trr
|
|
|
+ WHERE DATEDIFF(NOW(), renewed_create_time) > 3
|
|
|
+ UNION ALL
|
|
|
+ SELECT customer_id
|
|
|
+ FROM tb_rst_repair
|
|
|
+ WHERE DATEDIFF(NOW(), repair_create_time) > 3
|
|
|
+ UNION ALL
|
|
|
+ SELECT customer_id
|
|
|
+ FROM tb_rst_back_goods
|
|
|
+ WHERE DATEDIFF(NOW(), back_goods_create_time) > 3
|
|
|
+ UNION ALL
|
|
|
+ SELECT customer_id
|
|
|
+ FROM tb_rst_noreason_back
|
|
|
+ WHERE DATEDIFF(NOW(), noreason_back_create_time) > 3
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY c.customer_id desc
|
|
|
+ </select>-->
|
|
|
|
|
|
<resultMap id="customerMap" type="CustomerInfo">
|
|
|
<id column="customer_id" property="customerId"/>
|