(SELECT GROUP_CONCAT(name) FROM ecw_customer_competitor n WHERE FIND_IN_SET(n.id,(SELECT competitor_ids FROM ecw_customer WHERE id=a.id))) AS competitor_names,
(SELECT GROUP_CONCAT(name) FROM ecw_customer_competitor n WHERE FIND_IN_SET(n.id,(SELECT competitor_ids FROM ecw_customer WHERE id=a.id))) AS competitor_names,
su2.creator as create_username
su2.nickname as create_username
from ecw_customer a
from ecw_customer a
left join (select * from ecw_customer_contacts where is_default = 1 and deleted = 0) as c on a.id = c.customer_id
left join (select * from ecw_customer_contacts where is_default = 1 and deleted = 0) as c on a.id = c.customer_id
left join system_user su on a.customer_service = su.id
left join system_user su on a.customer_service = su.id
...
@@ -97,7 +97,10 @@
...
@@ -97,7 +97,10 @@
GROUP BY contact.id
GROUP BY contact.id
order by contact.id desc
order by contact.id desc
limit #{start}, #{size}
<iftest="start != null and size != null">
limit #{start}, #{size}
</if>
</select>
</select>
<selectid="getWaitToAssignedCustomerPageReq"
<selectid="getWaitToAssignedCustomerPageReq"
...
@@ -519,26 +522,21 @@
...
@@ -519,26 +522,21 @@
AND contact.is_customer_service_confirmed = #{query.isCustomerServiceConfirmed}
AND contact.is_customer_service_confirmed = #{query.isCustomerServiceConfirmed}
</if>
</if>
<iftest="query.department != null and query.department != '' ">
AND contact.department = #{query.department}
<!--部门deptIds-->
<iftest="query.deptIds != null and query.deptIds.size()>0">
(contact.enter_open_sea_time is not null and contact.enter_open_sea_time BETWEEN #{query.beginEnterOpenSeaTime} AND #{query.endEnterOpenSeaTime})
</foreach>
or (contact.enter_open_sea_time is null and contact.estimate_enter_open_sea_time BETWEEN #{query.beginEnterOpenSeaTime} AND #{query.endEnterOpenSeaTime})
</if>
)
</if>
</if>
<!--客户状态 -->
<!--是否新客户-->
<iftest="query.status != null and query.status.size()>0">
<iftest="query.isNew != null">
AND contact.is_new = #{query.isNew}
</if>
<iftest="query.status != null and query.status != '' and query.status.size()==1 ">
GET {{baseUrl}}/ecw/customer/page?pageNo=1&pageSize=100&name=
GET {{baseUrl}}/ecw/customer/page?pageNo=1&pageSize=10&customerService[0]=1144&customerService[1]=2659&beginEnterOpenSeaTime=2024-10-02%2000%3A00%3A00&endEnterOpenSeaTime=2024-10-05%2000%3A00%3A00
if(nor.customer_id != null and nor.customer_id > 0L,
if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService,
"") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number,
nor.customer_number as consignor_customer_number,
...
@@ -1231,7 +1231,7 @@
...
@@ -1231,7 +1231,7 @@
nor.phone as consignor_phone,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id,
nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L,
if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService,
"") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number,
nee.customer_number as consignee_customer_number,
...
@@ -1364,7 +1364,7 @@
...
@@ -1364,7 +1364,7 @@
in_time,
in_time,
if(#{query.userType} = 1, 1, 2) as user_type,
if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id,
nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L,
if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService,
"") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number,
nor.customer_number as consignor_customer_number,
...
@@ -1373,7 +1373,7 @@
...
@@ -1373,7 +1373,7 @@
nor.phone as consignor_phone,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id,
nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L,
if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService,
"") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number,
nee.customer_number as consignee_customer_number,
...
@@ -3707,7 +3707,7 @@
...
@@ -3707,7 +3707,7 @@
in_time,
in_time,
if(#{query.userType} = 1, 1, 2) as user_type,
if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id,
nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L,
if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService,
"") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number,
nor.customer_number as consignor_customer_number,
...
@@ -3716,7 +3716,7 @@
...
@@ -3716,7 +3716,7 @@
nor.phone as consignor_phone,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id,
nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L,
if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService,
"") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number,
nee.customer_number as consignee_customer_number,
...
@@ -3831,7 +3831,7 @@
...
@@ -3831,7 +3831,7 @@
in_time,
in_time,
if(#{query.userType} = 1, 1, 2) as user_type,
if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id,
nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L,
if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService,
"") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number,
nor.customer_number as consignor_customer_number,
...
@@ -3840,7 +3840,7 @@
...
@@ -3840,7 +3840,7 @@
nor.phone as consignor_phone,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id,
nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L,
if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService,
"") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number,
nee.customer_number as consignee_customer_number,
...
@@ -3981,7 +3981,7 @@
...
@@ -3981,7 +3981,7 @@
in_time,
in_time,
if(#{query.userType} = 1, 1, 2) as user_type,
if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id,
nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L,
if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService,
"") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number,
nor.customer_number as consignor_customer_number,
...
@@ -3990,7 +3990,7 @@
...
@@ -3990,7 +3990,7 @@
nor.phone as consignor_phone,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id,
nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L,
if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService,
"") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number,
nee.customer_number as consignee_customer_number,
...
@@ -4117,7 +4117,7 @@
...
@@ -4117,7 +4117,7 @@
in_time,
in_time,
if(#{query.userType} = 1, 1, 2) as user_type,
if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id,
nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L,
if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService,
"") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number,
nor.customer_number as consignor_customer_number,
...
@@ -4126,7 +4126,7 @@
...
@@ -4126,7 +4126,7 @@
nor.phone as consignor_phone,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id,
nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L,
if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService,
"") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number,
nee.customer_number as consignee_customer_number,
...
@@ -4222,7 +4222,7 @@
...
@@ -4222,7 +4222,7 @@
in_time,
in_time,
if(#{query.userType} = 1, 1, 2) as user_type,
if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id,
nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L,
if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService,
"") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number,
nor.customer_number as consignor_customer_number,
...
@@ -4231,7 +4231,7 @@
...
@@ -4231,7 +4231,7 @@
nor.phone as consignor_phone,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id,
nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L,
if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService,
"") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number,
nee.customer_number as consignee_customer_number,
...
@@ -4340,7 +4340,7 @@
...
@@ -4340,7 +4340,7 @@
o.is_exception,
o.is_exception,
o.create_time,
o.create_time,
nor.customer_id as consignor_customer_id,
nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L,
if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService,
"") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number,
nor.customer_number as consignor_customer_number,
...
@@ -4349,7 +4349,7 @@
...
@@ -4349,7 +4349,7 @@
nor.phone as consignor_phone,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id,
nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L,
if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService,
"") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number,
nee.customer_number as consignee_customer_number,
...
@@ -5328,7 +5328,7 @@
...
@@ -5328,7 +5328,7 @@
o.create_time,
o.create_time,
if(#{query.userType} = 1, 1, 2) as user_type,
if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id,
nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L,
if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService,
"") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number,
nor.customer_number as consignor_customer_number,
...
@@ -5337,7 +5337,7 @@
...
@@ -5337,7 +5337,7 @@
nor.phone as consignor_phone,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id,
nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L,
if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
"") as consignee_follow_customerService,
"") as consignee_follow_customerService,
nee.customer_number as consignee_customer_number,
nee.customer_number as consignee_customer_number,
...
@@ -5427,7 +5427,7 @@
...
@@ -5427,7 +5427,7 @@
o.create_time,
o.create_time,
if(#{query.userType} = 1, 1, 2) as user_type,
if(#{query.userType} = 1, 1, 2) as user_type,
nor.customer_id as consignor_customer_id,
nor.customer_id as consignor_customer_id,
if(nor.customer_id != null and nor.customer_id > 0L,
if(nor.customer_id != null and nor.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nor.customer_id),
"") as consignor_follow_customerService,
"") as consignor_follow_customerService,
nor.customer_number as consignor_customer_number,
nor.customer_number as consignor_customer_number,
...
@@ -5436,7 +5436,7 @@
...
@@ -5436,7 +5436,7 @@
nor.phone as consignor_phone,
nor.phone as consignor_phone,
nor.country_code as consignor_country_code,
nor.country_code as consignor_country_code,
nee.customer_id as consignee_customer_id,
nee.customer_id as consignee_customer_id,
if(nee.customer_id != null and nee.customer_id > 0L,
if(nee.customer_id != null and nee.customer_id > 0,
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),
(SELECT u1.nickname FROM system_user u1 JOIN system_user u2 on u1.id = u2.customer_service_id JOIN ecw_customer u ON u.customer_service = u2.id WHERE u.id = nee.customer_id),