方式一:
public CommonResult<MxxxDataModelxxxDO> getRxxxMoData(
@RequestParam("station") String station,
@RequestParam("area") String area
)throws ParseException, IOException {
上述方式station和area参数不能为空,否则会报错;
报错:Required request parameter ‘XXX‘ for method parameter type String is not present“
方式二:
public CommonResult<MxxxDataModelxxxDO> getRxxxMoData(
@RequestParam(value = "station",required = false) String station,
@RequestParam(value = "area",required = false) String area)
throws ParseException, IOException {
上述方式station和area参数可以为空,为空或null不会报错;
方式三:
public CommonResult<MxxxDataModelxxxDO> getRxxxMoData(
@RequestParam(value = "station",required = false,defaultValue = "0") String station,
@RequestParam(value = "area",required = false) String area
)throws ParseException, IOException {
上述方式station参数如果为空,为空或null不会报错,同时将使用默认值;