订单相关接口
This commit is contained in:
@@ -6,6 +6,7 @@ import com.aida.seller.common.result.PageResponse;
|
||||
import com.aida.seller.common.result.Response;
|
||||
import com.aida.seller.module.order.dto.CreateOrderDTO;
|
||||
import com.aida.seller.module.order.dto.OrderListDTO;
|
||||
import com.aida.seller.module.order.dto.BuyerOrdersDTO;
|
||||
import com.aida.seller.module.order.dto.UpdateOrderStatusDTO;
|
||||
import com.aida.seller.module.order.service.OrderService;
|
||||
import com.aida.seller.module.order.vo.BuyerOrderVO;
|
||||
@@ -18,13 +19,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* My Orders - 订单管理控制器
|
||||
@@ -74,12 +70,8 @@ public class OrderController {
|
||||
|
||||
@PostMapping("/buyer/orders")
|
||||
@Operation(summary = "根据买家ID查询订单列表(供远程调用)")
|
||||
public Response<PageResponse<BuyerOrderVO>> getOrdersByBuyerId(
|
||||
@RequestParam Long buyerId,
|
||||
@RequestParam(defaultValue = "1") long page,
|
||||
@RequestParam(defaultValue = "10") long size,
|
||||
@RequestParam(required = false) Integer status) {
|
||||
return Response.success(PageResponse.success(orderService.getOrdersByBuyerId(buyerId, page, size, status)));
|
||||
public Response<PageResponse<BuyerOrderVO>> getOrdersByBuyerId(@RequestBody BuyerOrdersDTO dto) {
|
||||
return Response.success(PageResponse.success(orderService.getOrdersByBuyerId(dto)));
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.aida.seller.module.order.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Schema(description = "根据买家ID查询订单列表请求参数")
|
||||
public class BuyerOrdersDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "买家ID")
|
||||
private Long buyerId;
|
||||
|
||||
@Schema(description = "页码,默认1")
|
||||
private long page = 1;
|
||||
|
||||
@Schema(description = "每页数量,默认10")
|
||||
private long size = 10;
|
||||
|
||||
@Schema(description = "订单状态:0-未支付,1-已支付,2-已取消")
|
||||
private Integer status;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.aida.seller.module.order.service;
|
||||
import com.aida.seller.module.order.dto.CreateOrderDTO;
|
||||
import com.aida.seller.module.order.dto.OrderListDTO;
|
||||
import com.aida.seller.module.order.dto.UpdateOrderStatusDTO;
|
||||
import com.aida.seller.module.order.dto.BuyerOrdersDTO;
|
||||
import com.aida.seller.module.order.vo.BuyerOrderVO;
|
||||
import com.aida.seller.module.order.vo.CreateOrderResultVO;
|
||||
import com.aida.seller.module.order.vo.OrderSummaryVO;
|
||||
@@ -51,11 +52,8 @@ public interface OrderService {
|
||||
/**
|
||||
* 根据买家ID分页查询订单列表(供远程调用)
|
||||
*
|
||||
* @param buyerId 买家ID
|
||||
* @param page 页码
|
||||
* @param size 每页数量
|
||||
* @param status 订单状态筛选(可选)
|
||||
* @param dto 查询参数(买家ID、页码、每页数量、订单状态)
|
||||
* @return 买家订单分页列表,按更新时间降序排列
|
||||
*/
|
||||
IPage<BuyerOrderVO> getOrdersByBuyerId(Long buyerId, long page, long size, Integer status);
|
||||
IPage<BuyerOrderVO> getOrdersByBuyerId(BuyerOrdersDTO dto);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.aida.seller.module.listing.mapper.ListingMapper;
|
||||
import com.aida.seller.module.order.dto.CreateOrderDTO;
|
||||
import com.aida.seller.module.order.dto.OrderListDTO;
|
||||
import com.aida.seller.module.order.dto.UpdateOrderStatusDTO;
|
||||
import com.aida.seller.module.order.dto.BuyerOrdersDTO;
|
||||
import com.aida.seller.module.order.entity.OrderInfoEntity;
|
||||
import com.aida.seller.module.order.entity.OrderItemEntity;
|
||||
import com.aida.seller.module.order.mapper.OrderInfoMapper;
|
||||
@@ -140,13 +141,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfoEnti
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<BuyerOrderVO> getOrdersByBuyerId(Long buyerId, long page, long size, Integer status) {
|
||||
Page<OrderInfoEntity> pageParam = new Page<>(page, size);
|
||||
public IPage<BuyerOrderVO> getOrdersByBuyerId(BuyerOrdersDTO dto) {
|
||||
Page<OrderInfoEntity> pageParam = new Page<>(dto.getPage(), dto.getSize());
|
||||
|
||||
LambdaQueryWrapper<OrderInfoEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(OrderInfoEntity::getBuyerId, buyerId);
|
||||
if (status != null) {
|
||||
wrapper.eq(OrderInfoEntity::getStatus, status);
|
||||
wrapper.eq(OrderInfoEntity::getBuyerId, dto.getBuyerId());
|
||||
if (dto.getStatus() != null) {
|
||||
wrapper.eq(OrderInfoEntity::getStatus, dto.getStatus());
|
||||
}
|
||||
wrapper.orderByDesc(OrderInfoEntity::getUpdateTime);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user