Skip to content

Commit

Permalink
联系人列表添加头像地址返回
Browse files Browse the repository at this point in the history
  • Loading branch information
tangllty committed Jan 16, 2024
1 parent 04c5f2a commit cd5b47c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.tang.app.service.AppChatListService;
import com.tang.commons.utils.SecurityUtils;
import com.tang.commons.utils.date.DateUtils;
import com.tang.system.mapper.SysUserMapper;

/**
* 聊天列业务逻辑层接口实现
Expand All @@ -25,9 +26,12 @@ public class AppChatListServiceImpl implements AppChatListService {

private final AppChatMessageMapper appChatMessageMapper;

public AppChatListServiceImpl(AppChatListMapper appChatListMapper, AppChatMessageMapper appChatMessageMapper) {
private final SysUserMapper userMapper;

public AppChatListServiceImpl(AppChatListMapper appChatListMapper, AppChatMessageMapper appChatMessageMapper, SysUserMapper userMapper) {
this.appChatListMapper = appChatListMapper;
this.appChatMessageMapper = appChatMessageMapper;
this.userMapper = userMapper;
}

/**
Expand All @@ -53,6 +57,7 @@ public List<AppChatList> selectAppChatListListAll() {
list.forEach(item -> {
var lastMessage = appChatMessageMapper.selectLastMessage(item.getChatListId(), item.getFriendId());
if (Objects.nonNull(lastMessage)) {
item.setAvatar(userMapper.selectUserByUserId(item.getFriendId()).getAvatar());
item.setMessage(lastMessage.getContent());
item.setTime(DateUtils.getChatTime(lastMessage.getCreateTime()));
}
Expand Down

0 comments on commit cd5b47c

Please sign in to comment.