一 postman传送List类型的对象
1实体类
package com.example.gatewayacquisitionsystem.dto;
import com.example.gatewayacquisitionsystem.entity.OrderManagementEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 订单管理业务层
*/
@Data
public class OrderManagementDTO extends OrderManagementEntity {
@ApiModelProperty("供应商")
private String supplier;
@ApiModelProperty("新增订单添加的订单详情")
List<OrderDetailDTO> orderDetailDTOList;
}
2 控制器接受
@PostMapping
@ApiOperation("新增数据")
public RequestDataDTO<Object> add(@RequestBody OrderManagementDTO orderManagementDTO){
return RequestDataDTO.buildSuccess(this.orderManagementService.insert(orderManagementDTO));
}
3 Postman使用
![](https://i-blog.csdnimg.cn/blog_migrate/efebd78d8e77ab016b05b66551c41f7d.png)
4 postMan内容写法:
{"orderNo":"11111111",
"orderName":"测试",
"taxRate":"0.2",
"purchaser":"李四",
"overallProgress":"合同签订",
"createDate":"1660901132103",
"supplier":"腾讯",
"orderDetailDTOList":
[
{"gatewayName":"测试1",
"brand":"腾讯牌",
"version":"腾讯-1",
"purchaseQquantity":"100",
"unitPrice":"20.5",
"unit":"台",
"VersionId": 1560060212116992002
},
{"gatewayName":"测试1",
"brand":"腾讯牌1",
"version":"腾讯-2",
"purchaseQquantity":"100",
"unitPrice":"30.5",
"unit":"台",
"VersionId": 1560472605791973377
}]
}