This commit is contained in:
Cauchy
2023-10-23 15:26:10 +08:00
parent 0772e198c9
commit 9b37d2126a
4 changed files with 17 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.peanut.common.utils.PageUtils;
import com.peanut.common.utils.R;
import com.peanut.modules.book.entity.BookClockEntryEntity;
@@ -69,6 +70,7 @@ public class BookClockForumController {
@RequestParam(value = "userId", required = false) Integer userId,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "currentPage", defaultValue = "1") Integer currentPage) {
Page<BookClockEntryChat> chatPage = new Page<>(currentPage, pageSize);
QueryWrapper<BookClockEntryChat> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entry_id", entryId);
queryWrapper.eq("fid", 0);
@@ -77,7 +79,8 @@ public class BookClockForumController {
}
queryWrapper.orderByAsc("fid", "create_time");
List<ClockInCommentVo> resultList = new ArrayList<>();
List<BookClockEntryChat> chatEntityList = bookClockEntryChatService.list(queryWrapper);
Page<BookClockEntryChat> page = bookClockEntryChatService.page(chatPage, queryWrapper);
List<BookClockEntryChat> chatEntityList = page.getRecords();
for (BookClockEntryChat entity : chatEntityList) {
List<String> imageList = JSON.parseObject(entity.getImages(), new TypeReference<List<String>>() {
});
@@ -89,8 +92,7 @@ public class BookClockForumController {
vo.setAvatar(user.getAvatar());
resultList.add(vo);
}
PageUtils page = new PageUtils(resultList, resultList.size(), pageSize, currentPage);
return R.ok().put("result", page);
return R.ok().put("result", resultList);
}
/**
@@ -105,9 +107,11 @@ public class BookClockForumController {
public R getSubChatList(@RequestParam("fid") Integer fid,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "currentPage", defaultValue = "1") Integer currentPage) {
Page<BookClockEntryChat> bookClockEntryChatPage = new Page<>(currentPage, pageSize);
QueryWrapper<BookClockEntryChat> subQueryWrapper = new QueryWrapper<>();
subQueryWrapper.eq("fid", fid);
List<BookClockEntryChat> subClockInChatList = bookClockEntryChatService.list(subQueryWrapper);
Page<BookClockEntryChat> page = bookClockEntryChatService.page(bookClockEntryChatPage, subQueryWrapper);
List<BookClockEntryChat> subClockInChatList = page.getRecords();
List<ClockInCommentVo> subCommentList = new ArrayList<>();
for (BookClockEntryChat subChat : subClockInChatList) {
ClockInCommentVo subVo = new ClockInCommentVo();
@@ -120,8 +124,7 @@ public class BookClockForumController {
subVo.setNickName(subChatUser.getNickname());
subCommentList.add(subVo);
}
PageUtils subChatPage = new PageUtils(subCommentList, subCommentList.size(), pageSize, currentPage);
return R.ok().put("result", subChatPage);
return R.ok().put("result", subCommentList);
}
/**

View File

@@ -103,7 +103,7 @@ public class BuyOrderController {
*/
@RequestMapping(path = "/orderList", method = RequestMethod.POST)
public R orderList(@RequestBody BuyOrderListRequestVo requestVo) {
PageUtils page = buyOrderService.orderList(requestVo);
List<BuyOrderResponseVo> page = buyOrderService.orderList(requestVo);
return R.ok().put("result", page);
}