Ignore:
Timestamp:
01/07/23 01:51:16 (21 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
ed7ef92
Parents:
89865ae
Message:

Final touches

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  
    1717public class Category {
    1818    @Id
    19     Integer ID_category;
     19    @Column(name = "id_category")
     20    Integer id;
    2021    @Column(name = "category_name")
    2122    String cname;
     
    2930        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
    3031        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);
    3233    }
    3334
  • src/main/java/com/example/autopartz/model/Part.java

    r89865ae r4d67d70  
    1818public class Part {
    1919    @Id
     20    @GeneratedValue(strategy = GenerationType.IDENTITY)
    2021    @Column(name = "ID_part")
    2122    Integer id;
     
    4647    List<Car> carList;
    4748
     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
    4858    @Override
    4959    public boolean equals(Object o) {
  • src/main/java/com/example/autopartz/model/PartManufacturer.java

    r89865ae r4d67d70  
    2121public class PartManufacturer {
    2222    @Id
    23     Integer ID_part_manufacturer;
     23    @Column(name = "id_part_manufacturer")
     24    Integer id;
    2425    @Column(name = "pm_name")
    2526    String name;
     
    3132        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
    3233        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);
    3435    }
    3536
  • src/main/java/com/example/autopartz/model/Price.java

    r89865ae r4d67d70  
    77import org.hibernate.Hibernate;
    88
    9 import javax.persistence.Entity;
    10 import javax.persistence.Id;
    11 import javax.persistence.JoinColumn;
    12 import javax.persistence.ManyToOne;
     9import javax.persistence.*;
    1310import java.time.LocalDate;
    1411import java.util.Objects;
     
    2118public class Price {
    2219    @Id
     20    @GeneratedValue(strategy = GenerationType.IDENTITY)
    2321    Integer ID_price;
    2422    Integer amount;
     
    2826    @JoinColumn(name = "id_part")
    2927    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    }
    3034
    3135    @Override
  • src/main/java/com/example/autopartz/model/Warehouse.java

    r89865ae r4d67d70  
    1919public class Warehouse {
    2020    @Id
    21     Integer ID_warehouse;
     21    @Column(name = "id_warehouse")
     22    Integer id;
    2223    @Column(name = "warehouse_location")
    2324    String location;
     
    2829        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
    2930        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);
    3132    }
    3233
  • src/main/java/com/example/autopartz/model/manytomany/PartIsInStockInWarehouse.java

    r89865ae r4d67d70  
    11package com.example.autopartz.model.manytomany;
    22
    3 import lombok.Getter;
    4 import lombok.RequiredArgsConstructor;
    5 import lombok.Setter;
    6 import lombok.ToString;
     3import lombok.*;
    74
    85import javax.persistence.*;
     
    129@Setter
    1310@ToString
    14 @RequiredArgsConstructor
     11@NoArgsConstructor
    1512@Table(name = "`part_is_in_stock_in_warehouse`")
    1613@IdClass(PartIsInStockInWarehouseId.class)
     
    2421    @Column(name = "quantity_warehouse")
    2522    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    }
    2629}
  • src/main/java/com/example/autopartz/model/manytomany/PartIsInStockInWarehouseId.java

    r89865ae r4d67d70  
    99    Integer partid;
    1010    Integer warehouseid;
     11
     12    public PartIsInStockInWarehouseId(Integer pId, Integer whId) {
     13        this.partid = pId;
     14        this.warehouseid = whId;
     15    }
     16
     17    public PartIsInStockInWarehouseId() {
     18    }
    1119}
Note: See TracChangeset for help on using the changeset viewer.