@RequestBody
一般用於接口 接收參數為“對象”
接口示例
@SysLog("新增辦公室") @ApiOperation(value = "新增辦公室") @ApiImplicitParams(value = { @ApiImplicitParam(paramType = "body", name = "iotOfficeDTO", dataType = "IotOfficeDTO", required = true, value = "辦公室對象")}) @PostMapping public R<Boolean> saveIotOffice(@RequestBody IotOfficeDTO iotOfficeDTO) { return R.ok(iiotOfficeService.saveIotOffice(iotOfficeDTO)); }
@RequestParam("id")
括號內指定接收參數的key 名稱
一般用於接口 接收單個基礎數據類型參數 如 int String 等
接口示例
@SysLog("根據id(邏輯)刪除辦公室") @ApiOperation(value = "根據id(邏輯)刪除辦公室") @DeleteMapping @ApiImplicitParams(@ApiImplicitParam(paramType = "query", name = "id", dataType = "Integer", required = true, value = "辦公室id")) public R<Boolean> deleteIotOffice(@RequestParam("id") Integer id) { if (null != id) { return R.ok(iiotOfficeService.deleteIotOffice(id)); } return R.failed(BusinessEnum.PARAMETER_NULL); }