Commit a2059d04 authored by shiyu's avatar shiyu

根据昵称搜索会话列表

parent 48a5b587
...@@ -22,8 +22,10 @@ import org.slf4j.Logger; ...@@ -22,8 +22,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -50,6 +52,9 @@ public class SysIMRecordServiceImpl implements SysIMRecordService { ...@@ -50,6 +52,9 @@ public class SysIMRecordServiceImpl implements SysIMRecordService {
if (StringUtils.hasLength(dto.getFromAccountName())) { if (StringUtils.hasLength(dto.getFromAccountName())) {
//根据用户名称查询id //根据用户名称查询id
List<User> userList = userDao.findByNickName(dto.getFromAccountName()); List<User> userList = userDao.findByNickName(dto.getFromAccountName());
if (CollectionUtils.isEmpty(userList)) {
return Result.success();
}
List<Long> fromAccountIdList = userList.stream().map(User::getId).collect(Collectors.toList()); List<Long> fromAccountIdList = userList.stream().map(User::getId).collect(Collectors.toList());
List<String> fromAccountList = fromAccountIdList.stream().map(String::valueOf).collect(Collectors.toList()); List<String> fromAccountList = fromAccountIdList.stream().map(String::valueOf).collect(Collectors.toList());
dto.setFromAccountList(fromAccountList); dto.setFromAccountList(fromAccountList);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment