|  | @@ -203,4 +203,54 @@
 | 
	
		
			
				|  |  |  		</if>
 | 
	
		
			
				|  |  |  		LIMIT 1
 | 
	
		
			
				|  |  |  	</select>
 | 
	
		
			
				|  |  | +	<select id="countActivityUserMapper" resultType="java.lang.Integer">
 | 
	
		
			
				|  |  | +		SELECT COUNT(DISTINCT aum.user_id_)
 | 
	
		
			
				|  |  | +		FROM activity_user_mapper aum
 | 
	
		
			
				|  |  | +		LEFT JOIN sys_user su ON su.id_ = aum.user_id_
 | 
	
		
			
				|  |  | +		LEFT JOIN organization o ON o.id_ = su.organ_id_
 | 
	
		
			
				|  |  | +		WHERE aum.return_fee_ = 0 AND aum.activity_id_ = #{activityId}
 | 
	
		
			
				|  |  | +		<if test="search != null and search != ''">
 | 
	
		
			
				|  |  | +			AND (aum.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 | 
	
		
			
				|  |  | +		</if>
 | 
	
		
			
				|  |  | +		<if test="organId != null and organId != ''">
 | 
	
		
			
				|  |  | +			AND FIND_IN_SET(su.organ_id_,#{organId})
 | 
	
		
			
				|  |  | +		</if>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  | +	<resultMap id="ActivityStudentDto" type="com.ym.mec.biz.dal.dto.ActivityStudentDto">
 | 
	
		
			
				|  |  | +		<result property="userId" column="user_id_"/>
 | 
	
		
			
				|  |  | +		<result property="username" column="username_"/>
 | 
	
		
			
				|  |  | +		<result property="organName" column="name_"/>
 | 
	
		
			
				|  |  | +		<result property="phone" column="phone_"/>
 | 
	
		
			
				|  |  | +		<result property="freeVipNum" column="free_vip_num_"/>
 | 
	
		
			
				|  |  | +		<result property="useVipNum" column="use_vip_num_"/>
 | 
	
		
			
				|  |  | +		<result property="freeGiveVipNum" column="free_give_vip_num_"/>
 | 
	
		
			
				|  |  | +		<result property="useGiveVipNum" column="use_give_vip_num_"/>
 | 
	
		
			
				|  |  | +		<result property="freePracticeNum" column="free_practice_num_"/>
 | 
	
		
			
				|  |  | +		<result property="usePracticeNum" column="use_practice_num_"/>
 | 
	
		
			
				|  |  | +		<result property="freeGivePracticeNum" column="free_give_practice_num_"/>
 | 
	
		
			
				|  |  | +		<result property="useGivePracticeNum" column="use_give_practice_num_"/>
 | 
	
		
			
				|  |  | +	</resultMap>
 | 
	
		
			
				|  |  | +	<select id="queryActivityUserMapper" resultMap="ActivityStudentDto">
 | 
	
		
			
				|  |  | +		SELECT o.name_,aum.user_id_,su.username_,su.phone_,
 | 
	
		
			
				|  |  | +		COUNT(CASE WHEN aum.vip_flag_ = 1 THEN 1 ELSE NULL END) free_vip_num_,
 | 
	
		
			
				|  |  | +		COUNT(CASE WHEN aum.vip_flag_ = 2 THEN 1 ELSE NULL END) use_vip_num_,
 | 
	
		
			
				|  |  | +		COUNT(CASE WHEN aum.give_vip_flag_ = 1 THEN 1 ELSE NULL END) free_give_vip_num_,
 | 
	
		
			
				|  |  | +		COUNT(CASE WHEN aum.give_vip_flag_ = 2 THEN 1 ELSE NULL END) use_give_vip_num_,
 | 
	
		
			
				|  |  | +		COUNT(CASE WHEN aum.practice_flag_ = 1 THEN 1 ELSE NULL END) free_practice_num_,
 | 
	
		
			
				|  |  | +		COUNT(CASE WHEN aum.practice_flag_ = 2 THEN 1 ELSE NULL END) use_practice_num_,
 | 
	
		
			
				|  |  | +		COUNT(CASE WHEN aum.give_practice_flag_ = 1 THEN 1 ELSE NULL END) free_give_practice_num_,
 | 
	
		
			
				|  |  | +		COUNT(CASE WHEN aum.give_practice_flag_ = 2 THEN 1 ELSE NULL END) use_give_practice_num_
 | 
	
		
			
				|  |  | +		FROM activity_user_mapper aum
 | 
	
		
			
				|  |  | +		LEFT JOIN sys_user su ON su.id_ = aum.user_id_
 | 
	
		
			
				|  |  | +		LEFT JOIN organization o ON o.id_ = su.organ_id_
 | 
	
		
			
				|  |  | +		WHERE aum.return_fee_ = 0 AND aum.activity_id_ = #{activityId}
 | 
	
		
			
				|  |  | +		<if test="search != null and search != ''">
 | 
	
		
			
				|  |  | +			AND (aum.user_id_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
 | 
	
		
			
				|  |  | +		</if>
 | 
	
		
			
				|  |  | +		<if test="organId != null and organId != ''">
 | 
	
		
			
				|  |  | +			AND FIND_IN_SET(su.organ_id_,#{organId})
 | 
	
		
			
				|  |  | +		</if>
 | 
	
		
			
				|  |  | +		GROUP BY aum.user_id_
 | 
	
		
			
				|  |  | +		<include refid="global.limit"/>
 | 
	
		
			
				|  |  | +	</select>
 | 
	
		
			
				|  |  |  </mapper>
 |