본문 바로가기

스프링7

Spring 클론코딩 프로젝트 콘텐츠 DetailPage( 출연/제작) ✔ 출연/제작 - Controller 부분 // 인물 리스트 List peopleList = new ArrayList(); List people = new ArrayList(); List personList = new ArrayList(); if(movie.people() != null){ peopleList = List.of(movie.people().split(",")); for(String per : peopleList){ people.add(per.split("\\(")[0] + "," + per.split("\\(")[1].split("\\)")[0]); } } try{ personList = personService.personList(people); }catch (Exception e){ S.. 2023. 3. 5.
Spring 클론코딩 프로젝트 콘텐츠 DetailPage(별점,별점 그래프, 해당 유저 별점 달았는지) ✔ MovieController - @RequesdtMapping("/movie") 기본 주소 @Controller @RequestMapping("/movie") @RequiredArgsConstructor ✔ @GetMapping("/{movieIdx}") // http://localhost:8080/movie/1 @GetMapping("/{movieIdx}") // http://localhost:8080/movie/1 public String movieDetail( @PathVariable Long movieIdx, @PageableDefault(size = 5, sort = "commIdx", direction = Sort.Direction.DESC) Pageable pageable, ModelMa.. 2023. 3. 4.
Spring 프로젝트 별점 순 출력 /* 별점 높은순 출력, 어느정도 인원이 평가해야(타임리프 적용) 0명이 평가한 경우 한명이 바로 5점을 주면 1등이 나오기 때문*/ @Transactional(readOnly = true) public List movieStar() { //평균 구하기 List result = new ArrayList(); // 평균점수가 최소 4.2 이상인 : 설정을 안할 경우 데이터가 없을경우 1점도 들어갈 수 있음 List result2 = new ArrayList(); // 평가한 인원이 최소 5명인 : 평가자가 0명인 경우 처음 평가한 이가 5점을 주면 바로 최고 점수 List result3 = new ArrayList(); List movieStar = movieRepository.findAll(); for(.. 2023. 3. 4.