1.单参数,基本数据类型的
@GetMapping("/findInfoById")
@ApiOperation(value = "根据id查询信息")
public InfoDto getInfoDto(@ApiParam(name = "id", value = "ID") @RequestParam(value = "id") Long id);
2.多参数,基本数据类型
@GetMapping("/getcount")
public String getcount(
@RequestParam("id") Long id,
@RequestParam("type") Integer type);
3.多参数,基本数据类型+list
@GetMapping("/getCountBySellers")
public List<ProductCountDto> getCountBySellers(
@RequestParam(value = "startTime", required = false) @ApiParam(name = "startTime", value = "开始时间,yyyy-MM-dd HH:mm:ss") String startTime,
@RequestParam(value = "endTime", required = false) @ApiParam(name = "endTime", value = "结束时间,yyyy-MM-dd HH:mm:ss") String endTime,
@RequestParam("ids") List<Long> ids,
@RequestParam("sort") Integer sort,
@RequestParam("sellerId") Long sellerId);
4.自定义类型
@PostMapping("/add")
public int add(@RequestBody UserDto userDto)
5.自定义类型+基本数据类型
@PostMapping("/add")
public int add(@RequestBody UserDto userDto, @RequestParam("sellerId") Long sellerId);
注意:参数中不能使用一个以上的@RequestBody,传递多个自定义实体,使用@RequestBody DTO1 dto1+@RequestParam DTO2 dto2也是不行的,可将其中一个实体转成string类型尝试。