Commit 772a9c84 authored by gaoyuan's avatar gaoyuan

4.9.3需求---平台创建人搜索

parent 457414c9
......@@ -591,6 +591,12 @@ public class CustomerManagementController extends BaseController {
model.addAttribute("actList", alist);
//平台创建人 ------> IM测试组组长及组员
Map<String, Object> paramMap = new HashMap<>( 10 );
paramMap.put( "deptUrlPath", "/1/2/69/70/71/556" );
List<UserEntity> createrList = user.queryByConditions( paramMap );
model.addAttribute("createrList", createrList);
List<CustomerListVO> customers = new ArrayList<>();
//用户标签
List<LabelEntity> userLabelList = user.queryUserLabel(userEntity.getId());//标签库中当前用户创建的标签
......
......@@ -216,13 +216,14 @@
}
/*.table td.mangerItem.mangerOperate {*/
/*width: 650px;*/
/*width: 650px;*/
/*}*/
.table td.mangerItem.mangerlist {
overflow: hidden;
padding: 0;
width: 33%;
}
.pace {
display: inline-block;
-webkit-pointer-events: none;
......@@ -588,6 +589,16 @@
活动名称:<input type="text" id="search_LIKE_sourceName" style="border: 1px solid #d5d5d5;" name="search_LIKE_sourceName" value="${param['search_LIKE_sourceName']}"
class="m-wrap small" placeholder="活动名称">&nbsp;&nbsp;&nbsp;&nbsp;
<c:if test="${city == 'nj'}">
平台创建人:<select name="search_EQ_createrId" id="search_EQ_createrId" style="width: 10rem">
<option value="">全部</option>
<c:forEach items="${createrList}" var="creater">
<option value="${creater.id}"
<c:if test="${creater.id eq param['search_EQ_createrId']}">selected="selected"</c:if>>${creater.realName}</option>
</c:forEach>
</select>
</c:if>
</c:if>
<div style="float: right">
......@@ -1045,7 +1056,8 @@
</c:forEach>
</div>
</div>
<div class="mangerlist__record" onclick="showCustomerCallbackLogs('${customer.id}', '${customer.managerId}')">
<div class="mangerlist__record"
onclick="showCustomerCallbackLogs('${customer.id}', '${customer.managerId}')">
查看回访记录
</div>
</c:if>
......@@ -1087,7 +1099,8 @@
</div>
<div style="display: table-cell;vertical-align: middle">
<c:if test="${customer.hasCustomerProjects}">
<div class="mangerOperate__record" onclick="showCustomerProjects('${customer.id}','${customer.managerId}')"
<div class="mangerOperate__record"
onclick="showCustomerProjects('${customer.id}','${customer.managerId}')"
style="position: relative;">
约看记录
<c:if test="${customer.hasNewCustomerProjects}">
......@@ -1653,6 +1666,8 @@
$("#search_EQ_createSource").trigger('chosen:updated');
$("#search_EQ_activeId").val("");
$("#search_EQ_activeId").trigger('chosen:updated');
$("#search_EQ_createrId").val("");
$("#search_EQ_createrId").trigger('chosen:updated');
// 重置回访状态下拉框
$("#search_EQ_isBack").val("1");
$("#search_EQ_isBack").trigger('chosen:updated');
......@@ -1699,6 +1714,7 @@
}
var customerIdList = [];
function addCustomerLabel() {
var haslabel = "${haslabel}";
if (haslabel != 1) {
......@@ -1869,6 +1885,7 @@
//全选
var checkNum = 0;
function checkAll(btn) {
if (btn.checked) {
for (var i = 0; i < document.getElementsByName('memberCheck').length; i++) {
......@@ -2124,6 +2141,7 @@
var curnet = "${sessionUser.cornet}";
var initopen = 0;
function callCustomer(memPhone, markedLabelId, managerId, customerId, buyIntention, abandon, isPeer, star) {
//先将bat2样式清楚
$(".bat2").removeAttr("style");
......@@ -2253,6 +2271,7 @@
var arr = new Array();
var arr2 = new Array();
var callId;
function addCallBack(_customerId, _phone, _buyIntention, isPeer, markedLabelId, star) {
$("#myModal").hide();
$("#labelModel").hide();
......@@ -2855,6 +2874,7 @@
obj.innerHTML = content;
console.info(obj)
}
function setCallbackContent2(template) {
var content = $(template).text();
var obj = document.getElementById("cusinfo");
......@@ -3130,10 +3150,10 @@
</div>
</div>
<script>
$(function(){
$(function () {
setTimeout(function () {
$(".pace").hide()
},1000)
}, 1000)
})
</script>
......
......@@ -434,6 +434,9 @@
AND ( SELECT count( * ) FROM customer_callback_log ccl WHERE ccl.customer_id = c.id ) = 0
AND ( SELECT count( * ) FROM customer_status_log csl WHERE csl.customer_id = c.id ) = 0
</if>
<if test="createrId != null and createrId != '' ">
AND c.creater =#{createrId}
</if>
<if test="orderBy != null and orderBy != '' ">
order by ${orderBy}
</if>
......@@ -684,6 +687,9 @@
AND ( SELECT count( * ) FROM customer_callback_log ccl WHERE ccl.customer_id = c.id ) = 0
AND ( SELECT count( * ) FROM customer_status_log csl WHERE csl.customer_id = c.id ) = 0
</if>
<if test="createrId != null and createrId != '' ">
AND c.creater =#{createrId}
</if>
</select>
......
......@@ -166,7 +166,7 @@
FROM customer_merge
where 1=1 and phone in
<foreach collection="phones" index="index" item="item" open="(" separator="," close=")">
#{item}
#{item}
</foreach>
and is_delete=0
and ( isWaitCall = 0 OR isWaitCall IS NULL )
......@@ -194,119 +194,119 @@
c.id, c.name, c.phone,c.status, c.create_time, c.creater,c.buy_intention, c.last_call_time, c.manager_id,c.manager_name, c.update_time,c.create_source,
c.cityCode, c.cityName, c.trace_status, c.crm_sync,c.bind_time, c.customer_source_type, c.isWaitCall,c.is_peer, c.starCustomer, c.isHandover
FROM customer_merge c
<if test='tabType =="9" || (callbackLog != null and callbackLog != "") || (customerSourceType2 != null and customerSourceType2 != "" )'>
inner join (
SELECT
c3.manager_id,c3.phone
FROM
customer_callback_log c2 right join customer c3 on c2.customer_id = c3.id
where 1=1
and c3.cityCode=#{cityCode}
AND c3.is_delete = 0
AND ( c3.isWaitCall = 0 OR c3.isWaitCall IS NULL )
AND c3.manager_id IS NOT NULL
AND c3.STATUS IN ( 11, 0, 99 )
<if test='tabType =="9"'>
and c3.customer_source_type=7
</if>
<if test="customerSourceType2 != null and customerSourceType2 != '' ">
and EXISTS (
select customer_source_type from customer c8
where c8.manager_id=c3.manager_id and c8.phone=c3.phone
and c8.customer_source_type=#{customerSourceType2}
)
</if>
<if test="callbackLog != null and callbackLog != '' ">
and c2.content like CONCAT('%', #{callbackLog},'%')
</if>
group by c3.manager_id,c3.phone
) t1 on c.manager_id=t1.manager_id and c.phone=t1.phone
</if>
<if test="(projectName != null and projectName != '') or (projectStatus != null and projectStatus != '')">
LEFT JOIN (
SELECT c1.manager_id, c1.phone FROM customer c1 inner join customer_project p1 on c1.id=p1.customer_id
WHERE 1=1 and (c1.manager_id = #{userId} OR c1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
and c1.cityCode = #{cityCode} AND c1.is_delete = 0 AND c1.STATUS IN ( 11, 0, 99 ) AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
<if test="projectName != null and projectName != '' ">
and p1.house_name LIKE CONCAT( '%', #{projectName}, '%' )
</if>
<if test="projectStatus != null and projectStatus != '' ">
and p1.STATUS = #{projectStatus}
</if>
<if test="phone != null and phone != '' ">
AND (c1.phone LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone1 LIKE CONCAT('%', #{phone},'%') OR
c1.bak_phone2 LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone3 LIKE CONCAT('%', #{phone},'%') )
</if>
group by c1.manager_id,c1.phone
)t2 on c.manager_id = t2.manager_id AND c.phone = t2.phone
</if>
<if test="labelIdList != null and labelIdList.size() > 0 ">
inner join (select distinct customerId from customer_label cl where cl.labelId in
<foreach item="item" index="index" collection="labelIdList" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR}
</foreach>
and cl.is_delete=0) m
on c.id=m.customerId
</if>
<if test="sourceName != null and sourceName != '' ">
left join (
SELECT ct1.manager_id, ct1.phone FROM customer ct1 WHERE 1=1
and ct1.cityCode=#{cityCode} and ct1.is_delete = 0 AND ct1.STATUS IN ( 11, 0, 99 )
and (ct1.manager_id=#{userId} OR ct1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
AND ct1.act_source LIKE concat( '%', #{sourceName}, '%' )
group by ct1.manager_id,ct1.phone
) t4 on c.manager_id = t4.manager_id AND c.phone = t4.phone
</if>
<if test="customTimeTypeTwo != null and customTimeTypeTwo != '' ">
left join (
select ct2.manager_id,ct2.phone
from customer ct2 inner join customer_status_log csl on ct2.id=csl.customer_id
where csl.is_delete = 0 and csl.to_status_id = 1
AND csl.create_time &gt;=#{customTimeStart}
AND csl.create_time &lt;=#{customTimeEnd}
group by ct2.manager_id,ct2.phone
) t5 on c.manager_id = t5.manager_id AND c.phone = t5.phone
</if>
<if test="customTimeTypeThree != null and customTimeTypeThree != '' ">
left join (
select ct2.manager_id,ct2.phone
from customer ct2 inner join customer_status_log csl on ct2.id=csl.customer_id
where csl.is_delete = 0 and csl.to_status_id = 2
AND csl.occur_time &gt;=#{customTimeStart}
AND csl.occur_time &lt;=#{customTimeEnd}
group by ct2.manager_id,ct2.phone
) t5 on c.manager_id = t5.manager_id AND c.phone = t5.phone
</if>
<if test="customTimeTypeFour != null and customTimeTypeFour != '' ">
left join (
select ct2.manager_id,ct2.phone
from customer ct2 inner join customer_status_log csl on ct2.id=csl.customer_id
where csl.is_delete = 0 and csl.to_status_id = 3
AND csl.occur_time &gt;=#{customTimeStart}
AND csl.occur_time &lt;=#{customTimeEnd}
group by ct2.manager_id,ct2.phone
) t5 on c.manager_id = t5.manager_id AND c.phone = t5.phone
</if>
<if test="customTimeTypeFive != null and customTimeTypeFive != '' ">
left join (
select ct2.manager_id,ct2.phone
from customer ct2 inner join customer_status_log csl on ct2.id=csl.customer_id
where csl.is_delete = 0 and csl.to_status_id = 4
AND csl.occur_time &gt;=#{customTimeStart}
AND csl.occur_time &lt;=#{customTimeEnd}
group by ct2.manager_id,ct2.phone
) t5 on c.manager_id = t5.manager_id AND c.phone = t5.phone
</if>
<if test="customTimeTypeSix != null and customTimeTypeSix != '' ">
left join (
select ct2.manager_id,ct2.phone
from customer ct2 inner join customer_status_log csl on ct2.id=csl.customer_id
where csl.is_delete = 0 and csl.to_status_id = 5
AND csl.occur_time &gt;=#{customTimeStart}
AND csl.occur_time &lt;=#{customTimeEnd}
group by ct2.manager_id,ct2.phone
) t5 on c.manager_id = t5.manager_id AND c.phone = t5.phone
</if>
<if test='tabType =="9" || (callbackLog != null and callbackLog != "") || (customerSourceType2 != null and customerSourceType2 != "" )'>
inner join (
SELECT
c3.manager_id,c3.phone
FROM
customer_callback_log c2 right join customer c3 on c2.customer_id = c3.id
where 1=1
and c3.cityCode=#{cityCode}
AND c3.is_delete = 0
AND ( c3.isWaitCall = 0 OR c3.isWaitCall IS NULL )
AND c3.manager_id IS NOT NULL
AND c3.STATUS IN ( 11, 0, 99 )
<if test='tabType =="9"'>
and c3.customer_source_type=7
</if>
<if test="customerSourceType2 != null and customerSourceType2 != '' ">
and EXISTS (
select customer_source_type from customer c8
where c8.manager_id=c3.manager_id and c8.phone=c3.phone
and c8.customer_source_type=#{customerSourceType2}
)
</if>
<if test="callbackLog != null and callbackLog != '' ">
and c2.content like CONCAT('%', #{callbackLog},'%')
</if>
group by c3.manager_id,c3.phone
) t1 on c.manager_id=t1.manager_id and c.phone=t1.phone
</if>
<if test="(projectName != null and projectName != '') or (projectStatus != null and projectStatus != '')">
LEFT JOIN (
SELECT c1.manager_id, c1.phone FROM customer c1 inner join customer_project p1 on c1.id=p1.customer_id
WHERE 1=1 and (c1.manager_id = #{userId} OR c1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
and c1.cityCode = #{cityCode} AND c1.is_delete = 0 AND c1.STATUS IN ( 11, 0, 99 ) AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
<if test="projectName != null and projectName != '' ">
and p1.house_name LIKE CONCAT( '%', #{projectName}, '%' )
</if>
<if test="projectStatus != null and projectStatus != '' ">
and p1.STATUS = #{projectStatus}
</if>
<if test="phone != null and phone != '' ">
AND (c1.phone LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone1 LIKE CONCAT('%', #{phone},'%') OR
c1.bak_phone2 LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone3 LIKE CONCAT('%', #{phone},'%') )
</if>
group by c1.manager_id,c1.phone
)t2 on c.manager_id = t2.manager_id AND c.phone = t2.phone
</if>
<if test="labelIdList != null and labelIdList.size() > 0 ">
inner join (select distinct customerId from customer_label cl where cl.labelId in
<foreach item="item" index="index" collection="labelIdList" open="(" separator="," close=")">
#{item,jdbcType=VARCHAR}
</foreach>
and cl.is_delete=0) m
on c.id=m.customerId
</if>
<if test="sourceName != null and sourceName != '' ">
left join (
SELECT ct1.manager_id, ct1.phone FROM customer ct1 WHERE 1=1
and ct1.cityCode=#{cityCode} and ct1.is_delete = 0 AND ct1.STATUS IN ( 11, 0, 99 )
and (ct1.manager_id=#{userId} OR ct1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
AND ct1.act_source LIKE concat( '%', #{sourceName}, '%' )
group by ct1.manager_id,ct1.phone
) t4 on c.manager_id = t4.manager_id AND c.phone = t4.phone
</if>
<if test="customTimeTypeTwo != null and customTimeTypeTwo != '' ">
left join (
select ct2.manager_id,ct2.phone
from customer ct2 inner join customer_status_log csl on ct2.id=csl.customer_id
where csl.is_delete = 0 and csl.to_status_id = 1
AND csl.create_time &gt;=#{customTimeStart}
AND csl.create_time &lt;=#{customTimeEnd}
group by ct2.manager_id,ct2.phone
) t5 on c.manager_id = t5.manager_id AND c.phone = t5.phone
</if>
<if test="customTimeTypeThree != null and customTimeTypeThree != '' ">
left join (
select ct2.manager_id,ct2.phone
from customer ct2 inner join customer_status_log csl on ct2.id=csl.customer_id
where csl.is_delete = 0 and csl.to_status_id = 2
AND csl.occur_time &gt;=#{customTimeStart}
AND csl.occur_time &lt;=#{customTimeEnd}
group by ct2.manager_id,ct2.phone
) t5 on c.manager_id = t5.manager_id AND c.phone = t5.phone
</if>
<if test="customTimeTypeFour != null and customTimeTypeFour != '' ">
left join (
select ct2.manager_id,ct2.phone
from customer ct2 inner join customer_status_log csl on ct2.id=csl.customer_id
where csl.is_delete = 0 and csl.to_status_id = 3
AND csl.occur_time &gt;=#{customTimeStart}
AND csl.occur_time &lt;=#{customTimeEnd}
group by ct2.manager_id,ct2.phone
) t5 on c.manager_id = t5.manager_id AND c.phone = t5.phone
</if>
<if test="customTimeTypeFive != null and customTimeTypeFive != '' ">
left join (
select ct2.manager_id,ct2.phone
from customer ct2 inner join customer_status_log csl on ct2.id=csl.customer_id
where csl.is_delete = 0 and csl.to_status_id = 4
AND csl.occur_time &gt;=#{customTimeStart}
AND csl.occur_time &lt;=#{customTimeEnd}
group by ct2.manager_id,ct2.phone
) t5 on c.manager_id = t5.manager_id AND c.phone = t5.phone
</if>
<if test="customTimeTypeSix != null and customTimeTypeSix != '' ">
left join (
select ct2.manager_id,ct2.phone
from customer ct2 inner join customer_status_log csl on ct2.id=csl.customer_id
where csl.is_delete = 0 and csl.to_status_id = 5
AND csl.occur_time &gt;=#{customTimeStart}
AND csl.occur_time &lt;=#{customTimeEnd}
group by ct2.manager_id,ct2.phone
) t5 on c.manager_id = t5.manager_id AND c.phone = t5.phone
</if>
where 1=1
<if test='tabType =="9" || (callbackLog != null and callbackLog != "") || (customerSourceType2 != null and customerSourceType2 != "" )'>
and t1.phone is not null
......@@ -333,7 +333,6 @@
or (customTimeTypeFive != null and customTimeTypeFive != '') or (customTimeTypeSix != null and customTimeTypeSix != '')">
and t5.phone is not null
</if>
<if test="cityCode != null and cityCode != '' ">
AND c.cityCode = #{cityCode}
</if>
......@@ -376,10 +375,6 @@
<if test="bindTimeEnd != null and bindTimeEnd != '' ">
AND c.bind_time &lt;=#{bindTimeEnd}
</if>
<!--<if test="customerSourceType2 != null and customerSourceType2 != '' ">-->
<!--AND c.customer_source_type =#{customerSourceType2}-->
<!--</if>-->
<if test="isNotBackFour != null and isNotBackFour != '' ">
and datediff( CURRENT_DATE, c.last_call_time ) &gt;= 3
AND datediff( CURRENT_DATE, c.last_call_time ) &lt;= 7
......@@ -401,14 +396,12 @@
AND c.last_call_time &gt;=#{customTimeStart}
AND c.last_call_time &lt;=#{customTimeEnd}
</if>
<if test="isStar != null and isStar != '' ">
AND c.starCustomer =1
</if>
<if test="isNotStar != null and isNotStar != '' ">
AND c.starCustomer =0
</if>
<if test="starCustomer != null and starCustomer != '' ">
AND c.starCustomer =#{starCustomer}
</if>
......@@ -419,7 +412,6 @@
<if test="isActive != null and isActive != '' ">
AND c.is_active = 1
</if>
<if test="isRecycled != null and isRecycled != '' ">
AND c.isRecycled =#{isRecycled}
</if>
......@@ -438,21 +430,22 @@
<if test='tabType =="2"'>
and c.trace_status = 1
</if>
<if test='tabType =="0"'>
AND ( SELECT count( * ) FROM customer_callback_log ccl WHERE ccl.customer_id = c.id ) = 0
AND ( SELECT count( * ) FROM customer_status_log csl WHERE csl.customer_id = c.id ) = 0
</if>
<if test="createrId != null and createrId != '' ">
AND c.creater =#{createrId}
</if>
<if test="orderBy != null and orderBy != '' ">
order by ${orderBy}
</if>
limit #{PageNumber}, #{pageSize};
</select>
<select id="getCustomerManagementList4LabelCount" resultType="Integer" parameterType="map">
SELECT
count(c.id)
count(c.id)
FROM customer_merge c
<if test='tabType =="9" || (callbackLog != null and callbackLog != "") || (customerSourceType2 != null and customerSourceType2 != "" )'>
inner join (
......@@ -694,27 +687,32 @@
AND ( SELECT count( * ) FROM customer_callback_log ccl WHERE ccl.customer_id = c.id ) = 0
AND ( SELECT count( * ) FROM customer_status_log csl WHERE csl.customer_id = c.id ) = 0
</if>
<if test="createrId != null and createrId != '' ">
AND c.creater =#{createrId}
</if>
</select>
<insert id="saveCustomerMerge" parameterType="com.house365.beans.entity.CustomerEntity">
insert into customer_merge
(id,name,phone,bak_phone1,bak_phone2,
bak_phone3,sex,customer_type,act_source,first_source,latest_source,crm_latest_call,crm_latest_call_result,status,create_source,
create_time,creater,buy_intention,last_visit_time,last_call_time,manager_id,manager_name,update_time,updater,cityCode,cityName,biz_port,crmId,act_source_id,trace_status,remark,crm_sync,hotline_call_time,
hotline_call_spend,ocean_date,
last_manager,is_delete,bind_time,
customer_source_type,customer_rel_id,isWaitCall,
singupTime,marketActId, marketActName, newCycle)
values
(
#{id},#{name},#{phone},#{bakPhone1},#{bakPhone2},
#{bakPhone3},#{sex},#{customerType},#{actSource},#{firstSource},#{latestSource},#{crmLatestCall},#{crmLatestCallResult},#{status},#{createSource},
#{createTime},#{creater},#{buyIntention},#{lastVisitTime},#{lastCallTime},#{managerId},#{managerName},#{updateTime},#{updater},#{cityCode},#{cityName},#{bizPort},#{crmId},#{actSourceId},#{traceStatus},#{remark},#{crmSync},#{hotlineCallTime},
#{hotlineCallSpend},#{oceanDate},
#{lastManager},#{isDelete},#{bindTime},
#{customerSourceType},#{customerRelId},#{isWaitCall},
#{singupTime},#{marketActId}, #{marketActName}, #{newCycle}
)
insert into customer_merge
(id,name,phone,bak_phone1,bak_phone2,
bak_phone3,sex,customer_type,act_source,first_source,latest_source,crm_latest_call,crm_latest_call_result,status,create_source,
create_time,creater,buy_intention,last_visit_time,last_call_time,manager_id,manager_name,update_time,updater,cityCode,cityName,biz_port,crmId,act_source_id,trace_status,remark,crm_sync,hotline_call_time,
hotline_call_spend,ocean_date,
last_manager,is_delete,bind_time,
customer_source_type,customer_rel_id,isWaitCall,
singupTime,marketActId, marketActName, newCycle)
values
(
#{id},#{name},#{phone},#{bakPhone1},#{bakPhone2},
#{bakPhone3},#{sex},#{customerType},#{actSource},#{firstSource},#{latestSource},#{crmLatestCall},#{crmLatestCallResult},#{status},#{createSource},
#{createTime},#{creater},#{buyIntention},#{lastVisitTime},#{lastCallTime},#{managerId},#{managerName},#{updateTime},#{updater},#{cityCode},#{cityName},#{bizPort},#{crmId},#{actSourceId},#{traceStatus},#{remark},#{crmSync},#{hotlineCallTime},
#{hotlineCallSpend},#{oceanDate},
#{lastManager},#{isDelete},#{bindTime},
#{customerSourceType},#{customerRelId},#{isWaitCall},
#{singupTime},#{marketActId}, #{marketActName}, #{newCycle}
)
</insert>
<update id="updateCustomerMerge" parameterType="com.house365.beans.entity.CustomerEntity">
......@@ -737,7 +735,6 @@
WHERE id = #{id}
</update>
<update id="updateCustomerMerge2" parameterType="com.house365.beans.entity.CustomerEntity">
UPDATE customer_merge
SET
......@@ -834,12 +831,12 @@
<select id="queryByConditions" resultMap="infoMap" parameterType="java.util.HashMap">
SELECT
id, name, phone, bak_phone1, bak_phone2, bak_phone3, sex, customer_type, act_source,
first_source, latest_source, crm_latest_call, crm_latest_call_result, status, create_source,
create_time, creater, buy_intention, last_visit_time, last_call_time, manager_id, manager_name,
update_time, updater, cityCode,cityName, biz_port,crmId,act_source_id, trace_status, remark, crm_sync,
hotline_call_time,hotline_call_spend,ocean_date,is_delete,last_manager,bind_time, customer_source_type,
customer_rel_id, isWaitCall, singupTime,marketActId, marketActName,is_peer, starCustomer, isHandover, isRecycled,is_active
id, name, phone, bak_phone1, bak_phone2, bak_phone3, sex, customer_type, act_source,
first_source, latest_source, crm_latest_call, crm_latest_call_result, status, create_source,
create_time, creater, buy_intention, last_visit_time, last_call_time, manager_id, manager_name,
update_time, updater, cityCode,cityName, biz_port,crmId,act_source_id, trace_status, remark, crm_sync,
hotline_call_time,hotline_call_spend,ocean_date,is_delete,last_manager,bind_time, customer_source_type,
customer_rel_id, isWaitCall, singupTime,marketActId, marketActName,is_peer, starCustomer, isHandover, isRecycled,is_active
FROM customer_merge
where is_delete = 0
<if test="phone != null and phone >=0">
......@@ -891,37 +888,37 @@
<select id="queryForAddHot" resultMap="infoMap" parameterType="java.util.HashMap">
SELECT id,phone FROM (
SELECT
id,phone
FROM customer_merge
where is_delete = 0
<if test="status != null and status >=0">
AND status = #{status}
</if>
<if test="createSource != null and createSource != '' ">
AND create_source = #{createSource}
</if>
<if test="isProtect != null and isProtect >=0">
AND DATE(create_time) >= DATE_SUB(CURDATE(), INTERVAL #{isProtect} DAY)
</if>
<if test="city != null and city != '' ">
AND cityCode = #{city}
</if>
<if test="isAdd != null and isAdd >=0">
UNION
SELECT id,phone FROM customer_merge
WHERE
STATUS = 11 AND is_delete = 0
AND ( create_source = 'SYSTEM' OR create_source = 'WECHAT')
AND DATE(create_time) >= DATE_SUB(CURDATE(), INTERVAL #{isProtect} DAY)
</if>
SELECT
id,phone
FROM customer_merge
where is_delete = 0
<if test="status != null and status >=0">
AND status = #{status}
</if>
<if test="createSource != null and createSource != '' ">
AND create_source = #{createSource}
</if>
<if test="isProtect != null and isProtect >=0">
AND DATE(create_time) >= DATE_SUB(CURDATE(), INTERVAL #{isProtect} DAY)
</if>
<if test="city != null and city != '' ">
AND cityCode = #{city}
</if>
<if test="isAdd != null and isAdd >=0">
UNION
SELECT id,phone FROM customer_merge
WHERE
STATUS = 11 AND is_delete = 0
AND ( create_source = 'SYSTEM' OR create_source = 'WECHAT')
AND DATE(create_time) >= DATE_SUB(CURDATE(), INTERVAL #{isProtect} DAY)
</if>
) AS temp
GROUP BY phone
</select>
<select id="queryCount" resultType="Integer" parameterType="java.util.HashMap">
SELECT
count(*)
count(*)
FROM customer_merge
where is_delete = 0
<if test="phone != null and phone >=0">
......@@ -938,18 +935,18 @@
<select id="countCustomer" resultType="Integer" parameterType="map">
select count(cm.id) from customer_merge cm
<if test="projectStatus != null and projectStatus !=''">
LEFT JOIN (
SELECT c1.manager_id, c1.phone FROM customer c1 inner join customer_project p1 on c1.id=p1.customer_id
WHERE 1=1 and (c1.manager_id = #{userId} OR c1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
and c1.cityCode = #{cityCode} AND c1.is_delete = 0 AND c1.STATUS IN ( 11, 0, 99 ) AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
<if test="projectStatus != null and projectStatus !=''">
LEFT JOIN (
SELECT c1.manager_id, c1.phone FROM customer c1 inner join customer_project p1 on c1.id=p1.customer_id
WHERE 1=1 and (c1.manager_id = #{userId} OR c1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
and c1.cityCode = #{cityCode} AND c1.is_delete = 0 AND c1.STATUS IN ( 11, 0, 99 ) AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
<if test="projectStatus != null and projectStatus != '' ">
and p1.STATUS = #{projectStatus}
</if>
group by c1.manager_id,c1.phone
)t2 on cm.manager_id = t2.manager_id AND cm.phone = t2.phone
</if>
<if test="projectStatus != null and projectStatus != '' ">
and p1.STATUS = #{projectStatus}
</if>
group by c1.manager_id,c1.phone
)t2 on cm.manager_id = t2.manager_id AND cm.phone = t2.phone
</if>
where cm.manager_Id = #{managerId}
<if test="buyIntention != null and buyIntention !='' and buyIntention !='23'">
......@@ -974,136 +971,136 @@
<select id="countCustomer2" resultType="Integer" parameterType="map">
select count(*) from (
select count(cm.id),count(cm.manager_id),cm.phone
from customer cm,customer_project cp
where cm.id=cp.customer_id
and cm.is_delete=0
and cm.status in (0,11,99)
and (cm.isWaitCall is null or cm.isWaitCall=0)
and cm.manager_Id = #{managerId}
<if test="buyIntention != null and buyIntention !='' and buyIntention !='23'">
and cm.buy_intention=#{buyIntention}
</if>
<if test="buyIntention =='23'">
and (cm.buy_intention IS NULL OR cm.buy_intention = '')
</if>
<if test="isStar != null and isStar !=''">
and cm.starCustomer=#{isStar}
</if>
<if test="projectStatus != null and projectStatus !=''">
and cp.status=#{projectStatus}
</if>
group by cm.phone
select count(cm.id),count(cm.manager_id),cm.phone
from customer cm,customer_project cp
where cm.id=cp.customer_id
and cm.is_delete=0
and cm.status in (0,11,99)
and (cm.isWaitCall is null or cm.isWaitCall=0)
and cm.manager_Id = #{managerId}
<if test="buyIntention != null and buyIntention !='' and buyIntention !='23'">
and cm.buy_intention=#{buyIntention}
</if>
<if test="buyIntention =='23'">
and (cm.buy_intention IS NULL OR cm.buy_intention = '')
</if>
<if test="isStar != null and isStar !=''">
and cm.starCustomer=#{isStar}
</if>
<if test="projectStatus != null and projectStatus !=''">
and cp.status=#{projectStatus}
</if>
group by cm.phone
) t
</select>
<select id="countCustomer3" resultType="Integer" parameterType="map">
select
count(*) from (
select count(cm.id),count(cm.manager_id),cm.phone from customer cm,customer_project cp,customer_callback_log ccl
where cm.id=cp.customer_id
and cm.manager_Id = #{managerId}
and cm.is_delete=0
and cm.status in (0,11,99)
and (cm.isWaitCall is null or cm.isWaitCall=0)
and cm.id=ccl.customer_id
<if test="buyIntention != null and buyIntention !='' and buyIntention !='23'">
and cm.buy_intention=#{buyIntention}
</if>
<if test="buyIntention =='23'">
and (cm.buy_intention IS NULL OR cm.buy_intention = '')
</if>
<if test="isStar != null and isStar !=''">
and cm.starCustomer=#{isStar}
</if>
<if test="projectStatus != null and projectStatus !=''">
and cp.status=#{projectStatus}
</if>
<if test="callbackLog != null and callbackLog !=''">
and ccl.content like concat('%', #{callbackLog}, '%')
</if>
group by cm.phone
count(*) from (
select count(cm.id),count(cm.manager_id),cm.phone from customer cm,customer_project cp,customer_callback_log ccl
where cm.id=cp.customer_id
and cm.manager_Id = #{managerId}
and cm.is_delete=0
and cm.status in (0,11,99)
and (cm.isWaitCall is null or cm.isWaitCall=0)
and cm.id=ccl.customer_id
<if test="buyIntention != null and buyIntention !='' and buyIntention !='23'">
and cm.buy_intention=#{buyIntention}
</if>
<if test="buyIntention =='23'">
and (cm.buy_intention IS NULL OR cm.buy_intention = '')
</if>
<if test="isStar != null and isStar !=''">
and cm.starCustomer=#{isStar}
</if>
<if test="projectStatus != null and projectStatus !=''">
and cp.status=#{projectStatus}
</if>
<if test="callbackLog != null and callbackLog !=''">
and ccl.content like concat('%', #{callbackLog}, '%')
</if>
group by cm.phone
) t
</select>
<select id="countCustomer4" resultType="Integer" parameterType="map">
select count(cm.id)
from customer_merge cm left JOIN (
SELECT
c3.manager_id,
c3.phone
FROM
customer_callback_log c2
right JOIN customer c3 ON c2.customer_id = c3.id
WHERE
1 = 1
AND c3.cityCode =#{cityCode}
AND c3.is_delete = 0
AND ( c3.isWaitCall = 0 OR c3.isWaitCall IS NULL )
AND c3.manager_id IS NOT NULL
AND c3.STATUS IN ( 11, 0, 99 )
AND c2.content LIKE CONCAT( '%', #{callbackLog}, '%' )
GROUP BY
c3.manager_id,
c3.phone
) t1 ON cm.manager_id = t1.manager_id
AND cm.phone = t1.phone
<if test="projectStatus != null and projectStatus != '' ">
LEFT JOIN (
SELECT c1.manager_id, c1.phone FROM customer c1 inner join customer_project p1 on c1.id=p1.customer_id
WHERE 1=1 and (c1.manager_id = #{userId} OR c1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
and c1.cityCode = #{cityCode} AND c1.is_delete = 0 AND c1.STATUS IN ( 11, 0, 99 ) AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
and p1.STATUS = #{projectStatus}
<if test="phone != null and phone != '' ">
AND (c1.phone LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone1 LIKE CONCAT('%', #{phone},'%') OR
c1.bak_phone2 LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone3 LIKE CONCAT('%', #{phone},'%') )
</if>
GROUP BY c1.manager_id,c1.phone
)t3 on cm.manager_id = t3.manager_id AND cm.phone = t3.phone
</if>
from customer_merge cm left JOIN (
SELECT
c3.manager_id,
c3.phone
FROM
customer_callback_log c2
right JOIN customer c3 ON c2.customer_id = c3.id
WHERE
1 = 1
AND c3.cityCode =#{cityCode}
AND c3.is_delete = 0
AND ( c3.isWaitCall = 0 OR c3.isWaitCall IS NULL )
AND c3.manager_id IS NOT NULL
AND c3.STATUS IN ( 11, 0, 99 )
AND c2.content LIKE CONCAT( '%', #{callbackLog}, '%' )
GROUP BY
c3.manager_id,
c3.phone
) t1 ON cm.manager_id = t1.manager_id
AND cm.phone = t1.phone
<if test="projectStatus != null and projectStatus != '' ">
LEFT JOIN (
SELECT c1.manager_id, c1.phone FROM customer c1 inner join customer_project p1 on c1.id=p1.customer_id
WHERE 1=1 and (c1.manager_id = #{userId} OR c1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
and c1.cityCode = #{cityCode} AND c1.is_delete = 0 AND c1.STATUS IN ( 11, 0, 99 ) AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
and p1.STATUS = #{projectStatus}
<if test="phone != null and phone != '' ">
AND (c1.phone LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone1 LIKE CONCAT('%', #{phone},'%') OR
c1.bak_phone2 LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone3 LIKE CONCAT('%', #{phone},'%') )
</if>
GROUP BY c1.manager_id,c1.phone
)t3 on cm.manager_id = t3.manager_id AND cm.phone = t3.phone
</if>
where 1=1
and t1.phone is not null
<if test="projectStatus != null and projectStatus != '' ">
and t3.phone is not null
</if>
AND cm.cityCode =#{cityCode}
and cm.is_delete=0
and cm.status in (0,11,99)
and (cm.isWaitCall is null or cm.isWaitCall=0)
and cm.manager_Id = #{managerId}
<if test="buyIntention != null and buyIntention !='' and buyIntention !='23'">
and cm.buy_intention=#{buyIntention}
</if>
<if test="buyIntention =='23'">
and (cm.buy_intention IS NULL OR cm.buy_intention = '')
</if>
<if test="isStar != null and isStar !=''">
and cm.starCustomer=#{isStar}
</if>
<if test="projectStatus != null and projectStatus !=''">
AND cm.id in ( SELECT customer_id FROM customer_project cp WHERE cp.STATUS = #{projectStatus} )
</if>
and t1.phone is not null
<if test="projectStatus != null and projectStatus != '' ">
and t3.phone is not null
</if>
AND cm.cityCode =#{cityCode}
and cm.is_delete=0
and cm.status in (0,11,99)
and (cm.isWaitCall is null or cm.isWaitCall=0)
and cm.manager_Id = #{managerId}
<if test="buyIntention != null and buyIntention !='' and buyIntention !='23'">
and cm.buy_intention=#{buyIntention}
</if>
<if test="buyIntention =='23'">
and (cm.buy_intention IS NULL OR cm.buy_intention = '')
</if>
<if test="isStar != null and isStar !=''">
and cm.starCustomer=#{isStar}
</if>
<if test="projectStatus != null and projectStatus !=''">
AND cm.id in ( SELECT customer_id FROM customer_project cp WHERE cp.STATUS = #{projectStatus} )
</if>
</select>
<select id="getAllCustomer" resultType="com.house365.beans.entity.CustomerEntity" parameterType="map">
select cm.id,cm.manager_id,cm.phone
from customer_merge cm
<if test="projectStatus != null and projectStatus !=''">
LEFT JOIN (
SELECT c1.manager_id, c1.phone FROM customer c1 inner join customer_project p1 on c1.id=p1.customer_id
WHERE 1=1 and (c1.manager_id = #{userId} OR c1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
and c1.cityCode = #{cityCode} AND c1.is_delete = 0 AND c1.STATUS IN ( 11, 0, 99 ) AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
<if test="projectStatus != null and projectStatus !=''">
LEFT JOIN (
SELECT c1.manager_id, c1.phone FROM customer c1 inner join customer_project p1 on c1.id=p1.customer_id
WHERE 1=1 and (c1.manager_id = #{userId} OR c1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
and c1.cityCode = #{cityCode} AND c1.is_delete = 0 AND c1.STATUS IN ( 11, 0, 99 ) AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
<if test="projectStatus != null and projectStatus != '' ">
and p1.STATUS = #{projectStatus}
</if>
group by c1.manager_id,c1.phone
)t2 on cm.manager_id = t2.manager_id AND cm.phone = t2.phone
</if>
<if test="projectStatus != null and projectStatus != '' ">
and p1.STATUS = #{projectStatus}
</if>
group by c1.manager_id,c1.phone
)t2 on cm.manager_id = t2.manager_id AND cm.phone = t2.phone
</if>
where cm.manager_Id = #{managerId}
<if test="buyIntention != null and buyIntention !='' and buyIntention !='23'">
and cm.buy_intention=#{buyIntention}
......@@ -1125,26 +1122,26 @@
<select id="getAllCustomer2" resultType="com.house365.beans.entity.CustomerEntity" parameterType="map">
select t.id,t.manager_id,t.phone from (
select cm.id,cm.manager_id,cm.phone
from customer cm,customer_project cp
where cm.id=cp.customer_id
and cm.is_delete=0
and cm.status in (0,11,99)
and (cm.isWaitCall is null or cm.isWaitCall=0)
and cm.manager_Id = #{managerId}
<if test="buyIntention != null and buyIntention !='' and buyIntention !='23'">
and cm.buy_intention=#{buyIntention}
</if>
<if test="buyIntention =='23'">
and (cm.buy_intention IS NULL OR cm.buy_intention = '')
</if>
<if test="isStar != null and isStar !=''">
and cm.starCustomer=#{isStar}
</if>
<if test="projectStatus != null and projectStatus !=''">
and cp.status=#{projectStatus}
</if>
) t
select cm.id,cm.manager_id,cm.phone
from customer cm,customer_project cp
where cm.id=cp.customer_id
and cm.is_delete=0
and cm.status in (0,11,99)
and (cm.isWaitCall is null or cm.isWaitCall=0)
and cm.manager_Id = #{managerId}
<if test="buyIntention != null and buyIntention !='' and buyIntention !='23'">
and cm.buy_intention=#{buyIntention}
</if>
<if test="buyIntention =='23'">
and (cm.buy_intention IS NULL OR cm.buy_intention = '')
</if>
<if test="isStar != null and isStar !=''">
and cm.starCustomer=#{isStar}
</if>
<if test="projectStatus != null and projectStatus !=''">
and cp.status=#{projectStatus}
</if>
) t
group by t.manager_Id,t.phone
</select>
......@@ -1180,37 +1177,37 @@
<select id="getAllCustomer4" resultType="com.house365.beans.entity.CustomerEntity" parameterType="map">
select cm.id,cm.manager_Id,cm.phone
from customer_merge cm left JOIN (
SELECT
c3.manager_id,
c3.phone
FROM
customer_callback_log c2
right JOIN customer c3 ON c2.customer_id = c3.id
WHERE
1 = 1
AND c3.cityCode =#{cityCode}
AND c3.is_delete = 0
AND ( c3.isWaitCall = 0 OR c3.isWaitCall IS NULL )
AND c3.manager_id IS NOT NULL
AND c3.STATUS IN ( 11, 0, 99 )
AND c2.content LIKE CONCAT( '%', #{callbackLog}, '%' )
GROUP BY
c3.manager_id,
c3.phone
) t1 ON cm.manager_id = t1.manager_id AND cm.phone = t1.phone
<if test="projectStatus != null and projectStatus != '' ">
LEFT JOIN (
SELECT c1.manager_id, c1.phone FROM customer c1 inner join customer_project p1 on c1.id=p1.customer_id
WHERE 1=1 and (c1.manager_id = #{userId} OR c1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
and c1.cityCode = #{cityCode} AND c1.is_delete = 0 AND c1.STATUS IN ( 11, 0, 99 ) AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
and p1.STATUS = #{projectStatus}
<if test="phone != null and phone != '' ">
AND (c1.phone LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone1 LIKE CONCAT('%', #{phone},'%') OR
c1.bak_phone2 LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone3 LIKE CONCAT('%', #{phone},'%') )
</if>
GROUP BY c1.manager_id,c1.phone
)t3 on cm.manager_id = t3.manager_id AND cm.phone = t3.phone
</if>
SELECT
c3.manager_id,
c3.phone
FROM
customer_callback_log c2
right JOIN customer c3 ON c2.customer_id = c3.id
WHERE
1 = 1
AND c3.cityCode =#{cityCode}
AND c3.is_delete = 0
AND ( c3.isWaitCall = 0 OR c3.isWaitCall IS NULL )
AND c3.manager_id IS NOT NULL
AND c3.STATUS IN ( 11, 0, 99 )
AND c2.content LIKE CONCAT( '%', #{callbackLog}, '%' )
GROUP BY
c3.manager_id,
c3.phone
) t1 ON cm.manager_id = t1.manager_id AND cm.phone = t1.phone
<if test="projectStatus != null and projectStatus != '' ">
LEFT JOIN (
SELECT c1.manager_id, c1.phone FROM customer c1 inner join customer_project p1 on c1.id=p1.customer_id
WHERE 1=1 and (c1.manager_id = #{userId} OR c1.manager_id IN ( SELECT id FROM user WHERE depturlpath LIKE ( SELECT concat( depturlpath, '/%' ) FROM user WHERE id = #{userId} ) ))
and c1.cityCode = #{cityCode} AND c1.is_delete = 0 AND c1.STATUS IN ( 11, 0, 99 ) AND ( c1.isWaitCall = 0 OR c1.isWaitCall IS NULL )
and p1.STATUS = #{projectStatus}
<if test="phone != null and phone != '' ">
AND (c1.phone LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone1 LIKE CONCAT('%', #{phone},'%') OR
c1.bak_phone2 LIKE CONCAT('%', #{phone},'%') OR c1.bak_phone3 LIKE CONCAT('%', #{phone},'%') )
</if>
GROUP BY c1.manager_id,c1.phone
)t3 on cm.manager_id = t3.manager_id AND cm.phone = t3.phone
</if>
where 1=1
and t1.phone is not null
<if test="projectStatus != null and projectStatus != '' ">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment