Rev | Line | |
---|
[b68ae8d] | 1 | package finki.it.phoneluxbackend.entities;
|
---|
| 2 |
|
---|
| 3 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
---|
| 4 | import lombok.*;
|
---|
| 5 |
|
---|
| 6 | import javax.persistence.*;
|
---|
| 7 | import java.util.List;
|
---|
| 8 |
|
---|
| 9 | @AllArgsConstructor
|
---|
| 10 | @NoArgsConstructor
|
---|
| 11 | @Getter
|
---|
| 12 | @Setter
|
---|
| 13 | @ToString
|
---|
| 14 | @Entity(name = "Phone")
|
---|
| 15 | @Table(name = "phones")
|
---|
| 16 | public class Phone {
|
---|
| 17 | @Id
|
---|
| 18 | @Column(name = "id")
|
---|
| 19 | private Long id;
|
---|
| 20 |
|
---|
| 21 | @Column(name = "brand")
|
---|
| 22 | private String brand;
|
---|
| 23 |
|
---|
| 24 | @Column(name = "model")
|
---|
| 25 | private String model;
|
---|
| 26 |
|
---|
[dfd5d87] | 27 | @Column(name = "image_url")
|
---|
| 28 | private String image_url;
|
---|
| 29 |
|
---|
[f25d07e] | 30 | @Column(name = "total_offers")
|
---|
| 31 | private Integer total_offers;
|
---|
| 32 |
|
---|
| 33 | @Column(name = "lowest_price")
|
---|
| 34 | private Integer lowestPrice;
|
---|
| 35 |
|
---|
[b68ae8d] | 36 | @OneToMany(fetch = FetchType.LAZY, mappedBy = "phone")
|
---|
| 37 | @JsonIgnore
|
---|
| 38 | private List<PhoneOffer> phoneOffers;
|
---|
| 39 |
|
---|
| 40 | public Phone(String brand, String model) {
|
---|
| 41 | this.brand = brand;
|
---|
| 42 | this.model = model;
|
---|
| 43 | }
|
---|
| 44 |
|
---|
[ffd50db] | 45 | public Phone(Long id, String brand, String model, String image_url, Integer total_offers, Integer lowestPrice) {
|
---|
| 46 | this.id = id;
|
---|
| 47 | this.brand = brand;
|
---|
| 48 | this.model = model;
|
---|
| 49 | this.image_url = image_url;
|
---|
| 50 | this.total_offers = total_offers;
|
---|
| 51 | this.lowestPrice = lowestPrice;
|
---|
| 52 | }
|
---|
[b68ae8d] | 53 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.