swagger + springboot 传递 List参数的一种使用方式

controller中的注解 --主要是实体类ProductionOrder前的注解@Validated ,@RequestBody

 @ApiOperation(value = "获取排产货物原料列表", notes = "根据货物Id查询bom表单中的排产货物原料列表", tags = {"@张婷"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "第几页", paramType = "query", dataType = "int"),
            @ApiImplicitParam(name = "limit", value = "每页容量", paramType = "query", dataType = "int"),
            @ApiImplicitParam(name = "productionOrder", value = "排产单参数实体类", paramType = "query", dataType = "ProductionOrder")
    })
    @RequestMapping(value = "/getProductionOrderGoodsMaterialList", method = RequestMethod.GET)
    @ResponseBody
    public LayuiCommonResponse getProductionOrderGoodsMaterialList(@Validated @RequestParam(defaultValue = "1") int page,
                                                                   @Validated @RequestParam(defaultValue = "10") int limit,
                                                                   @Validated ProductionOrder productionOrder) {...}

实体类中有list集合

public class ProductionOrder implements Serializable {

    @ApiModelProperty(value = "排产单详情集合", example = "productionOrderDetailsList")
    private List productionOrderDetailsList;

    public List getProductionOrderDetailsList() {
        return productionOrderDetailsList;
    }

    public void setProductionOrderDetailsList(List productionOrderDetailsList) {
        this.productionOrderDetailsList = productionOrderDetailsList;
    }
}

swagger显示

    @Validated

swagger + springboot 传递 List参数的一种使用方式_第1张图片

   @RequestBody

swagger + springboot 传递 List参数的一种使用方式_第2张图片

你可能感兴趣的:(swagger + springboot 传递 List参数的一种使用方式)