修改单聊聊天记录,聊天列表接口,当不传分页参数页码数时,数据不分页
| | |
| | | //查询单聊人的信息 |
| | | List<User> user = Arrays.asList(iUserClient.userInfoById(chatRecords.getSenderId()).getData(), iUserClient.userInfoById(chatRecords.getRecipientId()).getData()); |
| | | //查询单聊记录信息 |
| | | IPage<ChatRecords> chatRecordsIPage = chatRecordsService.selectChatRecordsPage(Condition.getPage(query), chatRecords); |
| | | if (null==query.getCurrent()){ |
| | | map.put("chatRecordsIPage",chatRecordsService.selectChatlist(chatRecords)); |
| | | }else { |
| | | map.put("chatRecordsIPage",chatRecordsService.selectChatRecordsPage(Condition.getPage(query), chatRecords)); |
| | | } |
| | | //封装数据 |
| | | map.put("user",user); |
| | | map.put("chatRecordsIPage",chatRecordsIPage); |
| | | //返回数据 |
| | | return R.data(map); |
| | | } |
| | |
| | | public R getChatListPage(@Valid ChatRecords chatRecords, HttpServletResponse response, Query query){ |
| | | //跨域设置 |
| | | crossDomain(response); |
| | | if(null==query.getCurrent()){ |
| | | //不分页 |
| | | return R.data(chatRecordsService.getChatList( chatRecords)); |
| | | } |
| | | //查询当前人员的聊天列表,并返回数据 |
| | | return R.data(chatRecordsService.getChatListPage(Condition.getPage(query), chatRecords)); |
| | | } |
| | |
| | | import org.springblade.jfpt.chatrecords.entity.ChatRecords; |
| | | import org.springblade.jfpt.chatrecords.vo.ChatRecordsVo; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhongrj |
| | | * 聊天消息接口层 |
| | |
| | | * @return |
| | | */ |
| | | IPage<ChatRecordsVo> getChatListPage(IPage<ChatRecordsVo> page, ChatRecords chatRecords); |
| | | |
| | | /** |
| | | * 查询当前用户的聊天列表(不分页) |
| | | * @param chatRecords 消息记录对象 |
| | | * @return |
| | | */ |
| | | List<ChatRecordsVo> getChatList(ChatRecords chatRecords); |
| | | |
| | | /** |
| | | * 查询单聊消息记录 (不分页) |
| | | * @param chatRecords 消息记录对象 |
| | | * @return |
| | | */ |
| | | List<ChatRecords> selectChatlist(ChatRecords chatRecords); |
| | | } |
| | |
| | | import org.springblade.jfpt.chatrecords.vo.ChatRecordsVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhongrj |
| | | */ |
| | |
| | | public IPage<ChatRecordsVo> getChatListPage(IPage<ChatRecordsVo> page, ChatRecords chatRecords) { |
| | | return page.setRecords(baseMapper.getChatListPage(page,chatRecords)); |
| | | } |
| | | |
| | | /** |
| | | * 查询当前用户的聊天列表(不分页) |
| | | * @param chatRecords 消息记录对象 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ChatRecordsVo> getChatList(ChatRecords chatRecords) { |
| | | return baseMapper.getChatListPage(null,chatRecords); |
| | | } |
| | | |
| | | /** |
| | | * 查询单聊消息记录 (不分页) |
| | | * @param chatRecords 消息记录对象 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ChatRecords> selectChatlist(ChatRecords chatRecords) { |
| | | return baseMapper.selectChatRecordsPage(null,chatRecords); |
| | | } |
| | | } |