Browse Source

添加推荐产品的类

yujia 7 years ago
parent
commit
9f8b305890

+ 2 - 1
src/main/java/com/uas/platform/b2c/advertise/ad/dao/RecommendProductDao.java

@@ -2,13 +2,14 @@ package com.uas.platform.b2c.advertise.ad.dao;
 
 import com.uas.platform.b2c.advertise.ad.model.RecommendProduct;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
 import java.util.Set;
 
 @Repository
-public interface RecommendProductDao extends JpaRepository<RecommendProduct, Long> {
+public interface RecommendProductDao extends JpaRepository<RecommendProduct, Long>,JpaSpecificationExecutor<RecommendProduct> {
 
 	/**
 	 * 根据店铺企业UU获取产品推荐信息

+ 16 - 20
src/main/java/com/uas/platform/b2c/advertise/ad/model/AdvantageCommodity.java

@@ -1,8 +1,5 @@
 package com.uas.platform.b2c.advertise.ad.model;
 
-import org.springframework.data.annotation.Id;
-import org.springframework.data.mongodb.core.mapping.Field;
-
 import javax.persistence.*;
 import java.io.Serializable;
 import java.util.Date;
@@ -21,8 +18,7 @@ public class AdvantageCommodity implements Serializable {
 	 * 主键UUID
 	 */
 	@Id
-	@Column(name = "id")
-	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@GeneratedValue(strategy = GenerationType.AUTO)
 	private Long id;
 
 	/*=========================================================================
@@ -32,20 +28,20 @@ public class AdvantageCommodity implements Serializable {
 	/**
 	 * 创建时间
 	 */
-	@Field(value = "ad_create_time")
+	@Column(name ="ad_create_time")
 	private Date createTime;
 
 	/**
 	 * 修改时间
 	 */
-	@Field(value = "ad_update_time")
+	@Column(name = "ad_update_time")
 	private Date updateTime;
 
 	/**
 	 * 排序
 	 */
-	@Field(value = "ad_order")
-	private int order;
+	@Column(name = "ad_order")
+	private Integer order;
 
 	/*=========================================================================
 	 * 商品基础信息
@@ -54,55 +50,55 @@ public class AdvantageCommodity implements Serializable {
 	/**
 	 * 商品批次号
 	 */
-	@Field(value = "ad_com_batchCode")
+	@Column(name = "ad_com_batchCode")
 	private String batchCode;
 
 	/**
 	 * 对应的器件uuid
 	 */
-	@Field(value = "ad_com_uuid")
+	@Column(name = "ad_com_uuid")
 	private String comUuid;
 
 	/**
 	 * 原厂型号
 	 */
-	@Field(value = "ad_com_code")
+	@Column(name = "ad_com_code")
 	private String comCode;
 
 	/**
 	 * 图片path
 	 */
-	@Field(value = "ad_com_img")
+	@Column(name = "ad_com_img")
 	private String comImg;
 
 	/**
 	 * 类名UUID
 	 */
-	@Field(value = "ad_kind_uuid")
+	@Column(name = "ad_kind_uuid")
 	private String kindUuid;
 
 	/**
 	 * 类目的名称
 	 */
-	@Field(value = "ad_kind_name_cn")
+	@Column(name = "ad_kind_name_cn")
 	private String kindNameCn;
 
 	/**
 	 * 品牌中文名称
 	 */
-	@Field(value = "ad_brand_name_cn")
+	@Column(name = "ad_brand_name_cn")
 	private String brandNameCn;
 
 	/**
 	 * 本批次的最低人民币价格
 	 */
-	@Field(value = "ad_min_price_rmb")
+	@Column(name = "ad_min_price_rmb")
 	private Double minPriceRMB;
 
 	/**
 	 * 本批次的最低美元价格
 	 */
-	@Field(value = "ad_min_price_usd")
+	@Column(name = "ad_min_price_usd")
 	private Double minPriceUSD;
 
 	/*=========================================================================
@@ -112,13 +108,13 @@ public class AdvantageCommodity implements Serializable {
 	/**
 	 * 店铺所属公司
 	 */
-	@Field(value = "ad_store_enuu")
+	@Column(name = "ad_store_enuu")
 	private Long storeEnUU;
 
 	/**
 	 * 店铺UUID
 	 */
-	@Field(value = "ad_store_uuid")
+	@Column(name = "ad_store_uuid")
 	private String storeUuid;
 
 	public AdvantageCommodity() {

+ 21 - 23
src/main/java/com/uas/platform/b2c/advertise/ad/model/RecommendProduct.java

@@ -1,6 +1,5 @@
 package com.uas.platform.b2c.advertise.ad.model;
 
-import org.springframework.data.annotation.Id;
 
 import javax.persistence.*;
 import java.io.Serializable;
@@ -20,8 +19,7 @@ public class RecommendProduct implements Serializable {
 	 * 主键UUID
 	 */
 	@Id
-	@Column(name = "id")
-	@GeneratedValue(strategy = GenerationType.IDENTITY)
+	@GeneratedValue(strategy = GenerationType.AUTO)
 	private Long id;
 
 	/*=========================================================================
@@ -43,8 +41,8 @@ public class RecommendProduct implements Serializable {
 	/**
 	 * 排序
 	 */
-	@Column(name = "order")
-	private int order;
+	@Column(name = "recommend_order")
+	private Integer order = 1;
 
 	/*=========================================================================
 	 * 商品基础信息
@@ -54,79 +52,79 @@ public class RecommendProduct implements Serializable {
 	 * 商品批次号
 	 */
 	@Column(name = "batch_code")
-	private String batchCode;
+	private String batchCode = "";
 
 	/**
 	 * 对应的器件uuid
 	 */
 	@Column(name = "com_uuid")
-	private String comUuid;
+	private String comUuid = "";
 
 	/**
 	 * 原厂型号
 	 */
 	@Column(name = "com_code")
-	private String comCode;
+	private String comCode = "";
 
 	/**
 	 * 图片path
 	 */
 	@Column(name = "com_img")
-	private String comImg;
+	private String comImg = "";
 
 	/**
 	 * 类名UUID
 	 */
 	@Column(name = "kind_uuid")
-	private String kindUuid;
+	private String kindUuid = "";
 
 	/**
 	 * 类目的名称
 	 */
 	@Column(name = "kind_name_cn")
-	private String kindNameCn;
+	private String kindNameCn = "";
 
 	/**
 	 * 品牌中文名称
 	 */
 	@Column(name = "brand_name_cn")
-	private String brandNameCn;
+	private String brandNameCn = "";
 
 	/**
 	 * 本批次的最低人民币价格
 	 */
 	@Column(name = "min_price_rmb")
-	private Double minPriceRMB;
+	private Double minPriceRMB = 0.0;
 
 	/**
 	 * 本批次的最低美元价格
 	 */
 	@Column(name = "min_price_usd")
-	private Double minPriceUSD;
+	private Double minPriceUSD = 0.0;
 
 	/**
 	 * 商品库存量
 	 */
 	@Column(name = "reserve")
-	private Double reserve;
+	private Double reserve = 0.0;
 
 	/**
 	 * 最小起订量
 	 */
 	@Column(name = "min_buy_qty")
-	private Double minBuyQty;
+	private Double minBuyQty = 0.0;
 
 	/**
 	 * 币别
 	 */
 	@Column(name = "currency")
-	private String currency;
+	private String currency = "";
 
 	/**
 	 * 产品上架的店铺的UUID
 	 */
 	@Column(name = "store_second_id")
-	private String storeId;
+	private String storeId = "";
 
 	/*=========================================================================
 	 * 店铺信息
@@ -136,19 +134,19 @@ public class RecommendProduct implements Serializable {
 	 * 产品推荐拥有者所属公司UU
 	 */
 	@Column(name = "store_enuu")
-	private Long storeEnUU;
+	private Long storeEnUU = 0l;
 
 	/**
 	 * 产品推荐拥有者的店铺UUID
 	 */
 	@Column(name = "store_uuid")
-	private String storeUuid;
+	private String storeUuid = "";
 
 	/**
 	 * 售罄状态
 	 */
 	@Column(name = "status")
-	private Integer status;
+	private Integer status = 601;
 
 	public RecommendProduct() {
 	}
@@ -185,11 +183,11 @@ public class RecommendProduct implements Serializable {
 		this.updateTime = updateTime;
 	}
 
-	public int getOrder() {
+	public Integer getOrder() {
 		return order;
 	}
 
-	public void setOrder(int order) {
+	public void setOrder(Integer order) {
 		this.order = order;
 	}
 

+ 15 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/ReleaseProductByBatch.java

@@ -548,6 +548,12 @@ public class ReleaseProductByBatch implements Serializable {
 	@Column(name = "rel_attach")
 	private String attach;
 
+	/***
+	 * 在售的数量
+	 */
+	@Column(name = "rel_goods_count")
+	private Integer goodsCount = 0;
+
 //	private Short repeat;
 
 	@Override
@@ -1808,4 +1814,13 @@ public class ReleaseProductByBatch implements Serializable {
 		this.attach = attach;
 		return this;
 	}
+
+	public Integer getGoodsCount() {
+		return goodsCount;
+	}
+
+	public ReleaseProductByBatch setGoodsCount(Integer goodsCount) {
+		this.goodsCount = goodsCount;
+		return this;
+	}
 }

+ 1 - 1
src/main/resources/spring/context.xml

@@ -112,7 +112,7 @@
 
 	<bean id="entityManagerFactory"
 		  class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
-		<property name="persistenceUnitName" value="persistenceUnit" />
+		<!--<property name="persistenceUnitName" value="persistenceUnit" />-->
 		<property name="persistenceXmlLocation" value="classpath*:META-INF/persistence.xml"/>
 		<property name="packagesToScan" value="com.uas.platform" />
 		<property name="dataSource" ref="dataSource" />