可以使用@RequestBody
@PostMapping("/add")
public Result add(@RequestBody LogisticsDemand demand){
if(demand.getRefreshTime()==null){
demand.setRefreshTime(new Date());
}
int result = logisticsDemandService.insertdemand(demand,demand.getOrders());
if(result>0){
return Result.success("保存成功!");
}else{
return Result.error(501,"保存失败!");
}
}
时间格式的处理
@JsonFormat( pattern="yyyy-MM-dd HH:mm:ss")
private Date timeLimit;
参考: