From a42cfd2dfca18f8f802b93f3c07ca695fb1cfd13 Mon Sep 17 00:00:00 2001 From: Caps <279205343@qq.com> Date: Wed, 27 Nov 2019 11:21:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E5=8C=BF?= =?UTF-8?q?=E5=8A=A0=E8=B4=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../polaris/controller/CartController.java | 7 +++ .../polaris/service/CartItemService.java | 2 + .../service/impl/CartItemServiceImpl.java | 51 +++++++++++++++++-- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/hxtec/polaris/controller/CartController.java b/src/main/java/com/hxtec/polaris/controller/CartController.java index 168dcd6..5c0f282 100644 --- a/src/main/java/com/hxtec/polaris/controller/CartController.java +++ b/src/main/java/com/hxtec/polaris/controller/CartController.java @@ -61,5 +61,12 @@ public class CartController { List cartItemList= cartService.getCartList(); return Result.ok(cartItemList); } + + @ApiOperation(value = "购物车匿名合并") + @PostMapping("combineCart") + public Result combineCart(List cartItemList){ + List finalCartItemList=cartService.combineCart(cartItemList); + return Result.ok(finalCartItemList); + } } diff --git a/src/main/java/com/hxtec/polaris/service/CartItemService.java b/src/main/java/com/hxtec/polaris/service/CartItemService.java index a8d0f46..82fd637 100644 --- a/src/main/java/com/hxtec/polaris/service/CartItemService.java +++ b/src/main/java/com/hxtec/polaris/service/CartItemService.java @@ -21,5 +21,7 @@ public interface CartItemService { Map addTocart(int sku, int quantity); List getCartList(); + + List combineCart(List cartItemList); } diff --git a/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java index dafb15a..89a4e32 100644 --- a/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java +++ b/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java @@ -1,13 +1,10 @@ package com.hxtec.polaris.service.impl; -import com.hxtec.polaris.commons.api.vo.Result; import com.hxtec.polaris.commons.contants.CommonContants; import com.hxtec.polaris.entity.ShopCartItem; import com.hxtec.polaris.entity.ShopProductBase; import com.hxtec.polaris.entity.ShopProductVariant; import com.hxtec.polaris.entity.ShopUser; -import com.hxtec.polaris.mapper.ShopProductVariantMapper; -import com.hxtec.polaris.mapper.ShopUserMapper; import com.hxtec.polaris.service.ProductService; import com.hxtec.polaris.service.UserService; import org.apache.commons.lang3.StringUtils; @@ -24,7 +21,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.hibernate.validator.internal.metadata.core.ConstraintHelper.MESSAGE; /** * @author Caps @@ -110,6 +106,34 @@ public class CartItemServiceImpl implements CartItemService { return cartList; } + /** + * 合并购物车 + * @param cartItemList + * @return + */ + @Override + public List combineCart(List cartItemList) { + List cartList = this.getCartList(); + cartItemList.forEach( + cartItem->{ + //数据库有,合并购物车数据 + if(if_cart_exist(cartList,cartItem)){ + for (ShopCartItem shopitem:cartList) { + if(shopitem.getProductSkuId().equals(cartItem.getProductSkuId())){ + cartItem.setQuantity(shopitem.getQuantity()+cartItem.getQuantity()); + } + } + } + //数据库没有,新增当前购物车 + else { + this.insertTocart(cartItem); + } + } + ); + //获取最新的购物车列表 + return this.getCartList(); + } + private String getUser(){ return SecurityContextHolder.getContext().getAuthentication().getName(); } @@ -137,5 +161,24 @@ public class CartItemServiceImpl implements CartItemService { example.createCriteria().andEqualTo("id",cartItem.getId()); return cartItemMapper.updateByExampleSelective(cartItem,example); } + + + /** + * 当前购物车数据库是否存在 + * @param shopCartItems + * @param cartItem + * @return + */ + private boolean if_cart_exist(List shopCartItems, ShopCartItem cartItem) { + boolean flag = false; + for (ShopCartItem shopCartItem : shopCartItems) { + Integer productSkuId = shopCartItem.getProductSkuId(); + + if (productSkuId.equals(cartItem.getProductSkuId())) { + flag = true; + } + } + return flag; + } } -- Gitee From 1e9b8a9f0dbca2791a951d85e001cf399008ed93 Mon Sep 17 00:00:00 2001 From: Caps <279205343@qq.com> Date: Mon, 2 Dec 2019 11:09:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=A1=A8=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../polaris/controller/CartController.java | 16 +- .../polaris/controller/OrderController.java | 8 + .../hxtec/polaris/entity/ShopCartItem.java | 42 +- .../com/hxtec/polaris/entity/ShopOrder.java | 453 ++++-------------- .../hxtec/polaris/entity/ShopOrderDetail.java | 412 ---------------- .../hxtec/polaris/entity/ShopOrderItem.java | 109 +++++ .../hxtec/polaris/entity/ShopProductBase.java | 26 +- .../polaris/entity/ShopProductImage.java | 26 +- .../polaris/entity/ShopProductSaleAttr.java | 29 +- .../entity/ShopProductSaleAttrValue.java | 23 +- .../polaris/entity/ShopProductVariant.java | 48 +- .../entity/ShopProductVariantAttrValue.java | 36 +- .../entity/ShopProductVariantImage.java | 32 +- .../com/hxtec/polaris/entity/ShopStock.java | 2 +- .../com/hxtec/polaris/entity/ShopUser.java | 58 ++- .../polaris/mapper/ShopCartItemMapper.java | 2 +- ...ilMapper.java => ShopOrderItemMapper.java} | 8 +- .../hxtec/polaris/mapper/ShopOrderMapper.java | 4 + .../polaris/mapper/ShopProductBaseMapper.java | 30 +- .../mapper/ShopProductImageMapper.java | 2 +- .../mapper/ShopProductSaleAttrMapper.java | 9 +- .../ShopProductSaleAttrValueMapper.java | 2 +- .../ShopProductVariantAttrValueMapper.java | 5 +- .../mapper/ShopProductVariantImageMapper.java | 2 +- .../mapper/ShopProductVariantMapper.java | 7 +- .../hxtec/polaris/mapper/ShopStockMapper.java | 2 +- .../hxtec/polaris/mapper/ShopUserMapper.java | 4 + .../polaris/service/CartItemService.java | 2 - .../hxtec/polaris/service/ProductService.java | 6 + .../polaris/service/ShopOrderItemService.java | 10 + .../polaris/service/ShopOrderService.java | 10 + .../hxtec/polaris/service/StockService.java | 2 +- .../service/impl/CartItemServiceImpl.java | 68 ++- .../service/impl/ProductServiceImpl.java | 24 +- .../impl/ShopOrderItemServiceImpl.java | 17 + .../service/impl/ShopOrderServiceImpl.java | 17 + .../service/impl/StockServiceImpl.java | 2 +- .../polaris/service/impl/UserServiceImpl.java | 6 +- .../resources/mapper/ShopCartItemMapper.xml | 15 +- .../mapper/ShopOrderDetailMapper.xml | 26 - .../resources/mapper/ShopOrderItemMapper.xml | 25 + src/main/resources/mapper/ShopOrderMapper.xml | 31 +- .../mapper/ShopProductBaseMapper.xml | 57 +-- .../mapper/ShopProductImageMapper.xml | 8 +- .../mapper/ShopProductSaleAttrMapper.xml | 18 +- .../mapper/ShopProductSaleAttrValueMapper.xml | 8 +- .../ShopProductVariantAttrValueMapper.xml | 24 +- .../mapper/ShopProductVariantImageMapper.xml | 10 +- .../mapper/ShopProductVariantMapper.xml | 29 +- src/main/resources/mapper/ShopStockMapper.xml | 8 +- src/main/resources/mapper/ShopUserMapper.xml | 9 +- 51 files changed, 701 insertions(+), 1128 deletions(-) create mode 100644 src/main/java/com/hxtec/polaris/controller/OrderController.java delete mode 100644 src/main/java/com/hxtec/polaris/entity/ShopOrderDetail.java create mode 100644 src/main/java/com/hxtec/polaris/entity/ShopOrderItem.java rename src/main/java/com/hxtec/polaris/mapper/{ShopOrderDetailMapper.java => ShopOrderItemMapper.java} (30%) create mode 100644 src/main/java/com/hxtec/polaris/service/ShopOrderItemService.java create mode 100644 src/main/java/com/hxtec/polaris/service/ShopOrderService.java create mode 100644 src/main/java/com/hxtec/polaris/service/impl/ShopOrderItemServiceImpl.java create mode 100644 src/main/java/com/hxtec/polaris/service/impl/ShopOrderServiceImpl.java delete mode 100644 src/main/resources/mapper/ShopOrderDetailMapper.xml create mode 100644 src/main/resources/mapper/ShopOrderItemMapper.xml diff --git a/src/main/java/com/hxtec/polaris/controller/CartController.java b/src/main/java/com/hxtec/polaris/controller/CartController.java index 5c0f282..ea865d7 100644 --- a/src/main/java/com/hxtec/polaris/controller/CartController.java +++ b/src/main/java/com/hxtec/polaris/controller/CartController.java @@ -12,6 +12,7 @@ import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -45,28 +46,15 @@ public class CartController { }) public Result addToCart(@PathVariable int sku,@PathVariable int quantity){ Map map = cartService.addTocart(sku, quantity); - if(StringUtils.equals("success",map.get(CommonContants.STATUS).toString())){ - if (StringUtils.equals(map.get(CommonContants.COUNTS).toString(),"1")){ - //更新库存 - stockService.updateStockInfoBySku(sku); - } - } return Result.ok(map); } @ApiOperation(value = "获取购物车列表") - @PostMapping("cartList") + @GetMapping("cartList") public Result cartList(){ List cartItemList= cartService.getCartList(); return Result.ok(cartItemList); } - - @ApiOperation(value = "购物车匿名合并") - @PostMapping("combineCart") - public Result combineCart(List cartItemList){ - List finalCartItemList=cartService.combineCart(cartItemList); - return Result.ok(finalCartItemList); - } } diff --git a/src/main/java/com/hxtec/polaris/controller/OrderController.java b/src/main/java/com/hxtec/polaris/controller/OrderController.java new file mode 100644 index 0000000..24fab10 --- /dev/null +++ b/src/main/java/com/hxtec/polaris/controller/OrderController.java @@ -0,0 +1,8 @@ +package com.hxtec.polaris.controller; + +/** + * @author Caps + * @date 2019/12/2 + */ +public class OrderController { +} diff --git a/src/main/java/com/hxtec/polaris/entity/ShopCartItem.java b/src/main/java/com/hxtec/polaris/entity/ShopCartItem.java index 9d595e3..150d7a4 100644 --- a/src/main/java/com/hxtec/polaris/entity/ShopCartItem.java +++ b/src/main/java/com/hxtec/polaris/entity/ShopCartItem.java @@ -14,13 +14,13 @@ import lombok.NoArgsConstructor; /** * @author Caps - * @date 2019/11/25 + * @date 2019/11/29 */ -@ApiModel(value = "com.hxtec.polaris.entity.ShopCartItem") +@ApiModel(value="com.hxtec.polaris.entity.ShopCartItem") +@Data @Builder @AllArgsConstructor @NoArgsConstructor -@Data @Table(name = "shop_cart_item") public class ShopCartItem implements Serializable { /** @@ -29,104 +29,112 @@ public class ShopCartItem implements Serializable { @Id @Column(name = "id") @GeneratedValue(generator = "JDBC") - @ApiModelProperty(value = "主键") + @ApiModelProperty(value="主键") private Integer id; /** * spu_id */ @Column(name = "product_id") - @ApiModelProperty(value = "spu_id") + @ApiModelProperty(value="spu_id") private Integer productId; /** * sku_id */ @Column(name = "product_sku_id") - @ApiModelProperty(value = "sku_id") + @ApiModelProperty(value="sku_id") private Integer productSkuId; /** * 用户id */ @Column(name = "member_id") - @ApiModelProperty(value = "用户id") + @ApiModelProperty(value="用户id") private Integer memberId; /** * 购买数量 */ @Column(name = "quantity") - @ApiModelProperty(value = "购买数量") + @ApiModelProperty(value="购买数量") private Integer quantity; /** * 添加到购物车的价格 */ @Column(name = "price") - @ApiModelProperty(value = "添加到购物车的价格") + @ApiModelProperty(value="添加到购物车的价格") private BigDecimal price; /** * 商品主图 */ @Column(name = "product_pic") - @ApiModelProperty(value = "商品主图") + @ApiModelProperty(value="商品主图") private String productPic; + /** + * 库存 + */ + @Column(name = "stock") + @ApiModelProperty(value="库存") + private Integer stock; + /** * 商品名称 */ @Column(name = "product_name") - @ApiModelProperty(value = "商品名称") + @ApiModelProperty(value="商品名称") private String productName; /** * 商品副标题(卖点) */ @Column(name = "product_sub_title") - @ApiModelProperty(value = "商品副标题(卖点)") + @ApiModelProperty(value="商品副标题(卖点)") private String productSubTitle; /** * 会员昵称 */ @Column(name = "member_nickname") - @ApiModelProperty(value = "会员昵称") + @ApiModelProperty(value="会员昵称") private String memberNickname; /** * 创建时间 */ @Column(name = "create_time") - @ApiModelProperty(value = "创建时间") + @ApiModelProperty(value="创建时间") private Date createTime; /** * 修改时间 */ @Column(name = "update_time") - @ApiModelProperty(value = "修改时间") + @ApiModelProperty(value="修改时间") private Date updateTime; /** * 是否删除 */ @Column(name = "delete_status") - @ApiModelProperty(value = "是否删除") + @ApiModelProperty(value="是否删除") private Integer deleteStatus; /** * 商品分类 */ @Column(name = "product_category_id") - @ApiModelProperty(value = "商品分类") + @ApiModelProperty(value="商品分类") private Integer productCategoryId; /** * 商品销售属性:[{"key":"颜色","value":"颜色"},{"key":"容量","value":"4G"}] */ @Column(name = "product_attr") + @ApiModelProperty(value="商品销售属性:") private String productAttr; private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/hxtec/polaris/entity/ShopOrder.java b/src/main/java/com/hxtec/polaris/entity/ShopOrder.java index 598013e..8acad29 100644 --- a/src/main/java/com/hxtec/polaris/entity/ShopOrder.java +++ b/src/main/java/com/hxtec/polaris/entity/ShopOrder.java @@ -1,437 +1,176 @@ package com.hxtec.polaris.entity; -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; - -@Table(name = "hx_tec_shop.shop_order") -public class ShopOrder { +import javax.persistence.*; +import lombok.Data; + +/** + * @author Caps + * @date 2019/12/2 + */ +@ApiModel(value="com.hxtec.polaris.entity.ShopOrder") +@Data +@Table(name = "shop_order") +public class ShopOrder implements Serializable { /** * 订单表主键 */ @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private String id; + @Column(name = "id") + @GeneratedValue(generator = "JDBC") + @ApiModelProperty(value="订单表主键") + private Integer id; + + /** + * 用户id + */ + @Column(name = "member_id") + @ApiModelProperty(value="用户id") + private Integer memberId; /** * 订单号 */ @Column(name = "order_code") - private String orderCode; + @ApiModelProperty(value="订单号") + private Integer orderCode; /** - * 下单时的总价格 + * 订单总金额 */ @Column(name = "total_price") + @ApiModelProperty(value="订单总金额") private BigDecimal totalPrice; /** - * 订单状态 + * 运费金额 + */ + @Column(name = "freight_amount") + @ApiModelProperty(value="运费金额") + private Long freightAmount; + + /** + * 支付方式:0->未支付;1->支付宝;2->微信 + */ + @Column(name = "pay_type") + @ApiModelProperty(value="支付方式:0->未支付;1->支付宝;2->微信") + private Integer payType; + + /** + * 应付金额(实际支付金额) */ - private String state; + @Column(name = "pay_amount") + @ApiModelProperty(value="应付金额(实际支付金额)") + private Long payAmount; + + /** + * 订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单 + */ + @Column(name = "`state`") + @ApiModelProperty(value="订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单") + private Integer state; /** * 是否被删除(Y是/N否) */ @Column(name = "is_delete") + @ApiModelProperty(value="是否被删除(Y是/N否)") private String isDelete; /** * 物流公司 */ @Column(name = "delivery_company") + @ApiModelProperty(value="物流公司") private String deliveryCompany; /** * 物流单号 */ @Column(name = "delivery_code") + @ApiModelProperty(value="物流单号") private String deliveryCode; + /** + * 收货人姓名 + */ + @Column(name = "receiver_name") + @ApiModelProperty(value="收货人姓名") + private String receiverName; + + /** + * 收货人电话 + */ + @Column(name = "receiver_phone") + @ApiModelProperty(value="收货人电话") + private String receiverPhone; + + /** + * 收货人邮编 + */ + @Column(name = "receiver_post_code") + @ApiModelProperty(value="收货人邮编") + private String receiverPostCode; + /** * 省 */ + @Column(name = "province") + @ApiModelProperty(value="省") private String province; /** * 市 */ + @Column(name = "city") + @ApiModelProperty(value="市") private String city; /** * 区 */ + @Column(name = "region") + @ApiModelProperty(value="区") private String region; /** * 订单详细地址 */ @Column(name = "address_detail") + @ApiModelProperty(value="订单详细地址") private String addressDetail; /** * 创建时间 */ @Column(name = "create_time") + @ApiModelProperty(value="创建时间") private Date createTime; /** * 修改时间 */ @Column(name = "update_time") + @ApiModelProperty(value="修改时间") private Date updateTime; /** - * 备用字段1 - */ - private String comment1; - - /** - * 备用字段2 - */ - private String comment2; - - /** - * 备用字段3 - */ - private String comment3; - - /** - * 支付方式 - */ - private String payment; - - /** - * 支付价格 - */ - @Column(name = "payment_price") - private BigDecimal paymentPrice; - - /** - * 获取订单表主键 - * - * @return id - 订单表主键 - */ - public String getId() { - return id; - } - - /** - * 设置订单表主键 - * - * @param id 订单表主键 - */ - public void setId(String id) { - this.id = id; - } - - /** - * 获取订单号 - * - * @return order_code - 订单号 - */ - public String getOrderCode() { - return orderCode; - } - - /** - * 设置订单号 - * - * @param orderCode 订单号 - */ - public void setOrderCode(String orderCode) { - this.orderCode = orderCode; - } - - /** - * 获取下单时的总价格 - * - * @return total_price - 下单时的总价格 - */ - public BigDecimal getTotalPrice() { - return totalPrice; - } - - /** - * 设置下单时的总价格 - * - * @param totalPrice 下单时的总价格 - */ - public void setTotalPrice(BigDecimal totalPrice) { - this.totalPrice = totalPrice; - } - - /** - * 获取订单状态 - * - * @return state - 订单状态 - */ - public String getState() { - return state; - } - - /** - * 设置订单状态 - * - * @param state 订单状态 - */ - public void setState(String state) { - this.state = state; - } - - /** - * 获取是否被删除(Y是/N否) - * - * @return is_delete - 是否被删除(Y是/N否) - */ - public String getIsDelete() { - return isDelete; - } - - /** - * 设置是否被删除(Y是/N否) - * - * @param isDelete 是否被删除(Y是/N否) - */ - public void setIsDelete(String isDelete) { - this.isDelete = isDelete; - } - - /** - * 获取物流公司 - * - * @return delivery_company - 物流公司 - */ - public String getDeliveryCompany() { - return deliveryCompany; - } - - /** - * 设置物流公司 - * - * @param deliveryCompany 物流公司 - */ - public void setDeliveryCompany(String deliveryCompany) { - this.deliveryCompany = deliveryCompany; - } - - /** - * 获取物流单号 - * - * @return delivery_code - 物流单号 - */ - public String getDeliveryCode() { - return deliveryCode; - } - - /** - * 设置物流单号 - * - * @param deliveryCode 物流单号 - */ - public void setDeliveryCode(String deliveryCode) { - this.deliveryCode = deliveryCode; - } - - /** - * 获取省 - * - * @return province - 省 + * 自动确认时间(天) */ - public String getProvince() { - return province; - } + @Column(name = "auto_confirm_day") + @ApiModelProperty(value="自动确认时间(天)") + private Integer autoConfirmDay; /** - * 设置省 - * - * @param province 省 + * 确认收货状态:0->未确认;1->已确认 */ - public void setProvince(String province) { - this.province = province; - } + @Column(name = "confirm_status") + @ApiModelProperty(value="确认收货状态:0->未确认;1->已确认") + private Integer confirmStatus; - /** - * 获取市 - * - * @return city - 市 - */ - public String getCity() { - return city; - } - - /** - * 设置市 - * - * @param city 市 - */ - public void setCity(String city) { - this.city = city; - } - - /** - * 获取区 - * - * @return region - 区 - */ - public String getRegion() { - return region; - } - - /** - * 设置区 - * - * @param region 区 - */ - public void setRegion(String region) { - this.region = region; - } - - /** - * 获取订单详细地址 - * - * @return address_detail - 订单详细地址 - */ - public String getAddressDetail() { - return addressDetail; - } - - /** - * 设置订单详细地址 - * - * @param addressDetail 订单详细地址 - */ - public void setAddressDetail(String addressDetail) { - this.addressDetail = addressDetail; - } - - /** - * 获取创建时间 - * - * @return create_time - 创建时间 - */ - public Date getCreateTime() { - return createTime; - } - - /** - * 设置创建时间 - * - * @param createTime 创建时间 - */ - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - /** - * 获取修改时间 - * - * @return update_time - 修改时间 - */ - public Date getUpdateTime() { - return updateTime; - } - - /** - * 设置修改时间 - * - * @param updateTime 修改时间 - */ - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - /** - * 获取备用字段1 - * - * @return comment1 - 备用字段1 - */ - public String getComment1() { - return comment1; - } - - /** - * 设置备用字段1 - * - * @param comment1 备用字段1 - */ - public void setComment1(String comment1) { - this.comment1 = comment1; - } - - /** - * 获取备用字段2 - * - * @return comment2 - 备用字段2 - */ - public String getComment2() { - return comment2; - } - - /** - * 设置备用字段2 - * - * @param comment2 备用字段2 - */ - public void setComment2(String comment2) { - this.comment2 = comment2; - } - - /** - * 获取备用字段3 - * - * @return comment3 - 备用字段3 - */ - public String getComment3() { - return comment3; - } - - /** - * 设置备用字段3 - * - * @param comment3 备用字段3 - */ - public void setComment3(String comment3) { - this.comment3 = comment3; - } - - /** - * 获取支付方式 - * - * @return payment - 支付方式 - */ - public String getPayment() { - return payment; - } - - /** - * 设置支付方式 - * - * @param payment 支付方式 - */ - public void setPayment(String payment) { - this.payment = payment; - } - - /** - * 获取支付价格 - * - * @return payment_price - 支付价格 - */ - public BigDecimal getPaymentPrice() { - return paymentPrice; - } - - /** - * 设置支付价格 - * - * @param paymentPrice 支付价格 - */ - public void setPaymentPrice(BigDecimal paymentPrice) { - this.paymentPrice = paymentPrice; - } + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/entity/ShopOrderDetail.java b/src/main/java/com/hxtec/polaris/entity/ShopOrderDetail.java deleted file mode 100644 index 719fe95..0000000 --- a/src/main/java/com/hxtec/polaris/entity/ShopOrderDetail.java +++ /dev/null @@ -1,412 +0,0 @@ -package com.hxtec.polaris.entity; - -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; -import java.math.BigDecimal; -import java.util.Date; - -@Table(name = "hx_tec_shop.shop_order_detail") -public class ShopOrderDetail { - /** - * 订单详情表主键 - */ - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private String id; - - /** - * 订单号 - */ - @Column(name = "order_code") - private String orderCode; - - /** - * 商品数量 - */ - private Integer number; - - /** - * 下单时的商品价格 - */ - private BigDecimal price; - - /** - * 是否被删除(Y是/N否) - */ - @Column(name = "is_delete") - private String isDelete; - - /** - * 商品名称 - */ - @Column(name = "product_base_name") - private String productBaseName; - - /** - * 下单时的sku - */ - private String sku; - - /** - * 图片 - */ - private String image; - - /** - * 产品规格 - */ - @Column(name = "attribute_name") - private String attributeName; - - /** - * 产品描述 - */ - private String description; - - /** - * 创建时间 - */ - @Column(name = "create_time") - private Date createTime; - - /** - * 修改时间 - */ - @Column(name = "update_time") - private Date updateTime; - - /** - * 权重 - */ - private Double weight; - - /** - * 备用字段1 - */ - private String comment1; - - /** - * 备用字段2 - */ - private String comment2; - - /** - * 备用字段3 - */ - private String comment3; - - /** - * 商品介绍 - */ - @Column(name = "product_base_detail") - private String productBaseDetail; - - /** - * 获取订单详情表主键 - * - * @return id - 订单详情表主键 - */ - public String getId() { - return id; - } - - /** - * 设置订单详情表主键 - * - * @param id 订单详情表主键 - */ - public void setId(String id) { - this.id = id; - } - - /** - * 获取订单号 - * - * @return order_code - 订单号 - */ - public String getOrderCode() { - return orderCode; - } - - /** - * 设置订单号 - * - * @param orderCode 订单号 - */ - public void setOrderCode(String orderCode) { - this.orderCode = orderCode; - } - - /** - * 获取商品数量 - * - * @return number - 商品数量 - */ - public Integer getNumber() { - return number; - } - - /** - * 设置商品数量 - * - * @param number 商品数量 - */ - public void setNumber(Integer number) { - this.number = number; - } - - /** - * 获取下单时的商品价格 - * - * @return price - 下单时的商品价格 - */ - public BigDecimal getPrice() { - return price; - } - - /** - * 设置下单时的商品价格 - * - * @param price 下单时的商品价格 - */ - public void setPrice(BigDecimal price) { - this.price = price; - } - - /** - * 获取是否被删除(Y是/N否) - * - * @return is_delete - 是否被删除(Y是/N否) - */ - public String getIsDelete() { - return isDelete; - } - - /** - * 设置是否被删除(Y是/N否) - * - * @param isDelete 是否被删除(Y是/N否) - */ - public void setIsDelete(String isDelete) { - this.isDelete = isDelete; - } - - /** - * 获取商品名称 - * - * @return product_base_name - 商品名称 - */ - public String getProductBaseName() { - return productBaseName; - } - - /** - * 设置商品名称 - * - * @param productBaseName 商品名称 - */ - public void setProductBaseName(String productBaseName) { - this.productBaseName = productBaseName; - } - - /** - * 获取下单时的sku - * - * @return sku - 下单时的sku - */ - public String getSku() { - return sku; - } - - /** - * 设置下单时的sku - * - * @param sku 下单时的sku - */ - public void setSku(String sku) { - this.sku = sku; - } - - /** - * 获取图片 - * - * @return image - 图片 - */ - public String getImage() { - return image; - } - - /** - * 设置图片 - * - * @param image 图片 - */ - public void setImage(String image) { - this.image = image; - } - - /** - * 获取产品规格 - * - * @return attribute_name - 产品规格 - */ - public String getAttributeName() { - return attributeName; - } - - /** - * 设置产品规格 - * - * @param attributeName 产品规格 - */ - public void setAttributeName(String attributeName) { - this.attributeName = attributeName; - } - - /** - * 获取产品描述 - * - * @return description - 产品描述 - */ - public String getDescription() { - return description; - } - - /** - * 设置产品描述 - * - * @param description 产品描述 - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * 获取创建时间 - * - * @return create_time - 创建时间 - */ - public Date getCreateTime() { - return createTime; - } - - /** - * 设置创建时间 - * - * @param createTime 创建时间 - */ - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - /** - * 获取修改时间 - * - * @return update_time - 修改时间 - */ - public Date getUpdateTime() { - return updateTime; - } - - /** - * 设置修改时间 - * - * @param updateTime 修改时间 - */ - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - /** - * 获取权重 - * - * @return weight - 权重 - */ - public Double getWeight() { - return weight; - } - - /** - * 设置权重 - * - * @param weight 权重 - */ - public void setWeight(Double weight) { - this.weight = weight; - } - - /** - * 获取备用字段1 - * - * @return comment1 - 备用字段1 - */ - public String getComment1() { - return comment1; - } - - /** - * 设置备用字段1 - * - * @param comment1 备用字段1 - */ - public void setComment1(String comment1) { - this.comment1 = comment1; - } - - /** - * 获取备用字段2 - * - * @return comment2 - 备用字段2 - */ - public String getComment2() { - return comment2; - } - - /** - * 设置备用字段2 - * - * @param comment2 备用字段2 - */ - public void setComment2(String comment2) { - this.comment2 = comment2; - } - - /** - * 获取备用字段3 - * - * @return comment3 - 备用字段3 - */ - public String getComment3() { - return comment3; - } - - /** - * 设置备用字段3 - * - * @param comment3 备用字段3 - */ - public void setComment3(String comment3) { - this.comment3 = comment3; - } - - /** - * 获取商品介绍 - * - * @return product_base_detail - 商品介绍 - */ - public String getProductBaseDetail() { - return productBaseDetail; - } - - /** - * 设置商品介绍 - * - * @param productBaseDetail 商品介绍 - */ - public void setProductBaseDetail(String productBaseDetail) { - this.productBaseDetail = productBaseDetail; - } -} \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/entity/ShopOrderItem.java b/src/main/java/com/hxtec/polaris/entity/ShopOrderItem.java new file mode 100644 index 0000000..0c30e65 --- /dev/null +++ b/src/main/java/com/hxtec/polaris/entity/ShopOrderItem.java @@ -0,0 +1,109 @@ +package com.hxtec.polaris.entity; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.*; +import lombok.Data; + +/** + * @author Caps + * @date 2019/12/2 + */ +@ApiModel(value="com.hxtec.polaris.entity.ShopOrderItem") +@Data +@Table(name = "shop_order_item") +public class ShopOrderItem implements Serializable { + @Id + @Column(name = "id") + @GeneratedValue(generator = "JDBC") + @ApiModelProperty(value="null") + private Integer id; + + /** + * 订单id + */ + @Column(name = "order_id") + @ApiModelProperty(value="订单id") + private Integer orderId; + + /** + * 商品spu + */ + @Column(name = "product_id") + @ApiModelProperty(value="商品spu") + private Integer productId; + + /** + * 商品图片 + */ + @Column(name = "product_pic") + @ApiModelProperty(value="商品图片") + private String productPic; + + /** + * 商品名称 + */ + @Column(name = "product_name") + @ApiModelProperty(value="商品名称") + private String productName; + + /** + * 商品介绍 + */ + @Column(name = "product_introduce") + @ApiModelProperty(value="商品介绍") + private String productIntroduce; + + /** + * 销售价格 + */ + @Column(name = "product_price") + @ApiModelProperty(value="销售价格") + private BigDecimal productPrice; + + /** + * 购买数量 + */ + @Column(name = "product_quantity") + @ApiModelProperty(value="购买数量") + private Integer productQuantity; + + /** + * 商品sku编号 + */ + @Column(name = "product_sku_id") + @ApiModelProperty(value="商品sku编号") + private Integer productSkuId; + + /** + * 商品分类id + */ + @Column(name = "product_category_id") + @ApiModelProperty(value="商品分类id") + private Integer productCategoryId; + + /** + * 商品销售属性:[{"key":"颜色","value":"颜色"},{"key":"容量","value":"4G"}] + */ + @Column(name = "product_attr") + @ApiModelProperty(value="商品销售属性") + private String productAttr; + + /** + * 权重 + */ + @Column(name = "weight") + @ApiModelProperty(value="权重") + private Double weight; + + /** + * 是否被删除(Y是/N否) + */ + @Column(name = "is_delete") + @ApiModelProperty(value="是否被删除(Y是/N否)") + private String isDelete; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/entity/ShopProductBase.java b/src/main/java/com/hxtec/polaris/entity/ShopProductBase.java index 3defad8..c4e44b1 100644 --- a/src/main/java/com/hxtec/polaris/entity/ShopProductBase.java +++ b/src/main/java/com/hxtec/polaris/entity/ShopProductBase.java @@ -2,22 +2,18 @@ package com.hxtec.polaris.entity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; import java.io.Serializable; import java.util.Date; +import javax.persistence.*; +import lombok.Data; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ @ApiModel(value = "com.hxtec.polaris.entity.ShopProductBase") @Data -@Table(name = "hx_tec_shop.shop_product_base") +@Table(name = "shop_product_base") public class ShopProductBase implements Serializable { /** * 商品base主表主键 @@ -42,6 +38,13 @@ public class ShopProductBase implements Serializable { @ApiModelProperty(value = "商品名称") private String name; + /** + * 商品介绍 + */ + @Column(name = "detail") + @ApiModelProperty(value = "商品介绍") + private String detail; + /** * 创建时间 */ @@ -84,12 +87,5 @@ public class ShopProductBase implements Serializable { @ApiModelProperty(value = "备用字段3") private String comment3; - /** - * 商品介绍 - */ - @Column(name = "detail") - @ApiModelProperty(value = "商品介绍") - private String detail; - private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/entity/ShopProductImage.java b/src/main/java/com/hxtec/polaris/entity/ShopProductImage.java index 79f1fa2..702c370 100644 --- a/src/main/java/com/hxtec/polaris/entity/ShopProductImage.java +++ b/src/main/java/com/hxtec/polaris/entity/ShopProductImage.java @@ -2,38 +2,34 @@ package com.hxtec.polaris.entity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; import java.io.Serializable; +import javax.persistence.*; +import lombok.Data; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ -@ApiModel(value="com.hxtec.polaris.entity.ShopProductImage") +@ApiModel(value = "com.hxtec.polaris.entity.ShopProductImage") @Data -@Table(name = "hx_tec_shop.shop_product_image") +@Table(name = "shop_product_image") public class ShopProductImage implements Serializable { @Id @Column(name = "id") @GeneratedValue(generator = "JDBC") - @ApiModelProperty(value="null") - private Long id; + @ApiModelProperty(value = "null") + private Integer id; @Column(name = "product_id") - @ApiModelProperty(value="null") - private Long productId; + @ApiModelProperty(value = "null") + private Integer productId; @Column(name = "img_name") - @ApiModelProperty(value="null") + @ApiModelProperty(value = "null") private String imgName; @Column(name = "img_url") - @ApiModelProperty(value="null") + @ApiModelProperty(value = "null") private String imgUrl; private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/hxtec/polaris/entity/ShopProductSaleAttr.java b/src/main/java/com/hxtec/polaris/entity/ShopProductSaleAttr.java index 3e585fd..9c9b6b8 100644 --- a/src/main/java/com/hxtec/polaris/entity/ShopProductSaleAttr.java +++ b/src/main/java/com/hxtec/polaris/entity/ShopProductSaleAttr.java @@ -2,56 +2,49 @@ package com.hxtec.polaris.entity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable;import java.util.List; +import javax.persistence.*; import lombok.Data; -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Transient; -import java.io.Serializable; -import java.util.List; - /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ -@ApiModel(value="com.hxtec.polaris.entity.ShopProductSaleAttr") +@ApiModel(value = "com.hxtec.polaris.entity.ShopProductSaleAttr") @Data -@Table(name = "hx_tec_shop.shop_product_sale_attr") +@Table(name = "shop_product_sale_attr") public class ShopProductSaleAttr implements Serializable { + @Transient + List spuSaleAttrValueList; /** * id */ @Id @Column(name = "id") @GeneratedValue(generator = "JDBC") - @ApiModelProperty(value="id") + @ApiModelProperty(value = "id") private Integer id; /** * 商品id */ @Column(name = "product_id") - @ApiModelProperty(value="商品id") + @ApiModelProperty(value = "商品id") private Integer productId; /** * 销售属性id */ @Column(name = "sale_attr_id") - @ApiModelProperty(value="销售属性id") + @ApiModelProperty(value = "销售属性id") private Integer saleAttrId; /** * 销售属性名称 */ @Column(name = "sale_attr_name") - @ApiModelProperty(value="销售属性名称") + @ApiModelProperty(value = "销售属性名称") private String saleAttrName; - @Transient - List spuSaleAttrValueList; - private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/entity/ShopProductSaleAttrValue.java b/src/main/java/com/hxtec/polaris/entity/ShopProductSaleAttrValue.java index 5e51a11..4e6c8a8 100644 --- a/src/main/java/com/hxtec/polaris/entity/ShopProductSaleAttrValue.java +++ b/src/main/java/com/hxtec/polaris/entity/ShopProductSaleAttrValue.java @@ -2,22 +2,17 @@ package com.hxtec.polaris.entity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Transient; import java.io.Serializable; +import javax.persistence.*; +import lombok.Data; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ -@ApiModel(value="com.hxtec.polaris.entity.ShopProductSaleAttrValue") +@ApiModel(value = "com.hxtec.polaris.entity.ShopProductSaleAttrValue") @Data -@Table(name = "hx_tec_shop.shop_product_sale_attr_value") +@Table(name = "shop_product_sale_attr_value") public class ShopProductSaleAttrValue implements Serializable { /** * id @@ -25,28 +20,28 @@ public class ShopProductSaleAttrValue implements Serializable { @Id @Column(name = "id") @GeneratedValue(generator = "JDBC") - @ApiModelProperty(value="id") + @ApiModelProperty(value = "id") private Integer id; /** * 商品id */ @Column(name = "product_id") - @ApiModelProperty(value="商品id") + @ApiModelProperty(value = "商品id") private Integer productId; /** * 销售属性id */ @Column(name = "sale_attr_id") - @ApiModelProperty(value="销售属性id") + @ApiModelProperty(value = "销售属性id") private Integer saleAttrId; /** * 销售属性值名称 */ @Column(name = "sale_attr_value_name") - @ApiModelProperty(value="销售属性值名称") + @ApiModelProperty(value = "销售属性值名称") private String saleAttrValueName; @Transient diff --git a/src/main/java/com/hxtec/polaris/entity/ShopProductVariant.java b/src/main/java/com/hxtec/polaris/entity/ShopProductVariant.java index 57bfdc8..73410de 100644 --- a/src/main/java/com/hxtec/polaris/entity/ShopProductVariant.java +++ b/src/main/java/com/hxtec/polaris/entity/ShopProductVariant.java @@ -2,37 +2,28 @@ package com.hxtec.polaris.entity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.Transient; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; import java.util.List; +import javax.persistence.*; +import lombok.Data; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ @ApiModel(value = "com.hxtec.polaris.entity.ShopProductVariant") @Data -@Table(name = "hx_tec_shop.shop_product_variant") +@Table(name = "shop_product_variant") public class ShopProductVariant implements Serializable { - @Transient - List skuImageList; - @Transient - List skuSaleAttrValueList; /** - * 商品sku主键 + * 商品sku */ - @ApiModelProperty(value = "商品sku主键") @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "sku") + @GeneratedValue(generator = "JDBC") + @ApiModelProperty(value = "商品sku") private Integer sku; /** @@ -43,19 +34,26 @@ public class ShopProductVariant implements Serializable { private Integer spu; /** - * 商品价格 + * 商品原价 */ @Column(name = "price") - @ApiModelProperty(value = "商品价格") + @ApiModelProperty(value = "商品原价") private BigDecimal price; + /** + * 商品折扣价 + */ + @Column(name = "discount_price") + @ApiModelProperty(value = "商品折扣价") + private BigDecimal discountPrice; + + /** + * 折扣 + */ @Column(name = "discount") @ApiModelProperty(value = "折扣") private String discount; - @Column(name = "discount_price") - @ApiModelProperty(value = "折扣价") - private BigDecimal discountPrice; /** * 图片 */ @@ -126,5 +124,11 @@ public class ShopProductVariant implements Serializable { @ApiModelProperty(value = "备用字段3") private String comment3; + @Transient + List skuSaleAttrValueList; + + @Transient + List skuImageList; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/entity/ShopProductVariantAttrValue.java b/src/main/java/com/hxtec/polaris/entity/ShopProductVariantAttrValue.java index cd9695f..4e572ed 100644 --- a/src/main/java/com/hxtec/polaris/entity/ShopProductVariantAttrValue.java +++ b/src/main/java/com/hxtec/polaris/entity/ShopProductVariantAttrValue.java @@ -2,21 +2,17 @@ package com.hxtec.polaris.entity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; import java.io.Serializable; +import javax.persistence.*; +import lombok.Data; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ -@ApiModel(value="com.hxtec.polaris.entity.ShopProductVariantAttrValue") +@ApiModel(value = "com.hxtec.polaris.entity.ShopProductVariantAttrValue") @Data -@Table(name = "hx_tec_shop.shop_product_variant_attr_value") +@Table(name = "shop_product_variant_attr_value") public class ShopProductVariantAttrValue implements Serializable { /** * 编号 @@ -24,29 +20,43 @@ public class ShopProductVariantAttrValue implements Serializable { @Id @Column(name = "id") @GeneratedValue(generator = "JDBC") - @ApiModelProperty(value="编号") + @ApiModelProperty(value = "编号") private Integer id; /** * 属性id */ @Column(name = "attr_id") - @ApiModelProperty(value="属性id") + @ApiModelProperty(value = "属性id") private Integer attrId; /** * 属性值id */ @Column(name = "value_id") - @ApiModelProperty(value="属性值id") + @ApiModelProperty(value = "属性值id") private Integer valueId; /** * skuid */ @Column(name = "sku_id") - @ApiModelProperty(value="skuid") + @ApiModelProperty(value = "skuid") private Integer skuId; + /** + * 销售属性名称 + */ + @Column(name = "sale_attr_name") + @ApiModelProperty(value = "销售属性名称") + private String saleAttrName; + + /** + * 销售属性值名称 + */ + @Column(name = "sale_attr_value_name") + @ApiModelProperty(value = "销售属性值名称") + private String saleAttrValueName; + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/entity/ShopProductVariantImage.java b/src/main/java/com/hxtec/polaris/entity/ShopProductVariantImage.java index e160210..900c436 100644 --- a/src/main/java/com/hxtec/polaris/entity/ShopProductVariantImage.java +++ b/src/main/java/com/hxtec/polaris/entity/ShopProductVariantImage.java @@ -2,21 +2,17 @@ package com.hxtec.polaris.entity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.Id; -import javax.persistence.Table; import java.io.Serializable; +import javax.persistence.*; +import lombok.Data; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ -@ApiModel(value="com.hxtec.polaris.entity.ShopProductVariantImage") +@ApiModel(value = "com.hxtec.polaris.entity.ShopProductVariantImage") @Data -@Table(name = "hx_tec_shop.shop_product_variant_image") +@Table(name = "shop_product_variant_image") public class ShopProductVariantImage implements Serializable { /** * 编号 @@ -24,42 +20,42 @@ public class ShopProductVariantImage implements Serializable { @Id @Column(name = "id") @GeneratedValue(generator = "JDBC") - @ApiModelProperty(value="编号") - private Long id; + @ApiModelProperty(value = "编号") + private Integer id; /** * 商品id */ @Column(name = "sku_id") - @ApiModelProperty(value="商品id") - private Long skuId; + @ApiModelProperty(value = "商品id") + private Integer skuId; /** * 图片名称 */ @Column(name = "img_name") - @ApiModelProperty(value="图片名称") + @ApiModelProperty(value = "图片名称") private String imgName; /** * 图片路径 */ @Column(name = "img_url") - @ApiModelProperty(value="图片路径") + @ApiModelProperty(value = "图片路径") private String imgUrl; /** * 商品图片id */ @Column(name = "product_img_id") - @ApiModelProperty(value="商品图片id") - private Long productImgId; + @ApiModelProperty(value = "商品图片id") + private Integer productImgId; /** * 是否默认 */ @Column(name = "is_default") - @ApiModelProperty(value="是否默认") + @ApiModelProperty(value = "是否默认") private String isDefault; private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/hxtec/polaris/entity/ShopStock.java b/src/main/java/com/hxtec/polaris/entity/ShopStock.java index 5a6246b..f516672 100644 --- a/src/main/java/com/hxtec/polaris/entity/ShopStock.java +++ b/src/main/java/com/hxtec/polaris/entity/ShopStock.java @@ -9,7 +9,7 @@ import lombok.Data; /** * @author Caps - * @date 2019/11/23 + * @date 2019/11/29 */ @ApiModel(value = "com.hxtec.polaris.entity.ShopStock") @Data diff --git a/src/main/java/com/hxtec/polaris/entity/ShopUser.java b/src/main/java/com/hxtec/polaris/entity/ShopUser.java index e9b8ed5..95692a6 100644 --- a/src/main/java/com/hxtec/polaris/entity/ShopUser.java +++ b/src/main/java/com/hxtec/polaris/entity/ShopUser.java @@ -1,106 +1,140 @@ package com.hxtec.polaris.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import java.util.Date; +import javax.persistence.*; + import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import javax.persistence.Column; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; -import java.util.Date; - -@Table(name = "hx_tec_shop.shop_user") +/** + * @author Caps + * @date 2019/11/28 + */ +@ApiModel(value="com.hxtec.polaris.entity.ShopUser") +@Data @Builder @AllArgsConstructor @NoArgsConstructor -@Data -public class ShopUser { +@Table(name = "shop_user") +public class ShopUser implements Serializable { /** * 用户表主键 */ @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private int id; + @Column(name = "id") + @GeneratedValue(generator = "JDBC") + @ApiModelProperty(value="用户表主键") + private Integer id; /** * 微信id */ @Column(name = "wx_id") + @ApiModelProperty(value="微信id") private String wxId; /** * 手机号码 */ + @Column(name = "mobile") + @ApiModelProperty(value="手机号码") private String mobile; /** * 用户名 */ + @Column(name = "username") + @ApiModelProperty(value="用户名") private String username; /** * 昵称 */ + @Column(name = "nickname") + @ApiModelProperty(value="昵称") private String nickname; /** * 头像 */ + @Column(name = "portrait") + @ApiModelProperty(value="头像") private String portrait; /** * 密码 */ + @Column(name = "`password`") + @ApiModelProperty(value="密码") private String password; /** * 性别 */ + @Column(name = "gender") + @ApiModelProperty(value="性别") private String gender; /** * 创建时间 */ @Column(name = "create_time") + @ApiModelProperty(value="创建时间") private Date createTime; /** * 更新时间 */ @Column(name = "update_time") + @ApiModelProperty(value="更新时间") private Date updateTime; /** * 生日 */ + @Column(name = "birthday") + @ApiModelProperty(value="生日") private Date birthday; /** * 用户状态 */ + @Column(name = "`state`") + @ApiModelProperty(value="用户状态") private String state; /** * 是否被删除(Y是/N否) */ @Column(name = "is_delete") + @ApiModelProperty(value="是否被删除(Y是/N否)") private String isDelete; /** * 备用字段1 */ + @Column(name = "comment1") + @ApiModelProperty(value="备用字段1") private String comment1; /** * 备用字段2 */ + @Column(name = "comment2") + @ApiModelProperty(value="备用字段2") private String comment2; /** * 备用字段3 */ + @Column(name = "comment3") + @ApiModelProperty(value="备用字段3") private String comment3; + + private static final long serialVersionUID = 1L; } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopCartItemMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopCartItemMapper.java index 2c432db..7c6ef45 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopCartItemMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopCartItemMapper.java @@ -5,7 +5,7 @@ import tk.mybatis.mapper.MyMapper; /** * @author Caps - * @date 2019/11/25 + * @date 2019/11/29 */ public interface ShopCartItemMapper extends MyMapper { } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopOrderDetailMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopOrderItemMapper.java similarity index 30% rename from src/main/java/com/hxtec/polaris/mapper/ShopOrderDetailMapper.java rename to src/main/java/com/hxtec/polaris/mapper/ShopOrderItemMapper.java index 2f013c6..4066817 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopOrderDetailMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopOrderItemMapper.java @@ -1,7 +1,11 @@ package com.hxtec.polaris.mapper; -import com.hxtec.polaris.entity.ShopOrderDetail; +import com.hxtec.polaris.entity.ShopOrderItem; import tk.mybatis.mapper.MyMapper; -public interface ShopOrderDetailMapper extends MyMapper { +/** + * @author Caps + * @date 2019/12/2 + */ +public interface ShopOrderItemMapper extends MyMapper { } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopOrderMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopOrderMapper.java index c40ac54..3da274b 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopOrderMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopOrderMapper.java @@ -3,5 +3,9 @@ package com.hxtec.polaris.mapper; import com.hxtec.polaris.entity.ShopOrder; import tk.mybatis.mapper.MyMapper; +/** + * @author Caps + * @date 2019/12/2 + */ public interface ShopOrderMapper extends MyMapper { } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopProductBaseMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopProductBaseMapper.java index 3f98171..6989d05 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopProductBaseMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopProductBaseMapper.java @@ -1,52 +1,56 @@ package com.hxtec.polaris.mapper; import com.hxtec.polaris.entity.ShopProductBase; -import org.apache.ibatis.annotations.Param; -import tk.mybatis.mapper.MyMapper; - -import java.util.List; -import java.util.Map; +import org.apache.ibatis.annotations.Param;import tk.mybatis.mapper.MyMapper;import java.util.List;import java.util.Map; +/** + * @author Caps + * @date 2019/11/29 + */ public interface ShopProductBaseMapper extends MyMapper { - /** * 分页获取商品 + * * @param start * @param rows * @param order 1 综合排序(weight降序) 2销量优先(降序) 3价格(price升序)4价格(price降序) * @return */ - List> getAllGoods(@Param("start") Integer start, @Param("rows") Integer rows, @Param("order") String order); + List> getAllGoods(@Param("start") Integer start, @Param("rows") Integer rows, @Param("order") String order); /** - * 获取猜你喜欢数据 + * 获取猜你喜欢数据 + * * @param start * @param rows * @return */ - List> getGuessLikeGoods(@Param("start") Integer start, @Param("rows") Integer rows, @Param("order") String order); + List> getGuessLikeGoods(@Param("start") Integer start, @Param("rows") Integer rows, @Param("order") String order); /** - * 获取分类精选数据 + * 获取分类精选数据 + * * @param start * @param rows * @return */ - List> getClassifiedSelectGoods(@Param("start") Integer start, @Param("rows") Integer rows); + List> getClassifiedSelectGoods(@Param("start") Integer start, @Param("rows") Integer rows); /** * 获取某个分类下的商品列表 + * * @param start * @param rows * @return */ - List> getTargrtGroupGoods(@Param("start") Integer start, @Param("rows") Integer rows,@Param("cid")String cid, @Param("order") String order); + List> getTargrtGroupGoods(@Param("start") Integer start, @Param("rows") Integer rows, @Param("cid") String cid, @Param("order") String order); /** * 获取某个分类下的商品列表总数 + * * @param start * @param rows * @return */ - List> getTargrtGroupGoodsCount(@Param("start") Integer start, @Param("rows") Integer rows,@Param("cid")String cid, @Param("order") String order); + List> getTargrtGroupGoodsCount(@Param("start") Integer start, @Param("rows") Integer rows, @Param("cid") String cid, @Param("order") String order); } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopProductImageMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopProductImageMapper.java index 1edc7cb..913c304 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopProductImageMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopProductImageMapper.java @@ -5,7 +5,7 @@ import tk.mybatis.mapper.MyMapper; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ public interface ShopProductImageMapper extends MyMapper { } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopProductSaleAttrMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopProductSaleAttrMapper.java index 173f954..de86597 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopProductSaleAttrMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopProductSaleAttrMapper.java @@ -1,15 +1,12 @@ package com.hxtec.polaris.mapper; import com.hxtec.polaris.entity.ShopProductSaleAttr; -import org.apache.ibatis.annotations.Param; -import tk.mybatis.mapper.MyMapper; - -import java.util.List; +import org.apache.ibatis.annotations.Param;import tk.mybatis.mapper.MyMapper;import java.util.List; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ public interface ShopProductSaleAttrMapper extends MyMapper { - List selectSpuSaleAttrListCheckBySku(@Param("spu") Integer spu, @Param("sku")Integer sku); + List selectSpuSaleAttrListCheckBySku(@Param("spu") Integer spu, @Param("sku") Integer sku); } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopProductSaleAttrValueMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopProductSaleAttrValueMapper.java index f57ccee..40f8b64 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopProductSaleAttrValueMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopProductSaleAttrValueMapper.java @@ -5,7 +5,7 @@ import tk.mybatis.mapper.MyMapper; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ public interface ShopProductSaleAttrValueMapper extends MyMapper { } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantAttrValueMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantAttrValueMapper.java index 52e31ce..645e2e2 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantAttrValueMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantAttrValueMapper.java @@ -1,11 +1,12 @@ package com.hxtec.polaris.mapper; import com.hxtec.polaris.entity.ShopProductVariantAttrValue; -import tk.mybatis.mapper.MyMapper; +import org.apache.ibatis.annotations.Param;import tk.mybatis.mapper.MyMapper;import java.util.List; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ public interface ShopProductVariantAttrValueMapper extends MyMapper { + List selectSkuSaleAttrValueBySku(@Param("sku") Integer sku); } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantImageMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantImageMapper.java index 26b84f3..cfb7951 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantImageMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantImageMapper.java @@ -5,7 +5,7 @@ import tk.mybatis.mapper.MyMapper; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ public interface ShopProductVariantImageMapper extends MyMapper { } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantMapper.java index fe0b616..636985c 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopProductVariantMapper.java @@ -1,14 +1,11 @@ package com.hxtec.polaris.mapper; import com.hxtec.polaris.entity.ShopProductVariant; -import tk.mybatis.mapper.MyMapper; - -import java.util.List; -import java.util.Map; +import tk.mybatis.mapper.MyMapper;import java.util.List;import java.util.Map; /** * @author Caps - * @date 2019/11/17 + * @date 2019/11/29 */ public interface ShopProductVariantMapper extends MyMapper { Map getProductInfoBySku(Integer sku); diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopStockMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopStockMapper.java index da10b73..97d08d7 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopStockMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopStockMapper.java @@ -5,7 +5,7 @@ import tk.mybatis.mapper.MyMapper; /** * @author Caps - * @date 2019/11/23 + * @date 2019/11/29 */ public interface ShopStockMapper extends MyMapper { } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/mapper/ShopUserMapper.java b/src/main/java/com/hxtec/polaris/mapper/ShopUserMapper.java index f2a2151..46c4766 100644 --- a/src/main/java/com/hxtec/polaris/mapper/ShopUserMapper.java +++ b/src/main/java/com/hxtec/polaris/mapper/ShopUserMapper.java @@ -3,5 +3,9 @@ package com.hxtec.polaris.mapper; import com.hxtec.polaris.entity.ShopUser; import tk.mybatis.mapper.MyMapper; +/** + * @author Caps + * @date 2019/11/28 + */ public interface ShopUserMapper extends MyMapper { } \ No newline at end of file diff --git a/src/main/java/com/hxtec/polaris/service/CartItemService.java b/src/main/java/com/hxtec/polaris/service/CartItemService.java index 82fd637..a8d0f46 100644 --- a/src/main/java/com/hxtec/polaris/service/CartItemService.java +++ b/src/main/java/com/hxtec/polaris/service/CartItemService.java @@ -21,7 +21,5 @@ public interface CartItemService { Map addTocart(int sku, int quantity); List getCartList(); - - List combineCart(List cartItemList); } diff --git a/src/main/java/com/hxtec/polaris/service/ProductService.java b/src/main/java/com/hxtec/polaris/service/ProductService.java index 3323130..3a663fd 100644 --- a/src/main/java/com/hxtec/polaris/service/ProductService.java +++ b/src/main/java/com/hxtec/polaris/service/ProductService.java @@ -2,7 +2,10 @@ package com.hxtec.polaris.service; import com.hxtec.polaris.entity.ShopProductBase; import com.hxtec.polaris.entity.ShopProductSaleAttr; +import com.hxtec.polaris.entity.ShopProductSaleAttrValue; import com.hxtec.polaris.entity.ShopProductVariant; +import com.hxtec.polaris.entity.ShopProductVariantAttrValue; +import io.swagger.models.auth.In; import java.util.List; @@ -18,4 +21,7 @@ public interface ProductService { List getSkuSaleAttrValueListBySpu(Integer spu); ShopProductBase getSpuInfoBySpu(Integer spu); + + List getSkuSaleAttrValueBySku(Integer sku); + } diff --git a/src/main/java/com/hxtec/polaris/service/ShopOrderItemService.java b/src/main/java/com/hxtec/polaris/service/ShopOrderItemService.java new file mode 100644 index 0000000..3338a96 --- /dev/null +++ b/src/main/java/com/hxtec/polaris/service/ShopOrderItemService.java @@ -0,0 +1,10 @@ +package com.hxtec.polaris.service; + + /** + * @author Caps + * @date 2019/12/2 + */ +public interface ShopOrderItemService{ + + +} diff --git a/src/main/java/com/hxtec/polaris/service/ShopOrderService.java b/src/main/java/com/hxtec/polaris/service/ShopOrderService.java new file mode 100644 index 0000000..97cd12c --- /dev/null +++ b/src/main/java/com/hxtec/polaris/service/ShopOrderService.java @@ -0,0 +1,10 @@ +package com.hxtec.polaris.service; + + /** + * @author Caps + * @date 2019/12/2 + */ +public interface ShopOrderService{ + + +} diff --git a/src/main/java/com/hxtec/polaris/service/StockService.java b/src/main/java/com/hxtec/polaris/service/StockService.java index 300d4d3..40a8cdf 100644 --- a/src/main/java/com/hxtec/polaris/service/StockService.java +++ b/src/main/java/com/hxtec/polaris/service/StockService.java @@ -7,7 +7,7 @@ import com.hxtec.polaris.entity.ShopStock; * @date 2019/11/23 */ public interface StockService { - ShopStock getStockInfoBuSku(Integer sku); + ShopStock getStockInfoBuSku(int sku); void updateStockInfoBySku(int sku); } diff --git a/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java index 89a4e32..cea4647 100644 --- a/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java +++ b/src/main/java/com/hxtec/polaris/service/impl/CartItemServiceImpl.java @@ -1,11 +1,15 @@ package com.hxtec.polaris.service.impl; +import com.hxtec.polaris.commons.MapperUtils; import com.hxtec.polaris.commons.contants.CommonContants; import com.hxtec.polaris.entity.ShopCartItem; import com.hxtec.polaris.entity.ShopProductBase; import com.hxtec.polaris.entity.ShopProductVariant; +import com.hxtec.polaris.entity.ShopProductVariantAttrValue; +import com.hxtec.polaris.entity.ShopStock; import com.hxtec.polaris.entity.ShopUser; import com.hxtec.polaris.service.ProductService; +import com.hxtec.polaris.service.StockService; import com.hxtec.polaris.service.UserService; import org.apache.commons.lang3.StringUtils; import org.springframework.security.core.context.SecurityContextHolder; @@ -39,9 +43,13 @@ public class CartItemServiceImpl implements CartItemService { @Resource private UserService userService; + @Resource + private StockService stockService; + @Override public Map addTocart(int sku, int quantity) { - String phone = this.getUser(); +// String phone = this.getUser(); + String phone="12345678900"; Map map=new HashMap<>(); //未登录 if(StringUtils.equals("anonymousUser",phone)){ @@ -51,6 +59,13 @@ public class CartItemServiceImpl implements CartItemService { } ShopProductVariant skuInfo = productService.getSkuProductBySku(sku); ShopProductBase spuInfo=productService.getSpuInfoBySpu(skuInfo.getSpu()); + List skuSaleAttrValueBySku = productService.getSkuSaleAttrValueBySku(sku); + StringBuilder skuSaleAttr= new StringBuilder(); + for (ShopProductVariantAttrValue variantAttrValue : skuSaleAttrValueBySku) { + String skuSale = variantAttrValue.getSaleAttrName() +":"+ variantAttrValue.getSaleAttrValueName() + "|"; + skuSaleAttr.append(skuSale); + } + String substring = skuSaleAttr.substring(0, skuSaleAttr.length() - 1); ShopCartItem cartItem= ShopCartItem.builder() .quantity(quantity) .createTime(new Date()) @@ -62,8 +77,10 @@ public class CartItemServiceImpl implements CartItemService { .productSkuId(skuInfo.getSku()) .productPic(skuInfo.getImage()) .productSubTitle(skuInfo.getDescription()) - .productAttr("1111111").build(); + .productAttr(substring).build(); + ShopStock stockInfo = stockService.getStockInfoBuSku(skuInfo.getSku()); + cartItem.setStock(stockInfo.getAvailable()); if (StringUtils.isNotEmpty(skuInfo.getDiscount())){ cartItem.setPrice(skuInfo.getDiscountPrice()); } @@ -73,7 +90,7 @@ public class CartItemServiceImpl implements CartItemService { ShopUser userInfo=userService.getUserInfoByPhone(phone); ShopCartItem shopCartItem=this.ifCartExistByUser(userInfo.getId(),sku); - int i; + Integer i; if(null ==shopCartItem){ //沒有加过 cartItem.setMemberId(userInfo.getId()); @@ -82,9 +99,14 @@ public class CartItemServiceImpl implements CartItemService { } else { shopCartItem.setQuantity(shopCartItem.getQuantity()+quantity); - i=this.updateCart(cartItem); + i=this.updateCart(shopCartItem); + } + if(i.equals(1)){ + map.put(CommonContants.STATUS,"success"); + } + else { + map.put(CommonContants.STATUS,"updateError"); } - map.put(CommonContants.STATUS,"success"); map.put(CommonContants.COUNTS,i); return map; } @@ -95,44 +117,20 @@ public class CartItemServiceImpl implements CartItemService { */ @Override public List getCartList() { +/* String phone = this.getUser(); +*/ + String phone="12345678900"; List cartList=new ArrayList<>(); if(!StringUtils.equals("anonymousUser",phone)){ - ShopCartItem cartItem=new ShopCartItem(); ShopUser userInfo=userService.getUserInfoByPhone(phone); - cartItem.setMemberId(userInfo.getId()); - cartList = cartItemMapper.select(cartItem); + Example example=new Example(ShopCartItem.class); + example.createCriteria().andEqualTo("memberId",userInfo.getId()); + cartList = cartItemMapper.selectByExample(example); } return cartList; } - /** - * 合并购物车 - * @param cartItemList - * @return - */ - @Override - public List combineCart(List cartItemList) { - List cartList = this.getCartList(); - cartItemList.forEach( - cartItem->{ - //数据库有,合并购物车数据 - if(if_cart_exist(cartList,cartItem)){ - for (ShopCartItem shopitem:cartList) { - if(shopitem.getProductSkuId().equals(cartItem.getProductSkuId())){ - cartItem.setQuantity(shopitem.getQuantity()+cartItem.getQuantity()); - } - } - } - //数据库没有,新增当前购物车 - else { - this.insertTocart(cartItem); - } - } - ); - //获取最新的购物车列表 - return this.getCartList(); - } private String getUser(){ return SecurityContextHolder.getContext().getAuthentication().getName(); diff --git a/src/main/java/com/hxtec/polaris/service/impl/ProductServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/ProductServiceImpl.java index 1854159..0ca185b 100644 --- a/src/main/java/com/hxtec/polaris/service/impl/ProductServiceImpl.java +++ b/src/main/java/com/hxtec/polaris/service/impl/ProductServiceImpl.java @@ -2,9 +2,14 @@ package com.hxtec.polaris.service.impl; import com.hxtec.polaris.entity.ShopProductBase; import com.hxtec.polaris.entity.ShopProductSaleAttr; +import com.hxtec.polaris.entity.ShopProductSaleAttrValue; import com.hxtec.polaris.entity.ShopProductVariant; +import com.hxtec.polaris.entity.ShopProductVariantAttrValue; import com.hxtec.polaris.entity.ShopProductVariantImage; +import com.hxtec.polaris.mapper.ShopProductBaseMapper; import com.hxtec.polaris.mapper.ShopProductSaleAttrMapper; +import com.hxtec.polaris.mapper.ShopProductSaleAttrValueMapper; +import com.hxtec.polaris.mapper.ShopProductVariantAttrValueMapper; import com.hxtec.polaris.mapper.ShopProductVariantImageMapper; import com.hxtec.polaris.mapper.ShopProductVariantMapper; import com.hxtec.polaris.service.ProductService; @@ -22,7 +27,10 @@ import java.util.List; public class ProductServiceImpl implements ProductService { @Autowired - private ShopProductVariantMapper productMapper; + private ShopProductVariantMapper skuMapper; + + @Autowired + private ShopProductBaseMapper spumapper; @Autowired private ShopProductSaleAttrMapper productSaleAttrMapper; @@ -30,9 +38,12 @@ public class ProductServiceImpl implements ProductService { @Autowired private ShopProductVariantImageMapper imageMapper; + @Autowired + private ShopProductVariantAttrValueMapper variantAttrValueMapper; + @Override public ShopProductVariant getSkuProductBySku(Integer sku) { - ShopProductVariant shopProductVariant = productMapper.selectByPrimaryKey(sku); + ShopProductVariant shopProductVariant = skuMapper.selectByPrimaryKey(sku); Example example=new Example(ShopProductVariantImage.class); example.createCriteria().andEqualTo("skuId",sku); List shopProductVariantImages = imageMapper.selectByExample(example); @@ -48,11 +59,16 @@ public class ProductServiceImpl implements ProductService { @Override public List getSkuSaleAttrValueListBySpu(Integer spu) { - return productMapper.selectSkuSaleAttrValueListBySpu(spu); + return skuMapper.selectSkuSaleAttrValueListBySpu(spu); } @Override public ShopProductBase getSpuInfoBySpu(Integer spu) { - return null; + return spumapper.selectByPrimaryKey(spu); + } + + @Override + public List getSkuSaleAttrValueBySku(Integer sku) { + return variantAttrValueMapper.selectSkuSaleAttrValueBySku(sku); } } diff --git a/src/main/java/com/hxtec/polaris/service/impl/ShopOrderItemServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/ShopOrderItemServiceImpl.java new file mode 100644 index 0000000..4788dd0 --- /dev/null +++ b/src/main/java/com/hxtec/polaris/service/impl/ShopOrderItemServiceImpl.java @@ -0,0 +1,17 @@ +package com.hxtec.polaris.service.impl; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import com.hxtec.polaris.mapper.ShopOrderItemMapper; +import com.hxtec.polaris.service.ShopOrderItemService; +/** + * @author Caps + * @date 2019/12/2 + */ +@Service +public class ShopOrderItemServiceImpl implements ShopOrderItemService{ + + @Resource + private ShopOrderItemMapper shopOrderItemMapper; + +} diff --git a/src/main/java/com/hxtec/polaris/service/impl/ShopOrderServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/ShopOrderServiceImpl.java new file mode 100644 index 0000000..4dd909b --- /dev/null +++ b/src/main/java/com/hxtec/polaris/service/impl/ShopOrderServiceImpl.java @@ -0,0 +1,17 @@ +package com.hxtec.polaris.service.impl; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import com.hxtec.polaris.mapper.ShopOrderMapper; +import com.hxtec.polaris.service.ShopOrderService; +/** + * @author Caps + * @date 2019/12/2 + */ +@Service +public class ShopOrderServiceImpl implements ShopOrderService{ + + @Resource + private ShopOrderMapper shopOrderMapper; + +} diff --git a/src/main/java/com/hxtec/polaris/service/impl/StockServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/StockServiceImpl.java index 6a6082e..50028c5 100644 --- a/src/main/java/com/hxtec/polaris/service/impl/StockServiceImpl.java +++ b/src/main/java/com/hxtec/polaris/service/impl/StockServiceImpl.java @@ -21,7 +21,7 @@ public class StockServiceImpl implements StockService { * @return */ @Override - public ShopStock getStockInfoBuSku(Integer sku) { + public ShopStock getStockInfoBuSku(int sku) { ShopStock shopStock=new ShopStock(); shopStock.setSku(sku); return shopStockMapper.selectOne(shopStock); diff --git a/src/main/java/com/hxtec/polaris/service/impl/UserServiceImpl.java b/src/main/java/com/hxtec/polaris/service/impl/UserServiceImpl.java index 96cd84a..91bccaf 100644 --- a/src/main/java/com/hxtec/polaris/service/impl/UserServiceImpl.java +++ b/src/main/java/com/hxtec/polaris/service/impl/UserServiceImpl.java @@ -54,9 +54,9 @@ public class UserServiceImpl implements UserService { @Override public ShopUser getUserInfoByPhone(String phone) { - ShopUser user=new ShopUser(); - user.setMobile(phone); - return shopUserMapper.selectOne(user); + Example example=new Example(ShopUser.class); + example.createCriteria().andEqualTo("mobile",phone); + return shopUserMapper.selectOneByExample(example); } @Override diff --git a/src/main/resources/mapper/ShopCartItemMapper.xml b/src/main/resources/mapper/ShopCartItemMapper.xml index ccc0c17..101fb8f 100644 --- a/src/main/resources/mapper/ShopCartItemMapper.xml +++ b/src/main/resources/mapper/ShopCartItemMapper.xml @@ -2,26 +2,27 @@ - + - - - + + + + - + - - id, product_id, product_sku_id, member_id, quantity, price, product_pic, product_name, + + id, product_id, product_sku_id, member_id, quantity, price, product_pic, stock, product_name, product_sub_title, member_nickname, create_time, update_time, delete_status, product_category_id, product_attr diff --git a/src/main/resources/mapper/ShopOrderDetailMapper.xml b/src/main/resources/mapper/ShopOrderDetailMapper.xml deleted file mode 100644 index 977f3f1..0000000 --- a/src/main/resources/mapper/ShopOrderDetailMapper.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/mapper/ShopOrderItemMapper.xml b/src/main/resources/mapper/ShopOrderItemMapper.xml new file mode 100644 index 0000000..6cb9bf7 --- /dev/null +++ b/src/main/resources/mapper/ShopOrderItemMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + id, order_id, product_id, product_pic, product_name, product_introduce, product_price, + product_quantity, product_sku_id, product_category_id, product_attr, weight, is_delete + + \ No newline at end of file diff --git a/src/main/resources/mapper/ShopOrderMapper.xml b/src/main/resources/mapper/ShopOrderMapper.xml index 400bb88..f7e2485 100644 --- a/src/main/resources/mapper/ShopOrderMapper.xml +++ b/src/main/resources/mapper/ShopOrderMapper.xml @@ -2,26 +2,35 @@ - - - + + + + - + + + + + + + - - - - - + + + + + id, member_id, order_code, total_price, freight_amount, pay_type, pay_amount, `state`, + is_delete, delivery_company, delivery_code, receiver_name, receiver_phone, receiver_post_code, + province, city, region, address_detail, create_time, update_time, auto_confirm_day, + confirm_status + \ No newline at end of file diff --git a/src/main/resources/mapper/ShopProductBaseMapper.xml b/src/main/resources/mapper/ShopProductBaseMapper.xml index cf1db9c..700df65 100644 --- a/src/main/resources/mapper/ShopProductBaseMapper.xml +++ b/src/main/resources/mapper/ShopProductBaseMapper.xml @@ -2,22 +2,25 @@ - - - + + + + - + + + spu, category_id, `name`, detail, create_time, update_time, weight, comment1, comment2, + comment3 + - + pb.spu,pb.comment2,pb.category_id,pb.name,pv.image,pv.price,pv.sku @@ -28,20 +31,20 @@ left join shop_product_base pb on pv.spu=pb.spu group by pb.spu - + order by pb.weight desc - + order by pb.comment2*1 desc - + order by pv.price asc - + order by pv.price desc - + limit #{start},#{rows} @@ -54,21 +57,21 @@ group by pb.spu order by - + pb.weight desc, - + pb.comment2*1 desc, - + pv.price asc, - + pv.price desc, pb.weight desc - + limit #{start},#{rows} @@ -87,7 +90,7 @@ ORDER BY pb.weight DESC ) aa GROUP BY aa.category_id - + limit #{start},#{rows} @@ -105,21 +108,21 @@ group by pb.spu order by - + pb.weight desc, - + pb.comment2*1 desc, - + pv.price asc, - + pv.price desc, pb.weight desc - + limit #{start},#{rows} @@ -137,16 +140,16 @@ group by pb.spu order by - + pb.weight desc, - + pb.comment2*1 desc, - + pv.price asc, - + pv.price desc, diff --git a/src/main/resources/mapper/ShopProductImageMapper.xml b/src/main/resources/mapper/ShopProductImageMapper.xml index a193148..9b5b321 100644 --- a/src/main/resources/mapper/ShopProductImageMapper.xml +++ b/src/main/resources/mapper/ShopProductImageMapper.xml @@ -2,14 +2,14 @@ - - - + + + - + id, product_id, img_name, img_url \ No newline at end of file diff --git a/src/main/resources/mapper/ShopProductSaleAttrMapper.xml b/src/main/resources/mapper/ShopProductSaleAttrMapper.xml index 790d339..1f8c9c7 100644 --- a/src/main/resources/mapper/ShopProductSaleAttrMapper.xml +++ b/src/main/resources/mapper/ShopProductSaleAttrMapper.xml @@ -2,14 +2,14 @@ - - - - + + + + - + id, product_id, sale_attr_id, sale_attr_name @@ -29,10 +29,10 @@ - - - - + + + + diff --git a/src/main/resources/mapper/ShopProductSaleAttrValueMapper.xml b/src/main/resources/mapper/ShopProductSaleAttrValueMapper.xml index e213314..0f18d83 100644 --- a/src/main/resources/mapper/ShopProductSaleAttrValueMapper.xml +++ b/src/main/resources/mapper/ShopProductSaleAttrValueMapper.xml @@ -2,14 +2,14 @@ - + - - + + - + id, product_id, sale_attr_id, sale_attr_value_name \ No newline at end of file diff --git a/src/main/resources/mapper/ShopProductVariantAttrValueMapper.xml b/src/main/resources/mapper/ShopProductVariantAttrValueMapper.xml index 3acd086..11316db 100644 --- a/src/main/resources/mapper/ShopProductVariantAttrValueMapper.xml +++ b/src/main/resources/mapper/ShopProductVariantAttrValueMapper.xml @@ -2,14 +2,26 @@ - - - + + + - + + + - - id, attr_id, value_id, sku_id + + id, attr_id, value_id, sku_id, sale_attr_name, sale_attr_value_name + + \ No newline at end of file diff --git a/src/main/resources/mapper/ShopProductVariantImageMapper.xml b/src/main/resources/mapper/ShopProductVariantImageMapper.xml index 3ce6729..4f4fc6e 100644 --- a/src/main/resources/mapper/ShopProductVariantImageMapper.xml +++ b/src/main/resources/mapper/ShopProductVariantImageMapper.xml @@ -2,16 +2,16 @@ - - - + + + - + - + id, sku_id, img_name, img_url, product_img_id, is_default \ No newline at end of file diff --git a/src/main/resources/mapper/ShopProductVariantMapper.xml b/src/main/resources/mapper/ShopProductVariantMapper.xml index 6fb7f04..f65184d 100644 --- a/src/main/resources/mapper/ShopProductVariantMapper.xml +++ b/src/main/resources/mapper/ShopProductVariantMapper.xml @@ -2,13 +2,12 @@ - - - - + + + + + @@ -20,7 +19,6 @@ - sp.`name`,sp.detail,sv.sku,sv.media_container_code as containerCode,sv.price,sv.image,sv.state,sv.attribute_name as attributeName,sv.description, sv.comment1,sv.comment2,sv.comment3 @@ -39,18 +37,19 @@ + diff --git a/src/main/resources/mapper/ShopStockMapper.xml b/src/main/resources/mapper/ShopStockMapper.xml index 26ba4b4..bea7986 100644 --- a/src/main/resources/mapper/ShopStockMapper.xml +++ b/src/main/resources/mapper/ShopStockMapper.xml @@ -2,9 +2,9 @@ - - - + + + @@ -14,7 +14,7 @@ - + id, sku, available, `lock`, create_time, update_time, comment1, comment2, comment3 \ No newline at end of file diff --git a/src/main/resources/mapper/ShopUserMapper.xml b/src/main/resources/mapper/ShopUserMapper.xml index f53dc77..3d7a470 100644 --- a/src/main/resources/mapper/ShopUserMapper.xml +++ b/src/main/resources/mapper/ShopUserMapper.xml @@ -2,9 +2,7 @@ - + @@ -22,4 +20,9 @@ + + + id, wx_id, mobile, username, nickname, portrait, `password`, gender, create_time, + update_time, birthday, `state`, is_delete, comment1, comment2, comment3 + \ No newline at end of file -- Gitee