Changeset 23a2bc5 for src/main/java/com/example/autopartz
- Timestamp:
- 01/03/23 03:14:50 (23 months ago)
- Branches:
- main
- Children:
- eaf0f1b
- Parents:
- 101cbe2
- Location:
- src/main/java/com/example/autopartz
- Files:
-
- 9 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/autopartz/controller/UserController.java
r101cbe2 r23a2bc5 1 1 package com.example.autopartz.controller; 2 2 3 import com.example.autopartz.model.RepairShopReviewsSummary; 4 import com.example.autopartz.model.User; 5 import com.example.autopartz.repository.RepairShopReviewSummaryRepository; 3 import com.example.autopartz.model.*; 4 import com.example.autopartz.repository.*; 6 5 import com.example.autopartz.service.UserService; 7 import org.springframework.web.bind.annotation.GetMapping; 8 import org.springframework.web.bind.annotation.RequestMapping; 9 import org.springframework.web.bind.annotation.RestController; 6 import org.springframework.web.bind.annotation.*; 10 7 11 8 import java.util.List; … … 15 12 public class UserController { 16 13 private final UserService userService; 17 private final RepairShopReviewSummaryRepository rspsr; 14 private final RepairShopReviewSummaryRepository repairShopReviewSummaryRepository; 15 private final PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository; 18 16 19 public UserController(UserService userService, RepairShopReviewSummaryRepository rspsr) { 17 private final OrdersForUserRepository ordersForUserRepository; 18 private final RepairsForUserRepository repairsForUserRepository; 19 private final ReviewsForUserRepository reviewsForUserRepository; 20 public UserController(UserService userService, RepairShopReviewSummaryRepository repairShopReviewSummaryRepository, PartsForCarTypeAndCategoryRepository partsForCarTypeAndCategoryRepository, OrdersForUserRepository ordersForUserRepository, RepairsForUserRepository repairsForUserRepository, ReviewsForUserRepository reviewsForUserRepository) { 20 21 this.userService = userService; 21 this.rspsr = rspsr; 22 this.repairShopReviewSummaryRepository = repairShopReviewSummaryRepository; 23 this.partsForCarTypeAndCategoryRepository = partsForCarTypeAndCategoryRepository; 24 this.ordersForUserRepository = ordersForUserRepository; 25 this.repairsForUserRepository = repairsForUserRepository; 26 this.reviewsForUserRepository = reviewsForUserRepository; 22 27 } 23 28 @GetMapping("reportTest") 24 29 public List<RepairShopReviewsSummary> getRepairShopReport(){ 25 return r spsr.findAllByRsid(2L);30 return repairShopReviewSummaryRepository.findAll(); 26 31 } 27 32 @GetMapping("usersTest") … … 29 34 return userService.findAllUsers(); 30 35 } 36 @GetMapping("parts") 37 public List<PartsForCarTypeAndCategory> getPartsForCarTypeAndCategory(@RequestParam String cartype, @RequestParam String category){ 38 return partsForCarTypeAndCategoryRepository.findAllByCartypeAndCategory(cartype,category); 39 } 40 @GetMapping("orders/{id}") 41 public List<OrdersForUser> getOrdersForUser(@PathVariable Long id){ 42 return ordersForUserRepository.findAllByUserid(id); 43 } 44 @GetMapping("repairs/{id}") 45 public List<RepairsForUser> getRepairsForUser(@PathVariable Long id){ 46 return repairsForUserRepository.findAllByUserid(id); 47 } 48 @GetMapping("reviews/{id}") 49 public List<ReviewsForUser> getReviewsForUser(@PathVariable Long id){ 50 return reviewsForUserRepository.findAllByUserid(id); 51 } 31 52 } -
src/main/java/com/example/autopartz/model/Part.java
r101cbe2 r23a2bc5 1 1 package com.example.autopartz.model; 2 2 3 import jakarta.persistence.Entity; 4 import jakarta.persistence.Id; 5 import jakarta.persistence.JoinColumn; 6 import jakarta.persistence.ManyToOne; 3 import jakarta.persistence.*; 7 4 import lombok.*; 8 5 import org.hibernate.Hibernate; 9 6 7 import java.util.ArrayList; 8 import java.util.List; 10 9 import java.util.Objects; 11 10 … … 23 22 @JoinColumn(name = "id_part_manufacturer") 24 23 PartManufacturer partManufacturer; 24 @ManyToMany 25 @JoinTable(name = "part_is_from_category", joinColumns = 26 @JoinColumn(name = "id_part"), 27 inverseJoinColumns = @JoinColumn(name = "id_category")) 28 @ToString.Exclude 29 List<Category> categoryList; 25 30 26 31 @Override -
src/main/java/com/example/autopartz/model/RepairShopReviewsSummary.java
r101cbe2 r23a2bc5 20 20 @RequiredArgsConstructor 21 21 @Immutable 22 @Table(name = "repair_shop_reviews_summary") 23 @Subselect("select * from repair_shop_reviews_summary") 22 @Table(name = "`repair_shop_reviews_summary`") 24 23 public class RepairShopReviewsSummary implements Serializable { 25 24 @Serial
Note:
See TracChangeset
for help on using the changeset viewer.