Skip to content

Commit

Permalink
good work
Browse files Browse the repository at this point in the history
  • Loading branch information
fung-csf committed Mar 12, 2023
1 parent 79f39fb commit 1b58042
Show file tree
Hide file tree
Showing 8 changed files with 2,169 additions and 1,954 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package com.shopme.common.entity.product;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;

import com.shopme.common.entity.Brand;
import com.shopme.common.entity.Category;

@Entity
@Table(name = "products")
public class Product {


@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;

@Column(unique = true, length = 255, nullable = false)
private String name;

@Column(unique = true, length = 255, nullable = false)
private String alias;

@Column(length = 512, nullable = false, name = "short_description")
private String shortDescription;

@Column(length = 4096, nullable = false, name = "full_description")
private String fullDescription;

@Column(name = "created_time", nullable = false, updatable = false)
private Date createdTime;

@Column(name = "updated_time")
private Date updatedTime;

private boolean enabled;

@Column(name = "in_stock")
private boolean inStock;

private float cost;

private float price;

@Column(name = "discount_percent")
private float discountPercent;

private float length;
private float width;
private float height;
private float weight;

@Column(name = "main_image", nullable = false)
private String mainImage;

/* ManyToOne -> Many product to One category*/
@ManyToOne
@JoinColumn(name = "category_id")
private Category category;

/* ManyToOne -> Many product to One brand*/
@ManyToOne
@JoinColumn(name = "brand_id")
private Brand brand;

// /* OneToMany -> One product to Many images*/
// @OneToMany(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true)
// private Set<ProductImage> images = new HashSet<>();
//
// /* OneToMany -> One product to Many details*/
// @OneToMany(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true)
// private List<ProductDetail> details = new ArrayList<>();


public Product(Integer id) {
this.id = id;
}

public Product() {
}

public Product(String name) {
this.name = name;
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package com.shopme.common.entity.product;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;

import com.shopme.common.entity.Brand;
import com.shopme.common.entity.Category;

@Entity
@Table(name = "products")
public class Product {


@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;

@Column(unique = true, length = 255, nullable = false)
private String name;

@Column(unique = true, length = 255, nullable = false)
private String alias;

@Column(length = 512, nullable = false, name = "short_description")
private String shortDescription;

@Column(length = 4096, nullable = false, name = "full_description")
private String fullDescription;

@Column(name = "created_time", nullable = false, updatable = false)
private Date createdTime;

@Column(name = "updated_time")
private Date updatedTime;

private boolean enabled;

@Column(name = "in_stock")
private boolean inStock;

private float cost;

private float price;

@Column(name = "discount_percent")
private float discountPercent;

private float length;
private float width;
private float height;
private float weight;

@Column(name = "main_image", nullable = false)
private String mainImage;

/* ManyToOne -> Many product to One category*/
@ManyToOne
@JoinColumn(name = "category_id")
private Category category;

/* ManyToOne -> Many product to One brand*/
@ManyToOne
@JoinColumn(name = "brand_id")
private Brand brand;

// /* OneToMany -> One product to Many images*/
// @OneToMany(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true)
// private Set<ProductImage> images = new HashSet<>();
//
// /* OneToMany -> One product to Many details*/
// @OneToMany(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true)
// private List<ProductDetail> details = new ArrayList<>();


public Product(Integer id) {
this.id = id;
}

public Product() {
}

public Product(String name) {
this.name = name;
}



}
3,905 changes: 1,953 additions & 1,952 deletions .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi

Large diffs are not rendered by default.

Binary file modified .metadata/.plugins/org.eclipse.jdt.core/1865797976.index
Binary file not shown.
Binary file modified .metadata/.plugins/org.eclipse.jdt.core/740010317.index
Binary file not shown.
6 changes: 6 additions & 0 deletions .metadata/.plugins/org.eclipse.m2e.logback/0.log
Original file line number Diff line number Diff line change
Expand Up @@ -10833,3 +10833,9 @@ org.eclipse.core.runtime.CoreException: Could not resolve artifact org.apache.po
2023-03-12 22:20:49,620 [Worker-178: Launching ShopmeBackEnd - ShopmeBackEndApplication] INFO o.e.m.c.i.p.WorkspaceClassifierResolverManager - Resolving P/ShopmeCommon: com.shopme:ShopmeCommon:0.0.1-SNAPSHOT with classifier null to /ShopmeCommon/target/classes
2023-03-12 22:20:49,841 [Worker-178: Launching ShopmeBackEnd - ShopmeBackEndApplication] INFO o.e.m.c.i.p.WorkspaceClassifierResolverManager - Resolving P/ShopmeCommon: com.shopme:ShopmeCommon:0.0.1-SNAPSHOT with classifier null to /ShopmeCommon/target/classes
2023-03-12 22:20:50,065 [Worker-178: Launching ShopmeBackEnd - ShopmeBackEndApplication] INFO o.e.m.c.i.p.WorkspaceClassifierResolverManager - Resolving P/ShopmeCommon: com.shopme:ShopmeCommon:0.0.1-SNAPSHOT with classifier null to /ShopmeCommon/target/classes
2023-03-12 22:30:20,400 [Worker-182: Building] INFO o.a.m.s.f.DefaultMavenResourcesFiltering - Copying 1 resource
2023-03-12 22:30:20,424 [Worker-182: Building] INFO o.a.m.s.f.DefaultMavenResourcesFiltering - Copying 0 resource
2023-03-12 22:30:20,426 [Worker-182: Building] INFO o.a.m.s.f.DefaultMavenResourcesFiltering - skip non existing resourceDirectory C:\Users\User\Desktop\ShopmeEcommerce\ShopmeProject\ShopmeCommon\src\test\resources
2023-03-12 22:30:31,644 [Worker-183: Building] INFO o.a.m.s.f.DefaultMavenResourcesFiltering - Copying 1 resource
2023-03-12 22:30:31,651 [Worker-183: Building] INFO o.a.m.s.f.DefaultMavenResourcesFiltering - Copying 0 resource
2023-03-12 22:30:31,654 [Worker-183: Building] INFO o.a.m.s.f.DefaultMavenResourcesFiltering - skip non existing resourceDirectory C:\Users\User\Desktop\ShopmeEcommerce\ShopmeProject\ShopmeCommon\src\test\resources
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public class Product {
// @OneToMany(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true)
// private Set<ProductImage> images = new HashSet<>();
//
// /* OneToMany -> One product to Many details*/
// /* OneToMany -> One product to Many details */
// @OneToMany(mappedBy = "product", cascade = CascadeType.ALL, orphanRemoval = true)
// private List<ProductDetail> details = new ArrayList<>();

Expand Down

0 comments on commit 1b58042

Please sign in to comment.