This commit is contained in:
wangjinlei
2023-10-17 15:45:28 +08:00
parent 93eddae8f0
commit bb9be1748b
8 changed files with 45 additions and 16 deletions

View File

@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.peanut.common.utils.R;
import com.peanut.modules.app.service.UserService;
import com.peanut.modules.book.entity.BookClockEntryEntity;
import com.peanut.modules.book.entity.BookClockInChatEntity;
import com.peanut.modules.book.entity.BookClockEntryChatEntity;
import com.peanut.modules.book.entity.UserEntity;
import com.peanut.modules.book.service.BookClockEntryChatService;
import com.peanut.modules.book.service.BookClockEntryService;
@@ -66,7 +66,7 @@ public class BookClockForumController {
@RequestMapping(path = "/getChatList", method = RequestMethod.GET)
public R getChatList(@RequestParam("entryId") Integer entryId,
@RequestParam(value = "userId", required = false) Integer userId) {
QueryWrapper<BookClockInChatEntity> queryWrapper = new QueryWrapper<>();
QueryWrapper<BookClockEntryChatEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("entry_id", entryId);
queryWrapper.eq("fid", 0);
if (userId != null) {
@@ -74,8 +74,8 @@ public class BookClockForumController {
}
queryWrapper.orderByAsc("fid", "create_time");
List<ClockInCommentVo> resultList = new ArrayList<>();
List<BookClockInChatEntity> chatEntityList = bookClockEntryChatService.list(queryWrapper);
for (BookClockInChatEntity entity : chatEntityList) {
List<BookClockEntryChatEntity> chatEntityList = bookClockEntryChatService.list(queryWrapper);
for (BookClockEntryChatEntity entity : chatEntityList) {
List<String> imageList = JSON.parseObject(entity.getImages(), new TypeReference<List<String>>() {
});
entity.setImageList(imageList);
@@ -84,11 +84,11 @@ public class BookClockForumController {
UserEntity user = userService.getById(entity.getUserId());
vo.setNickName(user.getNickname());
vo.setAvatar(user.getAvatar());
QueryWrapper<BookClockInChatEntity> subQueryWrapper = new QueryWrapper<>();
QueryWrapper<BookClockEntryChatEntity> subQueryWrapper = new QueryWrapper<>();
subQueryWrapper.eq("fid", entity.getId());
List<BookClockInChatEntity> subClockInChatList = bookClockEntryChatService.list(subQueryWrapper);
List<BookClockEntryChatEntity> subClockInChatList = bookClockEntryChatService.list(subQueryWrapper);
List<ClockInCommentVo> subCommentList = new ArrayList<>();
for (BookClockInChatEntity subChat : subClockInChatList) {
for (BookClockEntryChatEntity subChat : subClockInChatList) {
ClockInCommentVo subVo = new ClockInCommentVo();
BeanUtil.copyProperties(subChat, subVo);
UserEntity subChatUser = userService.getById(subChat.getUserId());
@@ -114,7 +114,7 @@ public class BookClockForumController {
* @return
*/
@RequestMapping(path = "/addChat", method = RequestMethod.POST)
public R addChat(@RequestBody BookClockInChatEntity chat) {
public R addChat(@RequestBody BookClockEntryChatEntity chat) {
List<String> imageList = chat.getImageList();
if (imageList != null) {
String images = JSON.toJSON(imageList).toString();

View File

@@ -685,7 +685,9 @@ public class BookController {
LambdaQueryWrapper<BookEntity> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(BookEntity::getDelFlag,0);
wrapper1.in(BookEntity::getId,bookIds);
if(bookIds.size()>0){
wrapper1.in(BookEntity::getId,bookIds);
}
Page<BookEntity> bookEntityPage = bookService.getBaseMapper().selectPage(new Page<>(page, limit), wrapper1);
return R.ok().put("page",bookEntityPage);

View File

@@ -262,6 +262,30 @@ public class BuyOrderController {
return R.ok().put("orderSn", timeId);
}
/**
* 获取订单详情
* @param orderId
* @return
*/
@RequestMapping("/getOrderDetail")
public R getOrderDetail(@RequestParam Integer orderId){
LambdaQueryWrapper<BuyOrderEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BuyOrderEntity::getOrderId,orderId);
BuyOrderEntity one = buyOrderService.getOne(wrapper);
if(one.equals(null)){
return R.error("order error:order is null");
}
//添加用户信息
one.setUser(myUserService.getById(one.getUserId()));
//添加商品信息
LambdaQueryWrapper<BuyOrderDetailEntity> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(BuyOrderDetailEntity::getOrderId,orderId);
List<BuyOrderDetailEntity> buyOrderDetailEntities = buyOrderDetailService.getBaseMapper().selectList(wrapper1);
one.setProducts(buyOrderDetailEntities);
return R.ok().put("user",one);
}
/**
* 信息