ssh -i "I8C109T.pem" ubuntu@####
ssh: connect to host #### port 22: Connection refused
세 개의 차이점은 없다고 한다.
Like, StartingWith, EndingWith, Containing의 차이점은 스택 오버플로우에서 확인할 수 있다.
https://stackoverflow.com/questions/21456494/spring-jpa-query-with-like
List<User> findByUsernameLike(String username);
StartingWith: select ... like :username%
List<User> findByUsernameStartingWith(String username);
EndingWith: select ... like %:username
List<User> findByUsernameEndingWith(String username);
Containing: select ... like %:username%
List<User> findByUsernameContaining(String username);
1. 한번에 30개씩 Random한 Gif 데이터를 전송한다.
2. 스크롤을 내려 끝에 도달할 경우 겹치지 않는 30개의 Random Gif를 전송한다.
@GetMapping("/randoms")
public ResponseEntity<List<Gifs>> randomGifs(@RequestParam("exceptIds") List<Long> exceptIds) {
Long columnCount = gifsService.counyBy();
HashMap<Long, Boolean> duplicateCheck = new HashMap<>();
HashMap<Long, Boolean> randomGifIds = new HashMap<>();
for (long index = 0; index < exceptIds.size(); ++index) {
duplicateCheck.put(exceptIds.get((int) index), true);
}
while (randomGifIds.size() < 30) {
long randomId = (long) (Math.random() * columnCount + 1);
if(!duplicateCheck.containsKey(randomId))
randomGifIds.put(randomId, true);
}
List<Long> gifIds = new ArrayList<>(randomGifIds.keySet());
List<Gifs> gifsList = gifsService.findByIdIn(gifIds);
System.out.println("gifList : " + gifsList);
return ResponseEntity.ok().body(gifsList);
}
List<Gifs> findByIdIn(List<Long> gifIds);