| 
					
				 | 
			
			
				@@ -29,22 +29,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="delFlag != null "> and del_flag = #{delFlag}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectNotCustomerLabelInfo" parameterType="CustomerLabel" resultMap="CustomerLabelResult"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        SELECT DISTINCT(phone_number) as phone,customer_name 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        from customer_manage m 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        join app_user_info a on a.mobile_phone =m.phone_number 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT	* FROM( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT DISTINCT ( m.phone_number ) AS phone,customer_name,pay_date 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FROM customer_manage m 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN app_user_info a ON m.mina_user_id = a.user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN ( SELECT max( pay_date ) AS pay_date, po.consumer_id FROM pay_order po 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="stationId != null "> and po.station_id = #{stationId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          GROUP BY consumer_id ) c ON c.consumer_id = a.user_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="stationId != null "> and m.station_id = #{stationId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="phone != null  and phone != ''"> and m.phone_number like concat('%', #{phone}, '%')</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="customerName != null  and customerName != ''"> and m.customer_name like concat('%', #{customerName}, '%')</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        and phone_number  not in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ( select phone from customer_label b 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AND m.phone_number NOT IN ( SELECT phone FROM customer_label b 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="stationId != null "> and b.station_id = #{stationId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <if test="labelId != null "> and label_id != #{labelId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="delFlag != null "> and del_flag = #{delFlag}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </where>  ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="phone != null  and phone != ''"> and b.phone like concat('%', #{phone}, '%')</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         )) po 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ORDER BY  po.pay_date DESC 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="selectPhonelist" parameterType="CustomerLabel" resultMap="CustomerLabelResult"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT DISTINCT phone,label_id,c.station_id,m.customer_name from  customer_label	c 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        left join  customer_manage m on c.phone = m.phone_number and c.station_id = m.station_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="stationId != null "> and c.station_id = #{stationId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="labelId != null "> and label_id = #{labelId}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="delFlag != null "> and del_flag = #{delFlag}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="phone != null  and phone != ''"> and c.phone like concat('%', #{phone}, '%')</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="customerName != null  and customerName != ''"> and m.customer_name like concat('%', #{customerName}, '%')</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectCustomerLabelById" parameterType="Integer" resultMap="CustomerLabelResult"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <include refid="selectCustomerLabelVo"/> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -106,10 +124,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </delete> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <delete id="deleteCustomerLabelByIds" parameterType="String"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        delete from customer_label where id in  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        delete from customer_label where id in 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <foreach item="id" collection="array" open="(" separator="," close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </delete> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-</mapper> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+</mapper> 
			 |