fix: 必须传入customerId校验
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Agent
2026-03-29 07:28:41 +00:00
parent 19d7917b39
commit 9a51e16fef

View File

@@ -33,19 +33,14 @@ public class PublicOrderController {
@GetMapping("/orders/{orderNo}")
public Result<Map<String, Object>> getOrderByNo(
@PathVariable String orderNo,
@RequestParam(required = false) String customerId) {
@RequestParam String customerId) {
// 查询订单
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<Order> wrapper =
Order order = orderMapper.selectOne(
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<Order>()
.eq(Order::getOrderNo, orderNo);
// 如果提供了customerId则校验
if (customerId != null && !customerId.isEmpty()) {
wrapper.eq(Order::getCustomerId, customerId);
}
Order order = orderMapper.selectOne(wrapper);
.eq(Order::getOrderNo, orderNo)
.eq(Order::getCustomerId, customerId)
);
if (order == null) {
return Result.error("订单不存在");