商品對象SPU
/**
* 商品分類列表
*/
@OneToMany(targetEntity = SPUCategoryRelation.class, cascade = CascadeType.ALL, mappedBy = "spu",orphanRemoval = true)
private Collection<SPUCategoryRelation> spuCategoryItems;
public SPU setSpuCategoryItems(Collection<SPUCategoryRelation> spuCategoryItems) {
if (this.spuCategoryItems == null) {
this.spuCategoryItems = spuCategoryItems;
return this;
}
this.spuCategoryItems.clear();
this.spuCategoryItems.addAll(spuCategoryItems);
return this;
}
商品分類 SPUCategoryRelation
/**
* 商品SPU
*/
@ManyToOne
@JoinColumn(name = "spu_id", nullable = false)
private SPU spu;