728x90
1. @RequestParam
예시로
?festivalIdx =
@GetMapping("")
@ResponseBody
public BaseResponse<GetFestivalByFestivalIdxRes> getFestivalByFestivalIdx(@RequestParam("festivalIdx") int festivalIdx) {
try {
GetFestivalByFestivalIdxRes getFestivalByFestivalIdxRes = festivalProvider.getFestivalByFestivalIdx(festivalIdx);
return new BaseResponse<>(getFestivalByFestivalIdxRes);
} catch (BaseException e) {
return new BaseResponse<>(e.getStatus());
}
}
2. @PathVariable
/3
festivalidx 가 3인 put
@PutMapping("/{festivalIdx}")
@ResponseBody
public BaseResponse<String> modifyFestival(@PathVariable int festivalIdx, @RequestBody PutFestivalReq putFestivalReq) {
try {
festivalService.modifyFestival(festivalIdx, putFestivalReq);
String result = "수정이 완료되었습니다.";
return new BaseResponse<>(result);
} catch (BaseException e) {
return new BaseResponse<>(e.getStatus());
}
}
반응형
'자기계발 > 활동&해커톤&코테후기' 카테고리의 다른 글
🎉2022_summer_고려대 해커톤 후기_우리구장⚽🎉_[ku summer hackathon] (0) | 2022.08.22 |
---|---|
[AWS]ec2 연동&spring boot 프로젝트 배포 완료!! (0) | 2022.08.21 |
[spring][2022고대해커톤]SQL이 맞는데 안될때(ft. 여러개 조회 List) (0) | 2022.08.20 |