| 
					
				 | 
			
			
				@@ -41,14 +41,21 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             su.real_name_ as realName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             su.username_ as username, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             su.phone_ as phone, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            min(t.create_time_) as createTime, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            COUNT(DISTINCT t.id_) AS amount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ar.reward_type_ AS rewardType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ar.unit_ AS unit, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            group_concat(if(t.grant_flag_ = 1,ar.reward_name_,null)) as rewardNames 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FROM activity_user_reward t 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        left join activity_reward ar on ar.id_ = t.reward_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        left join sys_user su on t.user_id_ = su.id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IFNULL(ar.reward_type_, "VIP") AS rewardType, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <choose> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <when test="param.activityGroupBy == 1"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    /*按用户、活动分组统计*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    MIN(t.create_time_) as createTime, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    COUNT(DISTINCT t.id_) AS amount, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    group_concat(if(t.grant_flag_ = 1,ar.reward_name_,null)) as rewardNames, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </when> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                <otherwise> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    /*分享活动,直接查询用户购买记录*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    t.create_time_ as createTime, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    IF(t.grant_flag_ = 1,ar.reward_name_,null) AS rewardNames, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                </otherwise> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            </choose> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            IFNULL(ar.unit_, t.unit_) AS unit 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="param.activityId != null"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 and t.activity_id_ = #{param.activityId} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -68,7 +75,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 and  t.create_time_ <= #{param.endTime} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             </if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        GROUP BY t.user_id_,t.activity_id_ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <if test="param.activityGroupBy == 1">GROUP BY t.user_id_ , t.activity_id_</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!--分享活动关联老师--> 
			 |