This commit is contained in:
2023-12-01 20:08:55 +08:00

View File

@@ -1,7 +1,7 @@
package com.lld.im.service.call.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lld.im.common.ResponseVO;
@@ -9,10 +9,9 @@ import com.lld.im.service.call.dao.ImCallHistoryEntity;
import com.lld.im.service.call.dao.mapper.ImCallHistoryMapper;
import com.lld.im.service.call.model.HistoryListReq;
import com.lld.im.service.call.service.ImCallHistoryService;
import com.lld.im.service.message.service.P2PMessageService;
import com.lld.im.service.user.dao.ImUserDataEntity;
import com.lld.im.service.user.service.ImUserService;
import com.lld.im.service.utils.SnowflakeIdWorker;
import com.lld.im.service.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@@ -39,15 +38,16 @@ public class ImCallHistoryController {
@PostMapping("/queryList")
public ResponseVO queryList(@RequestBody HistoryListReq req) {
if(req.getLimit()!=null){
Page<ImCallHistoryEntity> objectPage = new Page<>(req.getOffset(),req.getLimit());
QueryWrapper<ImCallHistoryEntity> query=new QueryWrapper<>();
// query.eq("invite_id",req.getUid());
query.orderByDesc("create_time");
IPage<ImCallHistoryEntity> imCallHistoryEntityIPage=callHistoryMapper.selectPage(objectPage,query);
LambdaQueryWrapper<ImCallHistoryEntity> query=new LambdaQueryWrapper<>();
query.orderByDesc(ImCallHistoryEntity::getCreateTime)
.and(StringUtils.isNotEmpty(req.getUid()),
x -> x.eq(ImCallHistoryEntity::getInviteId,req.getUid()).or().eq(ImCallHistoryEntity::getPassiveId,req.getUid()))
.between(req.getStartTime() != null && req.getEndTime() != null,
ImCallHistoryEntity::getCreateTime,req.getStartTime(),req.getEndTime());
IPage<ImCallHistoryEntity> imCallHistoryEntityIPage = callHistoryMapper.selectPage(objectPage,query);
return ResponseVO.successResponse(imCallHistoryEntityIPage);
}else {
return ResponseVO.errorResponse();