查询订单详情
This commit is contained in:
parent
4f19af093e
commit
71bab8c82c
|
@ -7,6 +7,7 @@ import com.sky.result.Result;
|
|||
import com.sky.service.OrderService;
|
||||
import com.sky.vo.OrderPaymentVO;
|
||||
import com.sky.vo.OrderSubmitVO;
|
||||
import com.sky.vo.OrderVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -80,4 +81,17 @@ public class OrderController {
|
|||
PageResult pageResult = orderService.pageQuery4User(page, pageSize, status);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单详情
|
||||
*
|
||||
* @param id 查询订单id
|
||||
* @return OrderVO
|
||||
*/
|
||||
@ApiOperation("查询订单详情")
|
||||
@GetMapping("/orderDetail/{id}")
|
||||
public Result<OrderVO> orderDetail(@PathVariable Long id) {
|
||||
OrderVO orderVO = orderService.detail(id);
|
||||
return Result.success(orderVO);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.sky.dto.OrdersSubmitDTO;
|
|||
import com.sky.result.PageResult;
|
||||
import com.sky.vo.OrderPaymentVO;
|
||||
import com.sky.vo.OrderSubmitVO;
|
||||
import com.sky.vo.OrderVO;
|
||||
|
||||
public interface OrderService {
|
||||
/**
|
||||
|
@ -46,4 +47,12 @@ public interface OrderService {
|
|||
* @return PageResult
|
||||
*/
|
||||
PageResult pageQuery4User(int pageNum, int pageSize, Integer status);
|
||||
|
||||
/**
|
||||
* 查询订单详情
|
||||
*
|
||||
* @param id 查询订单id
|
||||
* @return OrderVO
|
||||
*/
|
||||
OrderVO detail(Long id);
|
||||
}
|
||||
|
|
|
@ -207,6 +207,26 @@ public class OrderServiceImpl implements OrderService {
|
|||
assert page != null;
|
||||
return new PageResult(page.getTotal(), list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单详情
|
||||
*
|
||||
* @param id 查询订单id
|
||||
* @return OrderVO
|
||||
*/
|
||||
@Override
|
||||
public OrderVO detail(Long id) {
|
||||
// 根据id查询订单
|
||||
Orders orders = orderMapper.getById(id);
|
||||
// 查询该订单对应的菜品/套餐明细
|
||||
List<OrderDetail> orderDetailList = orderDetailMapper.getByOrderId(orders.getId());
|
||||
|
||||
// 将该订单及其详情封装到OrderVO并返回
|
||||
OrderVO orderVO = new OrderVO();
|
||||
BeanUtils.copyProperties(orders, orderVO);
|
||||
orderVO.setOrderDetailList(orderDetailList);
|
||||
return orderVO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue