|  | @@ -162,4 +162,32 @@
 | 
	
		
			
				|  |  |  	<delete id="deleteByUserIdAndFriendId">
 | 
	
		
			
				|  |  |          DELETE FROM im_user_friend WHERE user_id_ = #{userId} or friend_id_ = #{userId}
 | 
	
		
			
				|  |  |      </delete>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	<select id="getFriendListByUserId" resultMap="ImUserFriendDto">
 | 
	
		
			
				|  |  | +        SELECT distinct iuf.*, ifnull(u.real_name_,username_) as real_name_,u.avatar_,u.phone_,u.user_type_
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <if test="param.musicGroupId != null and param.musicGroupId != '' or param.roleType != null and param.roleType == 'STUDENT'">
 | 
	
		
			
				|  |  | +        ,st.member_rank_setting_id_,s.name_ subject_name_,st.subject_id_list_ subject_id_
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        FROM im_user_friend iuf
 | 
	
		
			
				|  |  | +        LEFT JOIN sys_user u ON iuf.friend_id_ = u.id_
 | 
	
		
			
				|  |  | +        <if test="param.musicGroupId != null and param.musicGroupId != '' or param.roleType != null and param.roleType == 'STUDENT'">
 | 
	
		
			
				|  |  | +            LEFT JOIN student st ON st.user_id_ = u.id_
 | 
	
		
			
				|  |  | +            left join class_group_student_mapper cgs on cgs.user_id_ = st.user_id_
 | 
	
		
			
				|  |  | +            LEFT JOIN `subject` s ON s.id_ = st.subject_id_list_
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        <if test="param.roleType != null and param.roleType != ''">
 | 
	
		
			
				|  |  | +            <if test="param.roleType != 'STUDENT'">
 | 
	
		
			
				|  |  | +              JOIN school_staff st ON st.user_id_ = u.id_ and st.user_type_ = #{param.roleType}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +        WHERE iuf.user_id_ = #{param.userId}
 | 
	
		
			
				|  |  | +        <if test="param.keyword != null and param.keyword != ''">
 | 
	
		
			
				|  |  | +            and (u.real_name_ like concat('%',#{param.keyword},'%') or iuf.friend_nickname_ like concat('%',#{param.keyword},'%'))
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <if test="param.musicGroupId != null and param.musicGroupId != ''">
 | 
	
		
			
				|  |  | +            and cgs.music_group_id_ = #{param.musicGroupId}
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  |  </mapper>
 |