| 
					
				 | 
			
			
				@@ -289,4 +289,137 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ) t 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         GROUP BY t.type 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="selectCrmMyCustomerListQuery" resultType="com.fs.crm.vo.CrmMyCustomerListQueryVO"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        select cu.*,c.create_time as customer_create_time,c.visit_status,c.remark,c.register_desc,c.register_submit_time, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               c.customer_code,c.customer_name,c.mobile,c.sex,c.weixin,c.address,c.is_receive,c.customer_type,c.source, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+               c.tags,c.receive_time 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        from crm_customer_user cu 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            inner join crm_customer c on c.customer_user_id=cu.customer_user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        where cu.is_pool=0  and c.is_del = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.companyId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and cu.company_id =#{maps.companyId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.companyUserId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and cu.company_user_id =#{maps.companyUserId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.address != null and  maps.address != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.address like CONCAT('%',#{maps.address},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.customerCode != null and  maps.customerCode != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.customer_code like CONCAT('%',#{maps.customerCode},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.customerName != null and  maps.customerName != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.customer_name like CONCAT('%',#{maps.customerName},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.mobile != null and  maps.mobile != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.mobile like CONCAT('%',#{maps.mobile},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.status != null and  maps.status != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.visit_status IN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <foreach collection="maps.status.split(',')" item="item" index="index" open="(" close=")" separator=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #{item} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.isHisOrder != null and  maps.isHisOrder == 1"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and (select ifnull(count(1),0) from crm_customer_his_order h where h.customer_id=c.customer_id )  > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.isHisOrder != null and  maps.isHisOrder == 0"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and (select ifnull(count(1),0) from crm_customer_his_order h where h.customer_id=c.customer_id )  = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.customerType != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.customer_type IN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <foreach collection="maps.customerType.split(',')" item="item" index="index" open="(" separator="," close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #{item} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.source != null and  maps.source != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.source IN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <foreach collection="maps.source.split(',')" item="item" index="index" open="(" separator="," close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #{item} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.tags != null and  maps.tags != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <foreach collection="maps.tags.split(',')" item="tag" open="(" separator="OR" close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                find_in_set(#{tag},c.tags) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.customerCreateTime != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND date_format(c.create_time,'%y%m%d') >= date_format(#{maps.customerCreateTime[0]},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND date_format(c.create_time,'%y%m%d') <= date_format(#{maps.customerCreateTime[1]},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.beginTime != null and maps.beginTime != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and date_format(c.receive_time,'%y%m%d') >= date_format(#{maps.beginTime},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.endTime != null and maps.endTime != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and date_format(c.receive_time,'%y%m%d') <= date_format(#{maps.endTime},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        order by cu.customer_user_id desc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="selectCrmMyAssistListQuery" resultType="com.fs.crm.vo.CrmMyCustomerListQueryVO"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        select cu.*,c.create_time as customer_create_time,c.visit_status,c.remark,c.register_desc,c.register_submit_time, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        c.customer_code,c.customer_name,c.mobile,c.sex,c.weixin,c.address,c.is_receive,c.customer_type,c.source, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        c.tags,c.receive_time 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        from crm_customer_assist ca 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN  crm_customer c on c.customer_id=ca.customer_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN crm_customer_user cu on c.customer_user_id=cu.customer_user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        where c.is_pool=0  and c.is_del = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.companyId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and ca.company_id =#{maps.companyId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.companyUserId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and ca.company_user_id =#{maps.companyUserId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.address != null and  maps.address != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.address like CONCAT('%',#{maps.address},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.customerCode != null and  maps.customerCode != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.customer_code like CONCAT('%',#{maps.customerCode},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.customerName != null and  maps.customerName != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.customer_name like CONCAT('%',#{maps.customerName},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.mobile != null and  maps.mobile != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.mobile like CONCAT('%',#{maps.mobile},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.status != null and  maps.status != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.visit_status IN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <foreach collection="maps.status.split(',')" item="item" index="index" open="(" close=")" separator=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #{item} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.isHisOrder != null and  maps.isHisOrder == 1"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and (select ifnull(count(1),0) from crm_customer_his_order h where h.customer_id=c.customer_id )  > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.isHisOrder != null and  maps.isHisOrder == 0"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and (select ifnull(count(1),0) from crm_customer_his_order h where h.customer_id=c.customer_id )  = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.customerType != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.customer_type IN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <foreach collection="maps.customerType.split(',')" item="item" index="index" open="(" separator="," close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #{item} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.source != null and  maps.source != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and c.source IN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <foreach collection="maps.source.split(',')" item="item" index="index" open="(" separator="," close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #{item} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.tags != null and  maps.tags != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <foreach collection="maps.tags.split(',')" item="tag" open="(" separator="OR" close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                find_in_set(#{tag},c.tags) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.customerCreateTime != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND date_format(c.create_time,'%y%m%d') >= date_format(#{maps.customerCreateTime[0]},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AND date_format(c.create_time,'%y%m%d') <= date_format(#{maps.customerCreateTime[1]},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.beginTime != null and maps.beginTime != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and date_format(c.receive_time,'%y%m%d') >= date_format(#{maps.beginTime},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="maps.endTime != null and maps.endTime != ''"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            and date_format(c.receive_time,'%y%m%d') <= date_format(#{maps.endTime},'%y%m%d') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        order by cu.customer_user_id desc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </mapper> 
			 |