这是我的控制者:
@GetMapping("/checkMeetingRoomAvailability")
public @ResponseBody ResponseDto checkMeetingRoomAvailability(@DateTimeFormat(pattern = "dd-M-yyyy hh:mm:ss") Date begin,
@DateTimeFormat(pattern = "dd-M-yyyy hh:mm:ss") Date end, @RequestParam Integer capacity) {
return meetingRoomServiceLocal.checkMeetingRoomAvailability(begin, end, capacity);
}
当我使用邮递员传递输入时,它给出了400个错误的请求。
meetingRoomController/checkMeetingRoomAvailability?begin=30-9-2020 14:30:00&end=30-9-2020 15:30:00&capacity=10
我无法弄清楚为什么出现此错误。
答案 0 :(得分:1)
以下任何一种解决方案都可以使用:
LineItem.findAll({
attributes: ['orderId', [fn('sum', col('quantity')), 'quantity']],
include: [
{
model: Order,
as: 'lineItems',
},
],
group: ['orderId'],
raw: true,
});
替换为dd-M-yyyy hh:mm:ss
,然后可以像dd-M-yyyy'T'hh:mm:ss
一样对其进行测试。meetingRoomController/checkMeetingRoomAvailability?begin=30-9-2020T14:30:00&end=30-9-2020T15:30:00&capacity=10
进行编码,例如https://www.urlencoder.org/并使用Postman中的编码URL。我不建议这样做,因为这将迫使您的客户端在向服务器发送请求之前将其编码为URL。