@ApiImplicitParam是一個標注方法參數的注解
注解內的屬性有
name:參數名
value:參數的中文含義
required:是否必須
dataType:參數類型
paramType:參數所放位置
defaultValue:參數的默認值
其中,paramType可選值有header、query、path
header標注為從@RequestHeader中獲取
query標注為從@RequestParam中獲取
path從標注為@PathVariable中獲取
方法中有多個參數時,使用@ApiImplicitParams包圍
@RequestMapping("/getUser") @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用戶ID", required = true, dataType = "String", paramType = "Query"), @ApiImplicitParam(name = "roleId", value = "角色ID", required = true, dataType = "String", paramType = "Query"), }) public String findUser(String userId,String roleId){ return "success"; }