Skip to content

Commit 3ba5268

Browse files
authored
Merge pull request #209 from miIlicon/feature/209-findByTitle
[#209] Title로 Booth조회
2 parents 9a90fb6 + 5f567ac commit 3ba5268

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/main/java/com/festival/domain/booth/controller/BoothController.java

+5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ public ResponseEntity<Void> deleteBooth(@PathVariable("boothId") Long id) {
4747
public ResponseEntity<BoothRes> getBooth(@PathVariable("boothId") Long id, HttpServletRequest httpServletRequest) {
4848
return ResponseEntity.ok().body(boothService.getBooth(id,httpServletRequest.getRemoteAddr()));
4949
}
50+
@PreAuthorize("permitAll()")
51+
@GetMapping()
52+
public ResponseEntity<BoothRes> getBoothByTitle(@RequestParam("boothTitle") String title, HttpServletRequest httpServletRequest) {
53+
return ResponseEntity.ok().body(boothService.getBoothByTitle(title,httpServletRequest.getRemoteAddr()));
54+
}
5055

5156
@PreAuthorize("permitAll()")
5257
@GetMapping("/query/{boothId}")

src/main/java/com/festival/domain/booth/repository/BoothRepository.java

+2
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
import org.springframework.data.jpa.repository.JpaRepository;
66

77
public interface BoothRepository extends JpaRepository<Booth, Long>, BoothRepositoryCustom {
8+
Booth getBoothByTitle(String title);
9+
810
}

src/main/java/com/festival/domain/booth/repository/BoothRepositoryCustom.java

+2
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@
1111
public interface BoothRepositoryCustom {
1212
BoothPageRes getList(BoothListSearchCond boothListSearchCond);
1313
List<BoothSearchRes> searchBoothList(String keyword);
14+
15+
1416
}

src/main/java/com/festival/domain/booth/service/BoothService.java

+7
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,11 @@ private Booth checkingDeletedStatus(Optional<Booth> booth) {
116116
return booth.get();
117117
}
118118

119+
public BoothRes getBoothByTitle(String title, String remoteAddr) {
120+
Booth booth = boothRepository.getBoothByTitle(title);
121+
if(redisService.isDuplicateAccess(remoteAddr, "Booth_" + booth.getId())) {
122+
redisService.increaseRedisViewCount("Booth_Id_" + booth.getId());
123+
}
124+
return BoothRes.of(booth);
125+
}
119126
}

0 commit comments

Comments
 (0)