Changeset 4d67d70 for src/main/java/com/example/autopartz/model
- Timestamp:
- 01/07/23 01:51:16 (23 months ago)
- Branches:
- main
- Children:
- ed7ef92
- Parents:
- 89865ae
- Location:
- src/main/java/com/example/autopartz/model
- Files:
-
- 6 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/autopartz/model/Category.java
r89865ae r4d67d70 17 17 public class Category { 18 18 @Id 19 Integer ID_category; 19 @Column(name = "id_category") 20 Integer id; 20 21 @Column(name = "category_name") 21 22 String cname; … … 29 30 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false; 30 31 Category category = (Category) o; 31 return ID_category != null && Objects.equals(ID_category, category.ID_category);32 return id != null && Objects.equals(id, category.id); 32 33 } 33 34 -
src/main/java/com/example/autopartz/model/Part.java
r89865ae r4d67d70 18 18 public class Part { 19 19 @Id 20 @GeneratedValue(strategy = GenerationType.IDENTITY) 20 21 @Column(name = "ID_part") 21 22 Integer id; … … 46 47 List<Car> carList; 47 48 49 public Part(String name, String description, PartManufacturer manufacturer, List<Category> categoryList, List<Warehouse> warehouseList, List<Car> carList) { 50 this.name = name; 51 this.description = description; 52 this.manufacturer = manufacturer; 53 this.categoryList = categoryList; 54 this.warehouseList = warehouseList; 55 this.carList = carList; 56 } 57 48 58 @Override 49 59 public boolean equals(Object o) { -
src/main/java/com/example/autopartz/model/PartManufacturer.java
r89865ae r4d67d70 21 21 public class PartManufacturer { 22 22 @Id 23 Integer ID_part_manufacturer; 23 @Column(name = "id_part_manufacturer") 24 Integer id; 24 25 @Column(name = "pm_name") 25 26 String name; … … 31 32 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false; 32 33 PartManufacturer that = (PartManufacturer) o; 33 return ID_part_manufacturer != null && Objects.equals(ID_part_manufacturer, that.ID_part_manufacturer);34 return id != null && Objects.equals(id, that.id); 34 35 } 35 36 -
src/main/java/com/example/autopartz/model/Price.java
r89865ae r4d67d70 7 7 import org.hibernate.Hibernate; 8 8 9 import javax.persistence.Entity; 10 import javax.persistence.Id; 11 import javax.persistence.JoinColumn; 12 import javax.persistence.ManyToOne; 9 import javax.persistence.*; 13 10 import java.time.LocalDate; 14 11 import java.util.Objects; … … 21 18 public class Price { 22 19 @Id 20 @GeneratedValue(strategy = GenerationType.IDENTITY) 23 21 Integer ID_price; 24 22 Integer amount; … … 28 26 @JoinColumn(name = "id_part") 29 27 Part part; 28 29 public Price(Integer amount, LocalDate price_from, Part part) { 30 this.amount = amount; 31 this.price_from = price_from; 32 this.part = part; 33 } 30 34 31 35 @Override -
src/main/java/com/example/autopartz/model/Warehouse.java
r89865ae r4d67d70 19 19 public class Warehouse { 20 20 @Id 21 Integer ID_warehouse; 21 @Column(name = "id_warehouse") 22 Integer id; 22 23 @Column(name = "warehouse_location") 23 24 String location; … … 28 29 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false; 29 30 Warehouse warehouse = (Warehouse) o; 30 return ID_warehouse != null && Objects.equals(ID_warehouse, warehouse.ID_warehouse);31 return id != null && Objects.equals(id, warehouse.id); 31 32 } 32 33 -
src/main/java/com/example/autopartz/model/manytomany/PartIsInStockInWarehouse.java
r89865ae r4d67d70 1 1 package com.example.autopartz.model.manytomany; 2 2 3 import lombok.Getter; 4 import lombok.RequiredArgsConstructor; 5 import lombok.Setter; 6 import lombok.ToString; 3 import lombok.*; 7 4 8 5 import javax.persistence.*; … … 12 9 @Setter 13 10 @ToString 14 @ RequiredArgsConstructor11 @NoArgsConstructor 15 12 @Table(name = "`part_is_in_stock_in_warehouse`") 16 13 @IdClass(PartIsInStockInWarehouseId.class) … … 24 21 @Column(name = "quantity_warehouse") 25 22 Integer quantity; 23 24 public PartIsInStockInWarehouse(Integer partid, Integer warehouseid, Integer quantity) { 25 this.partid = partid; 26 this.warehouseid = warehouseid; 27 this.quantity = quantity; 28 } 26 29 } -
src/main/java/com/example/autopartz/model/manytomany/PartIsInStockInWarehouseId.java
r89865ae r4d67d70 9 9 Integer partid; 10 10 Integer warehouseid; 11 12 public PartIsInStockInWarehouseId(Integer pId, Integer whId) { 13 this.partid = pId; 14 this.warehouseid = whId; 15 } 16 17 public PartIsInStockInWarehouseId() { 18 } 11 19 }
Note:
See TracChangeset
for help on using the changeset viewer.