|
@@ -58,13 +58,16 @@
|
|
|
t.customer_out_damaged,
|
|
|
t.customer_secondary_customer,
|
|
|
t.customer_last_id,
|
|
|
- t.customer_initial_id
|
|
|
- from tb_rst_customer_info t
|
|
|
+ t.customer_initial_id,
|
|
|
+ t.customer_province_id,
|
|
|
+ t.customer_city_id,
|
|
|
+ t.customer_district_id
|
|
|
+ from tb_rst_cm_customer_info t
|
|
|
where t.customer_id = #{customerId,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
- delete from tb_rst_customer_info
|
|
|
+ delete from tb_rst_cm_customer_info
|
|
|
where customer_id = #{customerId,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
|
|
@@ -109,16 +112,16 @@
|
|
|
d.describe_handle_desc,
|
|
|
d.describe_content
|
|
|
from
|
|
|
- tb_rst_customer_info c
|
|
|
- LEFT JOIN tb_rst_question_describe d ON c.customer_id = d.customer_id
|
|
|
+ tb_rst_cm_customer_info c
|
|
|
+ LEFT JOIN tb_rst_cm_question_describe d ON c.customer_id = d.customer_id
|
|
|
LEFT JOIN tb_rst_product_type t ON c.type_id = t.type_id
|
|
|
- LEFT JOIN tb_rst_complaint_question q ON c.question_id = q.question_id
|
|
|
- LEFT JOIN tb_rst_complaint_small_class s ON q.small_class_id = s.small_class_id
|
|
|
- LEFT JOIN tb_rst_complaint_type ct ON s.complaint_id = ct.complaint_id
|
|
|
+ LEFT JOIN tb_rst_cm_complaint_question q ON c.question_id = q.question_id
|
|
|
+ LEFT JOIN tb_rst_cm_complaint_small_class s ON q.small_class_id = s.small_class_id
|
|
|
+ LEFT JOIN tb_rst_cm_complaint_type ct ON s.complaint_id = ct.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_sys_admin a ON c.admin_id = a.admin_id
|
|
|
- LEFT JOIN tb_rst_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_sys_admin sa ON v.designated_admin_id = sa.admin_id
|
|
|
<where>
|
|
|
<if test="customerName != null and customerName != ''">
|
|
@@ -281,106 +284,48 @@
|
|
|
cc.relationSendLogisticsCompany AS sendLogisticsCompany,
|
|
|
cc.relationBackLogisticsNo AS backLogisticsNo,
|
|
|
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
|
|
|
- tb_rst_customer_info c
|
|
|
+ tb_rst_cm_customer_info c
|
|
|
LEFT JOIN (
|
|
|
- SELECT
|
|
|
+ SELECT
|
|
|
xx.*
|
|
|
- FROM
|
|
|
+ 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
|
|
|
+ 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
|
|
|
- LEFT JOIN tb_rst_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_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_cm_question_describe qd ON c.customer_id = qd.customer_id
|
|
|
+ LEFT JOIN tb_rst_cm_complaint_question cq ON c.question_id = cq.question_id
|
|
|
+ LEFT JOIN tb_rst_cm_complaint_small_class csc ON csc.small_class_id = cq.small_class_id
|
|
|
+ LEFT JOIN tb_rst_cm_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
|
|
@@ -393,7 +338,7 @@
|
|
|
c.customer_wechat_name like CONCAT('%',#{customerName},'%')
|
|
|
</if>
|
|
|
<if test="customerIsSolve != null">
|
|
|
- AND c.customer_is_solve = #{customerIsSolve}
|
|
|
+ AND cc.customerIsSolve = #{customerIsSolve}
|
|
|
</if>
|
|
|
<if test="customerTel != null and customerTel != ''">
|
|
|
and c.customer_tel like CONCAT('%',#{customerTel},'%')
|
|
@@ -440,39 +385,15 @@
|
|
|
<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}
|
|
|
+ FROM tb_rst_cm_relation trr
|
|
|
+ WHERE relation_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
|
|
|
+ FROM tb_rst_cm_relation trr
|
|
|
+ WHERE DATEDIFF(NOW(), relation_create_time) > 3
|
|
|
)
|
|
|
</if>
|
|
|
</where>
|
|
@@ -531,24 +452,27 @@
|
|
|
</select>
|
|
|
|
|
|
<insert id="insert" parameterType="CustomerInfo" useGeneratedKeys="true" keyProperty="customerId">
|
|
|
- insert into tb_rst_customer_info (customer_id, admin_id, question_id,
|
|
|
+ insert into tb_rst_cm_customer_info (customer_id, admin_id, question_id,
|
|
|
company_id, store_id, customer_source_type,
|
|
|
customer_source, customer_counsel_type, customer_name,
|
|
|
customer_tel,customer_wechat_name, customer_is_solve, customer_is_visit,
|
|
|
- customer_in_TDS, customer_out_TDS, customer_area, type_id, customer_desc, customer_out_damaged, customer_secondary_customer, customer_last_id, customer_initial_id
|
|
|
+ customer_in_TDS, customer_out_TDS, customer_area, type_id, customer_desc, customer_out_damaged, customer_secondary_customer, customer_last_id,
|
|
|
+ customer_province_id,customer_city_id,customer_district_id,
|
|
|
+ customer_initial_id
|
|
|
)
|
|
|
values (#{customerId,jdbcType=INTEGER}, #{adminId,jdbcType=INTEGER}, #{questionId,jdbcType=INTEGER},
|
|
|
#{companyId,jdbcType=INTEGER}, #{storeId,jdbcType=INTEGER}, #{customerSourceType,jdbcType=TINYINT},
|
|
|
#{customerSource,jdbcType=VARCHAR}, #{customerCounselType,jdbcType=BIT}, #{customerName,jdbcType=VARCHAR},
|
|
|
#{customerTel,jdbcType=VARCHAR},#{customerWechatName,jdbcType=VARCHAR}, #{customerIsSolve,jdbcType=TINYINT}, #{customerIsVisit,jdbcType=VARCHAR},
|
|
|
- #{customerInTDS,jdbcType=INTEGER}, #{customerOutTDS,jdbcType=INTEGER}, #{customerArea,jdbcType=VARCHAR},#{typeId},#{customerDesc},#{customerOutDamaged},#{customerSecondaryCustomer}
|
|
|
- ,#{customerLastId},#{customerInitialId}
|
|
|
+ #{customerInTDS,jdbcType=INTEGER}, #{customerOutTDS,jdbcType=INTEGER}, #{customerArea,jdbcType=VARCHAR},#{typeId},#{customerDesc},#{customerOutDamaged},#{customerSecondaryCustomer},#{customerLastId},
|
|
|
+ #{customerProvinceId},#{customerCityId},#{customerDistrictId},
|
|
|
+ #{customerInitialId}
|
|
|
)
|
|
|
</insert>
|
|
|
|
|
|
<!-- 修改客诉信息 -->
|
|
|
<update id="updateCustomerInfo" parameterType="CustomerInfo" >
|
|
|
- update tb_rst_customer_info
|
|
|
+ update tb_rst_cm_customer_info
|
|
|
<set >
|
|
|
<if test="adminId != null" >
|
|
|
admin_id = #{adminId},
|
|
@@ -617,7 +541,16 @@
|
|
|
customer_last_id = #{customerLastId},
|
|
|
</if>
|
|
|
<if test="customerInitialId != null" >
|
|
|
- customer_initial_id = #{customerInitialId}
|
|
|
+ customer_initial_id = #{customerInitialId},
|
|
|
+ </if>
|
|
|
+ <if test="customerProvinceId != null" >
|
|
|
+ customer_province_id = #{customerProvinceId},
|
|
|
+ </if>
|
|
|
+ <if test="customerCityId != null" >
|
|
|
+ customer_city_id = #{customerCityId},
|
|
|
+ </if>
|
|
|
+ <if test="customerDistrictId != null" >
|
|
|
+ customer_district_id = #{customerDistrictId},
|
|
|
</if>
|
|
|
<if test="factoryId != null" >
|
|
|
factory_id = #{factoryId}
|
|
@@ -631,7 +564,7 @@
|
|
|
pt.*
|
|
|
FROM
|
|
|
tb_rst_product_type pt
|
|
|
- LEFT JOIN tb_rst_customer_info ci ON pt.type_id = ci.type_id
|
|
|
+ LEFT JOIN tb_rst_cm_customer_info ci ON pt.type_id = ci.type_id
|
|
|
where
|
|
|
ci.customer_id = #{customerId}
|
|
|
</select>
|
|
@@ -640,7 +573,7 @@
|
|
|
SELECT
|
|
|
COUNT(customer_id)
|
|
|
FROM
|
|
|
- tb_rst_customer_info
|
|
|
+ tb_rst_cm_customer_info
|
|
|
<where>
|
|
|
<if test="questionId != null" >
|
|
|
question_id = #{questionId}
|
|
@@ -698,16 +631,16 @@
|
|
|
d.describe_handle_desc,
|
|
|
d.describe_content
|
|
|
from
|
|
|
- tb_rst_customer_info c
|
|
|
- LEFT JOIN tb_rst_question_describe d ON c.customer_id = d.customer_id
|
|
|
+ tb_rst_cm_customer_info c
|
|
|
+ LEFT JOIN tb_rst_cm_question_describe d ON c.customer_id = d.customer_id
|
|
|
LEFT JOIN tb_rst_product_type t ON c.type_id = t.type_id
|
|
|
- LEFT JOIN tb_rst_complaint_question q ON c.question_id = q.question_id
|
|
|
- LEFT JOIN tb_rst_complaint_small_class s ON q.small_class_id = s.small_class_id
|
|
|
- LEFT JOIN tb_rst_complaint_type ct ON s.complaint_id = ct.complaint_id
|
|
|
+ LEFT JOIN tb_rst_cm_complaint_question q ON c.question_id = q.question_id
|
|
|
+ LEFT JOIN tb_rst_cm_complaint_small_class s ON q.small_class_id = s.small_class_id
|
|
|
+ LEFT JOIN tb_rst_cm_complaint_type ct ON s.complaint_id = ct.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_sys_admin a ON c.admin_id = a.admin_id
|
|
|
- LEFT JOIN tb_rst_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_sys_admin sa ON v.designated_admin_id = sa.admin_id
|
|
|
<where>
|
|
|
<if test="customerName != null and customerName != ''">
|
|
@@ -804,11 +737,11 @@ ELSE
|
|
|
END) AS customerSecondaryCustomer,
|
|
|
sa.admin_name AS adminName
|
|
|
FROM
|
|
|
- tb_rst_customer_info c
|
|
|
-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
|
|
|
+ tb_rst_cm_customer_info c
|
|
|
+LEFT JOIN tb_rst_cm_question_describe qd ON c.customer_id = qd.customer_id
|
|
|
+LEFT JOIN tb_rst_cm_complaint_question cq ON c.question_id = cq.question_id
|
|
|
+LEFT JOIN tb_rst_cm_complaint_small_class csc ON csc.small_class_id = cq.small_class_id
|
|
|
+LEFT JOIN tb_rst_cm_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_sys_admin sa ON c.admin_id = sa.admin_id
|
|
@@ -870,7 +803,7 @@ LEFT JOIN tb_rst_sys_admin sa ON c.admin_id = sa.admin_id
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY oi.sales_id) salesNum
|
|
|
- LEFT JOIN tb_rst_relation_order ro
|
|
|
+ LEFT JOIN tb_rst_cm_relation_order ro
|
|
|
on ro.sales_id = salesNum.sales_id
|
|
|
WHERE relation_type = 3) salesExchange
|
|
|
GROUP BY
|
|
@@ -904,7 +837,7 @@ LEFT JOIN tb_rst_sys_admin sa ON c.admin_id = sa.admin_id
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY oi.sales_id) salesNum
|
|
|
- LEFT JOIN tb_rst_relation_order ro
|
|
|
+ LEFT JOIN tb_rst_cm_relation_order ro
|
|
|
on ro.sales_id = salesNum.sales_id
|
|
|
WHERE relation_type in (6,7)) salesExchange
|
|
|
GROUP BY
|
|
@@ -938,11 +871,11 @@ LEFT JOIN tb_rst_sys_admin sa ON c.admin_id = sa.admin_id
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY oi.sales_id) salesNum
|
|
|
- LEFT JOIN tb_rst_relation_order ro
|
|
|
+ LEFT JOIN tb_rst_cm_relation_order ro
|
|
|
on ro.sales_id = salesNum.sales_id
|
|
|
LEFT JOIN tb_rst_renewed rr
|
|
|
on ro.relation_id = rr.renewed_id
|
|
|
- LEFT JOIN tb_rst_customer_info ci
|
|
|
+ LEFT JOIN tb_rst_cm_customer_info ci
|
|
|
ON rr.customer_id = ci.customer_id
|
|
|
WHERE relation_type = 3 and ci.customer_secondary_customer = 1) salesExchange
|
|
|
GROUP BY
|
|
@@ -976,16 +909,139 @@ LEFT JOIN tb_rst_sys_admin sa ON c.admin_id = sa.admin_id
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY oi.sales_id) salesNum
|
|
|
- LEFT JOIN tb_rst_relation_order ro
|
|
|
+ LEFT JOIN tb_rst_cm_relation_order ro
|
|
|
on ro.sales_id = salesNum.sales_id
|
|
|
LEFT JOIN tb_rst_renewed rr
|
|
|
on ro.relation_id = rr.renewed_id
|
|
|
- LEFT JOIN tb_rst_customer_info ci
|
|
|
+ LEFT JOIN tb_rst_cm_customer_info ci
|
|
|
ON rr.customer_id = ci.customer_id
|
|
|
WHERE relation_type in(6,7) and ci.customer_secondary_customer = 1) salesExchange
|
|
|
GROUP BY
|
|
|
MONTH (salesExchange.sales_create_time)
|
|
|
</select>
|
|
|
<!-- 退换货统计sql end -->
|
|
|
+ <!-- 查询所有处理类型-->
|
|
|
+ <select id="listProcType" resultType="ProcType">
|
|
|
+ SELECT * from tb_rst_cm_proc_type
|
|
|
+ </select>
|
|
|
+ <!-- 根据处理类型查询处理方式-->
|
|
|
+ <select id="listProcMethod" parameterType="Integer" resultType="ProcMethod">
|
|
|
+ SELECT * from tb_rst_cm_proc_method WHERE proc_type_id = #{procTypeId}
|
|
|
+ </select>
|
|
|
+ <!-- 根据id查询处理方式-->
|
|
|
+ <select id="getProcMethod" parameterType="Integer" resultType="ProcMethod">
|
|
|
+ SELECT * from tb_rst_cm_proc_method WHERE proc_method_id = #{procMethodId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 修改售后处理信息 -->
|
|
|
+ <update id="updateCmRelation" parameterType="CmRelation" >
|
|
|
+ UPDATE tb_rst_cm_relation
|
|
|
+ <set>
|
|
|
+ <if test="signclosedId != null and signclosedId != ''">
|
|
|
+ signclosed_id = #{"signclosedId"},
|
|
|
+ </if>
|
|
|
+ <if test="relationBackStatus != null and relationBackStatus != ''" >
|
|
|
+ relation_back_status = #{relationBackStatus},
|
|
|
+ </if>
|
|
|
+ <if test="relationBackName != null and relationBackName != ''" >
|
|
|
+ relation_back_name = #{relationBackName},
|
|
|
+ </if>
|
|
|
+ <if test="relationBackTel != null and relationBackTel != ''" >
|
|
|
+ relation_back_tel = #{relationBackTel},
|
|
|
+ </if>
|
|
|
+ <if test="relationBackLogisticsCompany != null and relationBackLogisticsCompany != ''" >
|
|
|
+ relation_back_logistics_company = #{relationBackTel},
|
|
|
+ </if>
|
|
|
+ <if test="relationBackLogisticsNo != null and relationBackLogisticsNo != ''" >
|
|
|
+ relation_back_logistics_no = #{relationBackLogisticsNo},
|
|
|
+ </if>
|
|
|
+ <if test="relationBackPostage != null and relationBackPostage != ''" >
|
|
|
+ relation_back_postage = #{relationBackPostage},
|
|
|
+ </if>
|
|
|
+ <if test="relationBackMachineNo != null and relationBackMachineNo != ''" >
|
|
|
+ relation_back_machine_no = #{relationBackMachineNo},
|
|
|
+ </if>
|
|
|
+ <if test="relationSendStatus != null and relationSendStatus != ''" >
|
|
|
+ relation_send_status = #{relationSendStatus},
|
|
|
+ </if>
|
|
|
+ <if test="relationBackEfastOrderId != null and relationBackEfastOrderId != ''" >
|
|
|
+ relation_back_efast_order_id = #{relationBackEfastOrderId},
|
|
|
+ </if>
|
|
|
+ <if test="relationSendName != null and relationSendName != ''" >
|
|
|
+ relation_send_name = #{relationSendName},
|
|
|
+ </if>
|
|
|
+ <if test="relationSendTel != null and relationSendTel != ''" >
|
|
|
+ relation_send_tel = #{relationSendTel},
|
|
|
+ </if>
|
|
|
+ <if test="provinceNumber != null and provinceNumber != ''" >
|
|
|
+ province_number = #{provinceNumber},
|
|
|
+ </if>
|
|
|
+ <if test="cityNumber != null and cityNumber != ''" >
|
|
|
+ city_number = #{cityNumber},
|
|
|
+ </if>
|
|
|
+ <if test="areaNumber != null and areaNumber != ''" >
|
|
|
+ area_number = #{areaNumber},
|
|
|
+ </if>
|
|
|
+ <if test="relationSendMergeAddress != null and relationSendMergeAddress != ''" >
|
|
|
+ relation_send_merge_address = #{relationSendMergeAddress},
|
|
|
+ </if>
|
|
|
+ <if test="relationSendAddress != null and relationSendAddress != ''" >
|
|
|
+ relation_send_address = #{relationSendAddress},
|
|
|
+ </if>
|
|
|
+ <if test="relationSendLogisticsCompany != null and relationSendLogisticsCompany != ''" >
|
|
|
+ relation_send_logistics_company = #{relationSendLogisticsCompany},
|
|
|
+ </if>
|
|
|
+ <if test="relationSendLogisticsNo != null and relationSendLogisticsNo != ''" >
|
|
|
+ relation_send_logistics_no = #{relationSendLogisticsNo},
|
|
|
+ </if>
|
|
|
+ <if test="relationDesc != null and relationDesc != ''" >
|
|
|
+ relation_desc = #{relationDesc},
|
|
|
+ </if>
|
|
|
+ <if test="relationState != null and relationState != ''" >
|
|
|
+ relation_state = #{relationState},
|
|
|
+ </if>
|
|
|
+ <if test="relationAlipay != null and relationAlipay != ''" >
|
|
|
+ relation_alipay = #{relationAlipay},
|
|
|
+ </if>
|
|
|
+ <if test="relationAlipayName != null and relationAlipayName != ''" >
|
|
|
+ relation_alipay_name = #{relationAlipayName},
|
|
|
+ </if>
|
|
|
+ <if test="relationIsTransfer != null and relationIsTransfer != ''" >
|
|
|
+ relation_is_transfer = #{relationIsTransfer},
|
|
|
+ </if>
|
|
|
+ <if test="relationCreateTime != null and relationCreateTime != ''" >
|
|
|
+ relation_create_time = #{relationCreateTime},
|
|
|
+ </if>
|
|
|
+ <if test="relationUpdateTime != null and relationUpdateTime != ''" >
|
|
|
+ relation_update_time = #{relationUpdateTime},
|
|
|
+ </if>
|
|
|
+ <if test="relationFactoryCosts != null and relationFactoryCosts != ''" >
|
|
|
+ relation_factory_costs = #{relationFactoryCosts},
|
|
|
+ </if>
|
|
|
+ <if test="relationCustomerCosts != null and relationCustomerCosts != ''" >
|
|
|
+ relation_customer_costs = #{relationCustomerCosts},
|
|
|
+ </if>
|
|
|
+ <if test="relationBackReceiptDate != null and relationBackReceiptDate != ''" >
|
|
|
+ relation_back_receipt_date = #{relationBackReceiptDate}
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ <where>
|
|
|
+ relation_id = #{relationId}
|
|
|
+ </where>
|
|
|
+ </update>
|
|
|
|
|
|
+ <select id="getCmRelationInfo" parameterType="CmRelation" resultType="CmRelation">
|
|
|
+ SELECT
|
|
|
+ *
|
|
|
+ FROM
|
|
|
+ tb_rst_cm_relation
|
|
|
+ <where>
|
|
|
+ <if test="relationId != null and relationId != ''">
|
|
|
+ relation_id = #{relationId},
|
|
|
+ </if>
|
|
|
+ <if test="customerId != null and customerId != ''">
|
|
|
+ customer_id = #{customerId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
</mapper>
|