加@RequestParam(“ids”)
@ApiOperation("根据多个id的集合查询开门记录")
@GetMapping("/listByIds")
public List<Opendoorrecord> listByIds(@RequestParam("ids") List<String> ids){
return service.listByIds(ids);
}
GET请求,单个参数的情况下
URL展现形式:IP:端口/path?id=
@GetMapping("/getById")
public List<?> getById(@RequestParam("id") String id){
return service.getById(id);
}
GET请求,多个参数的情况下,要求对数据进行校验
URL展现形式:IP:端口/path?id=1&name= 。
在ObjectEntity 内部加校验规则注解等
@GetMapping("/getByEntity")
public List<?> getByEntity(@ModelAttribute ObjectEntity entity){
return service.getByEntity(entity);
}
POST请求,多个参数的情况下
URL展现形式:IP:端口/path
Body:entity的JSON数据
@GetMapping("/getByEntity")
public List<?> getByEntity(@RequestBody ObjectEntity entity){
return service.getByEntity(entity);
}