From ccb35b497df342c6de15f3a6be4c065b0ca7f1f1 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 24 Jun 2021 10:37:53 +0800
Subject: [PATCH] 20210624 商品分类
---
gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsCategoryController.java | 16
gc-shop/src/main/resources/mapper/shop/ScoreGoodsMapper.xml | 37 ++
gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsSkuVo.java | 35 +
gc-shop/src/main/java/com/xzx/gc/shop/vo/QueryGoodsListVo.java | 65 +++
gc-shop/src/main/resources/mapper/shop/ScoreGoodsImagesMapper.xml | 15
gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java | 215 +++++++++++
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsSkuMapper.java | 15
gc-shop/src/main/java/com/xzx/gc/shop/dto/QueryGoodsListDto.java | 19 +
gc-shop/src/main/resources/mapper/shop/ScoreGoodsSkuMapper.xml | 23 +
gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsDto.java | 9
gc-shop/src/main/java/com/xzx/gc/shop/dto/SaleGoodsDto.java | 13
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsMapper.java | 10
gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsCategoryDto.java | 2
gc-shop/src/main/java/com/xzx/gc/shop/vo/ViewGoodsVo.java | 71 +++
gc-core/src/main/java/com/xzx/gc/entity/ScoreGoods.java | 6
gc-shop/src/main/resources/mapper/shop/ScoreGoodsStyleMapper.xml | 21 +
gc-shop/src/main/resources/sql | 6
gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsImages.java | 3
gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsController.java | 185 ++++++++++
gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsCategoryDto.java | 2
gc-shop/src/main/java/com/xzx/gc/shop/dto/SnapUpGoodsDto.java | 22 +
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsStyleMapper.java | 14
gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsStyle.java | 21 +
gc-core/src/main/java/com/xzx/gc/common/entity/BaseEntity.java | 2
gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsDto.java | 64 +++
gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsStyleDto.java | 22 +
gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsSkuDto.java | 33 +
gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsSku.java | 3
gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsStyleVo.java | 23 +
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsImagesMapper.java | 12
gc-shop/src/main/java/com/xzx/gc/shop/dto/AddGoodsDto.java | 64 +++
31 files changed, 1,018 insertions(+), 30 deletions(-)
diff --git a/gc-core/src/main/java/com/xzx/gc/common/entity/BaseEntity.java b/gc-core/src/main/java/com/xzx/gc/common/entity/BaseEntity.java
index c7fb9cc..b323cf5 100644
--- a/gc-core/src/main/java/com/xzx/gc/common/entity/BaseEntity.java
+++ b/gc-core/src/main/java/com/xzx/gc/common/entity/BaseEntity.java
@@ -19,7 +19,7 @@
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdTime;
- private String delFlag;
+ private short delFlag;
private Integer revision;
diff --git a/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoods.java b/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoods.java
index 88f9476..41dae17 100644
--- a/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoods.java
+++ b/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoods.java
@@ -14,7 +14,7 @@
private String goodsNo;
- private String goodsName;
+ private String name;
private String unit;
@@ -30,12 +30,16 @@
* 是否抢购 1-是 2-否
*/
private Integer isQg;
+ public static final Integer ISQG_YES = 1;
+ public static final Integer ISQG_NO = 2;
private Date qgStartTime;
private Date qgEndTime;
private Integer isSale;
+ public static final Integer ISSALE_YES = 1;
+ public static final Integer ISSALE_NO = 2;
private Integer carbonEmissions;
}
diff --git a/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsImages.java b/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsImages.java
index 9bc83ac..2b6670e 100644
--- a/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsImages.java
+++ b/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsImages.java
@@ -11,7 +11,6 @@
private String imageUrl;
- private Integer seq;
-
private Long goodsId;
+
}
diff --git a/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsSku.java b/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsSku.java
index 9926386..cc769c6 100644
--- a/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsSku.java
+++ b/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsSku.java
@@ -1,5 +1,6 @@
package com.xzx.gc.entity;
+import com.xzx.gc.common.entity.BaseEntity;
import lombok.Data;
import javax.persistence.Table;
@@ -7,7 +8,7 @@
@Data
@Table(name = "xzx_score_goods_sku")
-public class ScoreGoodsSku {
+public class ScoreGoodsSku extends BaseEntity {
private String name;
diff --git a/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsStyle.java b/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsStyle.java
index 63a62ff..6200316 100644
--- a/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsStyle.java
+++ b/gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsStyle.java
@@ -1,13 +1,32 @@
package com.xzx.gc.entity;
+import com.fasterxml.jackson.annotation.JsonFormat;
import com.xzx.gc.common.entity.BaseEntity;
import lombok.Data;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
import javax.persistence.Table;
+import java.util.Date;
@Data
@Table(name = "xzx_score_goods_style")
-public class ScoreGoodsStyle extends BaseEntity {
+public class ScoreGoodsStyle{
+
+
+ private String createdBy;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date createdTime;
+
+ private short delFlag;
+
+ private Integer revision;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Long id;
private String name;
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/controller/GoodsController.java b/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsCategoryController.java
similarity index 94%
rename from gc-shop/src/main/java/com/xzx/gc/shop/controller/GoodsController.java
rename to gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsCategoryController.java
index 3ae1d0e..2b589bf 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/controller/GoodsController.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsCategoryController.java
@@ -10,14 +10,10 @@
import com.xzx.gc.entity.ScoreGoodsCategory;
import com.xzx.gc.model.JsonResult;
import com.xzx.gc.model.admin.GoodsCategoryModel;
-import com.xzx.gc.shop.dto.AddGoodsCategoryDto;
-import com.xzx.gc.shop.dto.DeleteGoodsCategoryDto;
-import com.xzx.gc.shop.dto.QueryGoodsCategoryListDto;
-import com.xzx.gc.shop.dto.UpdateGoodsCategoryDto;
+import com.xzx.gc.shop.dto.*;
import com.xzx.gc.shop.mapper.ScoreGoodsCategoryMapper;
import com.xzx.gc.shop.service.GoodsService;
-import com.xzx.gc.shop.vo.QueryGoodsCategoryListVo;
-import com.xzx.gc.shop.vo.ViewGoodsCategoryVo;
+import com.xzx.gc.shop.vo.*;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@@ -29,9 +25,9 @@
import java.util.Map;
@RestController
-@Api(tags = {"积分商城--商品管理"})
+@Api(tags = {"积分商城--商品分类管理"})
@Slf4j
-public class GoodsController extends BaseController {
+public class AdminGoodsCategoryController extends BaseController {
@Resource
private GoodsService goodsService;
@@ -104,7 +100,7 @@
}
goodsService.deleteGoodsCategory(id);
OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
- .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("商品管理-删除添加商品分类-"+id).build();
+ .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("商品管理-删除商品分类-"+id).build();
mqUtil.sendApp(build);
return new JsonResult().success("操作成功!");
}
@@ -172,4 +168,6 @@
}
+
+
}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsController.java b/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsController.java
new file mode 100644
index 0000000..c8cef2e
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsController.java
@@ -0,0 +1,185 @@
+package com.xzx.gc.shop.controller;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.ObjectUtil;
+import com.xzx.gc.common.constant.CommonEnum;
+import com.xzx.gc.common.constant.Constants;
+import com.xzx.gc.common.dto.log.OperationAppLog;
+import com.xzx.gc.common.request.BaseController;
+import com.xzx.gc.entity.ScoreGoods;
+import com.xzx.gc.model.JsonResult;
+import com.xzx.gc.shop.dto.*;
+import com.xzx.gc.shop.mapper.ScoreGoodsMapper;
+import com.xzx.gc.shop.service.GoodsService;
+import com.xzx.gc.shop.vo.QueryGoodsListVo;
+import com.xzx.gc.shop.vo.ViewGoodsVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
+import java.util.Map;
+
+@RestController
+@Api(tags = {"积分商城--商品管理"})
+@Slf4j
+public class AdminGoodsController extends BaseController {
+
+ @Resource
+ private GoodsService goodsService;
+
+ @Resource
+ private ScoreGoodsMapper scoreGoodsMapper;
+ /**
+ * 查询商品列表
+ * xzx_score_goods 积分商品表
+ */
+ @PostMapping(Constants.ADMIN_VIEW_PREFIX+"/score/goods/queryGoodsList.json")
+ @ApiResponses({@ApiResponse( code = 200, message = "success", response = QueryGoodsListVo.class)})
+ @ApiOperation(value = "商品管理-商品列表", notes = "test: 仅0有正确返回")
+ public JsonResult<Map<String, Object>> queryGoodsList(@RequestBody QueryGoodsListDto model) {
+ Map<String, Object> result = goodsService.queryGoodsList(model);
+ return JsonResult.success(result);
+ }
+
+ /**
+ * 添加商品
+ */
+ @PostMapping(Constants.ADMIN_VIEW_PREFIX+"/score/goods/addGoods.json")
+ @ApiOperation(value = "商品管理-添加商品", notes = "test: 仅0有正确返回")
+ public JsonResult<String> addGoods(@RequestBody AddGoodsDto model, HttpServletRequest request) {
+
+ model.setCreatedBy(getAdminName(request));
+ model.setCreatedTime(new Date());
+ Long scoreGoodsId = goodsService.addGoods(model);
+ if(scoreGoodsId > 0){
+ OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
+ .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("商品管理-添加商品-" + scoreGoodsId).build();
+ mqUtil.sendApp(build);
+ return JsonResult.success("操作成功!");
+ }else{
+ return JsonResult.failMessage("操作失败!");
+ }
+ }
+
+ /**
+ * 删除商品
+ */
+
+ @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/score/goods/deleteGoods.json")
+ @ApiOperation(value="商品管理-删除商品", notes="test: 仅0有正确返回")
+ public JsonResult deleteGoods(@RequestBody DeleteGoodsDto model, HttpServletRequest request) {
+ long id = model.getId();
+ ScoreGoods scoreGoods = scoreGoodsMapper.selectByPrimaryKey(id);
+ if(ObjectUtil.isEmpty(scoreGoods)){
+ return JsonResult.failMessage("商品不存在!");
+ }
+ //下架商品才能删除
+ Integer isSale = scoreGoods.getIsSale();
+ if(ScoreGoods.ISSALE_YES == isSale){
+ return JsonResult.failMessage("只允许删除下架商品!");
+ }
+ goodsService.deleteGoods(id);
+ OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
+ .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("商品管理-删除商品-"+id).build();
+ mqUtil.sendApp(build);
+ return new JsonResult().success("操作成功!");
+ }
+
+ /**
+ * 查看商品详情
+ */
+ @GetMapping(Constants.ADMIN_VIEW_PREFIX + "/score/goods/viewGoods/{id}")
+ @ApiResponses({@ApiResponse( code = 200, message = "success", response = ViewGoodsVo.class)})
+ @ApiOperation(value="商品管理-查看商品详情", notes="test: 仅0有正确返回")
+ public JsonResult<ViewGoodsVo> viewGoods(@PathVariable long id) {
+ ViewGoodsVo viewGoodsVo = goodsService.viewGoods(id);
+ return JsonResult.success(viewGoodsVo);
+ }
+
+ /**
+ * 更新商品分类
+ * @param model
+ * @return
+ */
+ @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/score/goods/updateGoods.json")
+ @ApiOperation(value="商品管理-更新商品", notes="test: 仅0有正确返回")
+ public JsonResult updateGoods(@RequestBody UpdateGoodsDto model, HttpServletRequest request) {
+ long id = model.getId();
+ ScoreGoods scoreGoods = scoreGoodsMapper.selectByPrimaryKey(id);
+ if(ObjectUtil.isEmpty(scoreGoods)){
+ return JsonResult.failMessage("商品不存在!");
+ }
+ //下架商品才能更新
+ Integer isSale = scoreGoods.getIsSale();
+ if(ScoreGoods.ISSALE_YES == isSale){
+ return JsonResult.failMessage("请先下架商品!");
+ }
+ goodsService.updateGoods(model);
+ OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
+ .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("商品管理-更新商品-" + id).build();
+ mqUtil.sendApp(build);
+ return JsonResult.success("操作成功!");
+ }
+
+ /**
+ * 商品上下架
+ */
+ @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/score/goods/saleGoods.json")
+ @ApiOperation(value="商品管理-商品上下架", notes="test: 仅0有正确返回")
+ public JsonResult saleGoods(@RequestBody SaleGoodsDto model, HttpServletRequest request) {
+ long id = model.getId();
+ ScoreGoods scoreGoods = scoreGoodsMapper.selectById(id);
+ if(ObjectUtil.isEmpty(scoreGoods)){
+ return JsonResult.failMessage("商品不存在!");
+ }
+ short delFlag = scoreGoods.getDelFlag();
+ if(Convert.toShort(Constants.DEL_FLAG) == delFlag){
+ return JsonResult.failMessage("当前商品已删除!");
+ }
+ goodsService.saleGoods(id, model.getIsSale());
+ String upDown = "";
+ if(model.getIsSale() == ScoreGoods.ISSALE_YES){
+ upDown = "上";
+ }else{
+ upDown = "下";
+ }
+ OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
+ .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("商品管理-商品"+upDown+"架-"+id).build();
+ mqUtil.sendApp(build);
+ return new JsonResult().success("操作成功!");
+ }
+
+ /**
+ * 商品开始抢购开关
+ */
+ @PostMapping(Constants.ADMIN_VIEW_PREFIX + "/score/goods/snapUpGoods.json")
+ @ApiOperation(value="商品管理-商品开始抢购开关", notes="test: 仅0有正确返回")
+ public JsonResult snapUpGoods(@RequestBody SnapUpGoodsDto model, HttpServletRequest request) {
+ long id = model.getId();
+ ScoreGoods scoreGoods = scoreGoodsMapper.selectById(id);
+ if(ObjectUtil.isEmpty(scoreGoods)){
+ return JsonResult.failMessage("商品不存在!");
+ }
+ short delFlag = scoreGoods.getDelFlag();
+ if(Convert.toShort(Constants.DEL_FLAG) == delFlag){
+ return JsonResult.failMessage("当前商品已删除!");
+ }
+ goodsService.snapUpGoods(model);
+ String upDown = "";
+ if(model.getIsQg() == ScoreGoods.ISQG_YES){
+ upDown = "开始";
+ }else{
+ upDown = "结束";
+ }
+ OperationAppLog build = OperationAppLog.builder().appPrograme(CommonEnum.后台.getValue()).opreateName(getAdminName(request))
+ .methodName(Constants.SCORESHOP_MODUL_NAME).operateAction("商品管理-商品"+upDown+"抢购-"+id).build();
+ mqUtil.sendApp(build);
+ return new JsonResult().success("操作成功!");
+ }
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/AddGoodsDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/AddGoodsDto.java
new file mode 100644
index 0000000..244b68e
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/AddGoodsDto.java
@@ -0,0 +1,64 @@
+package com.xzx.gc.shop.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class AddGoodsDto implements Serializable {
+
+ @ApiModelProperty(value="商品编号",required=true)
+ private String goodsNo;
+
+ @ApiModelProperty(value="商品名称",required=true)
+ private String name;
+
+ @ApiModelProperty(value="单位",required=true)
+ private String unit;
+
+ @ApiModelProperty(value="品牌",required=true)
+ private String brand;
+
+ @ApiModelProperty(value="配送方式",required=true)
+ private String shipping;
+
+ @ApiModelProperty(value="缩略图",required=true)
+ private String thumb;
+
+ @ApiModelProperty(value="商品详情",required=true)
+ private String details;
+
+ /**
+ * 是否抢购 1-是 2-否
+ */
+ @ApiModelProperty(value="是否抢购 1/是 2/否",required=true)
+ private Integer isQg;
+
+ @ApiModelProperty(value="抢购开始时间")
+ private Date qgStartTime;
+
+ @ApiModelProperty(value="抢购结束时间")
+ private Date qgEndTime;
+
+ @ApiModelProperty(value="是否上架 1/是 2/否",required=true)
+ private Integer isSale;
+
+ @ApiModelProperty(value="碳排放量",required=true)
+ private Integer carbonEmissions;
+
+ @ApiModelProperty(value="积分商品轮播图")
+ private List<String> goodsImages;
+
+ @ApiModelProperty(value="积分商品样式")
+ private List<ScoreGoodsStyleDto> scoreGoodsStyleDtos;
+
+ @ApiModelProperty(value="创建人")
+ private String createdBy;
+
+ @ApiModelProperty(value="创建时间")
+ private Date createdTime;
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsCategoryDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsCategoryDto.java
index 6f5b7dc..2bf4140 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsCategoryDto.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsCategoryDto.java
@@ -4,5 +4,5 @@
@Data
public class DeleteGoodsCategoryDto {
- private long id;
+ private Long id;
}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsDto.java
new file mode 100644
index 0000000..bffb3a9
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsDto.java
@@ -0,0 +1,9 @@
+package com.xzx.gc.shop.dto;
+
+import lombok.Data;
+
+@Data
+public class DeleteGoodsDto {
+
+ private Long id;
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/QueryGoodsListDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/QueryGoodsListDto.java
new file mode 100644
index 0000000..1a650eb
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/QueryGoodsListDto.java
@@ -0,0 +1,19 @@
+package com.xzx.gc.shop.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class QueryGoodsListDto implements Serializable {
+
+ @ApiModelProperty(value="名称",required=true)
+ private String name;
+ @ApiModelProperty(value="是否已删除 1:是 2:否",required=true)
+ private Integer delFlag;
+ @ApiModelProperty(value="第几页",required=true)
+ private int page;
+ @ApiModelProperty(value="每一页数量",required=true)
+ private int limit;
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/SaleGoodsDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/SaleGoodsDto.java
new file mode 100644
index 0000000..ca143f8
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/SaleGoodsDto.java
@@ -0,0 +1,13 @@
+package com.xzx.gc.shop.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class SaleGoodsDto {
+
+ private Long id;
+
+ @ApiModelProperty(value="商品上下架 1:上架 2:下架",required=true)
+ private int isSale;
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsSkuDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsSkuDto.java
new file mode 100644
index 0000000..c2317fa
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsSkuDto.java
@@ -0,0 +1,33 @@
+package com.xzx.gc.shop.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ScoreGoodsSkuDto {
+
+ private Long id;
+
+ @ApiModelProperty(value="规格名称")
+ private String name;
+
+ @ApiModelProperty(value="原价")
+ private BigDecimal originalPrice;
+
+ @ApiModelProperty(value="现价")
+ private BigDecimal presentPrice;
+
+ @ApiModelProperty(value="库存")
+ private Integer stock;
+
+ @ApiModelProperty(value="销量")
+ private Integer quantity;
+
+ @ApiModelProperty(value="样式ID")
+ private Long styleId;
+
+ @ApiModelProperty(value="商品ID")
+ private Long goodsId;
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsStyleDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsStyleDto.java
new file mode 100644
index 0000000..2760479
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsStyleDto.java
@@ -0,0 +1,22 @@
+package com.xzx.gc.shop.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ScoreGoodsStyleDto {
+
+ private Long id;
+
+ @ApiModelProperty(value="样式名称")
+ private String name;
+
+ @ApiModelProperty(value="商品ID")
+ private Long goodsId;
+
+ @ApiModelProperty(value="积分商品规格")
+ private List<ScoreGoodsSkuDto> scoreGoodsSkuDtos;
+
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/SnapUpGoodsDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/SnapUpGoodsDto.java
new file mode 100644
index 0000000..80ae4fb
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/SnapUpGoodsDto.java
@@ -0,0 +1,22 @@
+package com.xzx.gc.shop.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class SnapUpGoodsDto {
+
+ private Long id;
+
+ @ApiModelProperty(value="是否抢购 1/是 2/否")
+ private Integer isQg;
+
+ @ApiModelProperty(value="抢购开始时间")
+ private Date qgStartTime;
+
+ @ApiModelProperty(value="抢购结束时间")
+ private Date qgEndTime;
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsCategoryDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsCategoryDto.java
index c18d5c7..4b1f2a4 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsCategoryDto.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsCategoryDto.java
@@ -6,7 +6,7 @@
@Data
public class UpdateGoodsCategoryDto {
- private long id;
+ private Long id;
@ApiModelProperty(value="分类名称")
private String name;
@ApiModelProperty(value="类别标识")
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsDto.java b/gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsDto.java
new file mode 100644
index 0000000..bab8c84
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsDto.java
@@ -0,0 +1,64 @@
+package com.xzx.gc.shop.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class UpdateGoodsDto {
+
+ private Long id;
+ @ApiModelProperty(value="商品编号",required=true)
+ private String goodsNo;
+
+ @ApiModelProperty(value="商品名称",required=true)
+ private String name;
+
+ @ApiModelProperty(value="单位",required=true)
+ private String unit;
+
+ @ApiModelProperty(value="品牌",required=true)
+ private String brand;
+
+ @ApiModelProperty(value="配送方式",required=true)
+ private String shipping;
+
+ @ApiModelProperty(value="缩略图",required=true)
+ private String thumb;
+
+ @ApiModelProperty(value="商品详情",required=true)
+ private String details;
+
+ /**
+ * 是否抢购 1-是 2-否
+ */
+ @ApiModelProperty(value="是否抢购 1/是 2/否",required=true)
+ private Integer isQg;
+
+ @ApiModelProperty(value="抢购开始时间")
+ private Date qgStartTime;
+
+ @ApiModelProperty(value="抢购结束时间")
+ private Date qgEndTime;
+
+ @ApiModelProperty(value="是否上架 1/是 2/否",required=true)
+ private Integer isSale;
+
+ @ApiModelProperty(value="碳排放量",required=true)
+ private Integer carbonEmissions;
+
+ @ApiModelProperty(value="积分商品轮播图")
+ private List<String> goodsImages;
+
+ @ApiModelProperty(value="积分商品样式")
+ private List<ScoreGoodsStyleDto> scoreGoodsStyleDtos;
+
+ @ApiModelProperty(value="创建人")
+ private String createdBy;
+
+ @ApiModelProperty(value="创建时间")
+ private Date createdTime;
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsImagesMapper.java b/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsImagesMapper.java
new file mode 100644
index 0000000..2fb7a12
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsImagesMapper.java
@@ -0,0 +1,12 @@
+package com.xzx.gc.shop.mapper;
+
+import com.xzx.gc.entity.ScoreGoodsImages;
+import com.xzx.gc.util.GcMapper;
+
+import java.util.List;
+
+public interface ScoreGoodsImagesMapper extends GcMapper<ScoreGoodsImages> {
+
+ List<String> selectScoreGoodsImagesByGoodsId(long id);
+
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsMapper.java b/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsMapper.java
index 18bcde2..1b72bb5 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsMapper.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsMapper.java
@@ -1,7 +1,17 @@
package com.xzx.gc.shop.mapper;
import com.xzx.gc.entity.ScoreGoods;
+import com.xzx.gc.shop.vo.QueryGoodsListVo;
import com.xzx.gc.util.GcMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
public interface ScoreGoodsMapper extends GcMapper<ScoreGoods> {
+
+ List<QueryGoodsListVo> queryGoodsList(ScoreGoods scoreGoods);
+
+ void updateDelFlagById(@Param("id")long id, @Param("delFlag")Short toShort);
+
+ ScoreGoods selectById(long id);
}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsSkuMapper.java b/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsSkuMapper.java
new file mode 100644
index 0000000..b49073e
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsSkuMapper.java
@@ -0,0 +1,15 @@
+package com.xzx.gc.shop.mapper;
+
+import com.xzx.gc.entity.ScoreGoodsSku;
+import com.xzx.gc.shop.vo.ScoreGoodsSkuVo;
+import com.xzx.gc.util.GcMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface ScoreGoodsSkuMapper extends GcMapper<ScoreGoodsSku> {
+
+ List<ScoreGoodsSkuVo> selectScoreGoodsSkuByGoodsIdAndStyleId(@Param("id")long id, @Param("styleId")Long styleId);
+
+ void updateDelFlagById(@Param("id")Long id, @Param("delFlag")Short toShort);
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsStyleMapper.java b/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsStyleMapper.java
new file mode 100644
index 0000000..9ce5c91
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsStyleMapper.java
@@ -0,0 +1,14 @@
+package com.xzx.gc.shop.mapper;
+
+import com.xzx.gc.entity.ScoreGoodsStyle;
+import com.xzx.gc.util.GcMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface ScoreGoodsStyleMapper extends GcMapper<ScoreGoodsStyle> {
+
+ List<ScoreGoodsStyle> selectScoreGoodsStyleByGoodsId(long id);
+
+ void updateDelFlagById(@Param("id")long id, @Param("delFlag")Short toShort);
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java b/gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java
index 59030c1..f6c181e 100644
--- a/gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java
@@ -2,29 +2,26 @@
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
-import cn.hutool.core.util.StrUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
-import com.xzx.gc.common.constant.CommonEnum;
import com.xzx.gc.common.constant.Constants;
-import com.xzx.gc.common.dto.log.OperationAppLog;
import com.xzx.gc.common.utils.MqUtil;
-import com.xzx.gc.entity.CoreUser;
-import com.xzx.gc.entity.ScoreGoodsCategory;
-import com.xzx.gc.model.JsonResult;
+import com.xzx.gc.entity.*;
import com.xzx.gc.model.admin.GoodsCategoryModel;
-import com.xzx.gc.shop.dto.QueryGoodsCategoryListDto;
-import com.xzx.gc.shop.mapper.ScoreGoodsCategoryMapper;
-import com.xzx.gc.shop.vo.QueryGoodsCategoryListVo;
-import com.xzx.gc.shop.vo.ViewGoodsCategoryVo;
-import com.xzx.gc.util.SessionUtil;
+import com.xzx.gc.shop.dto.*;
+import com.xzx.gc.shop.mapper.*;
+import com.xzx.gc.shop.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -36,6 +33,14 @@
@Resource
ScoreGoodsCategoryMapper scoreGoodsCategoryMapper;
+ @Resource
+ ScoreGoodsMapper scoreGoodsMapper;
+ @Resource
+ ScoreGoodsSkuMapper scoreGoodsSkuMapper;
+ @Resource
+ ScoreGoodsImagesMapper scoreGoodsImagesMapper;
+ @Resource
+ ScoreGoodsStyleMapper scoreGoodsStyleMapper;
@Autowired
private MqUtil mqUtil;
@@ -89,4 +94,190 @@
scoreGoodsCategory.setParentId(model.getParentId());
scoreGoodsCategoryMapper.updateByPrimaryKey(scoreGoodsCategory);
}
+
+ public Map<String, Object> queryGoodsList(QueryGoodsListDto model) {
+ String name = model.getName();
+ int delFlag = model.getDelFlag();
+ ScoreGoods scoreGoods = new ScoreGoods();
+ scoreGoods.setName(name);
+ scoreGoods.setDelFlag(Convert.toShort(delFlag));
+ PageHelper.startPage(model.getPage(), model.getLimit());
+
+ List<QueryGoodsListVo> maps = scoreGoodsMapper.queryGoodsList(scoreGoods);
+ PageInfo pageInfo = new PageInfo(maps);
+ int count = Convert.toInt(pageInfo.getTotal());
+ Map<String, Object> map = new HashMap<>();
+ map.put("data", maps);
+ map.put("count", count);
+ map.put("code", 0);
+ return map;
+ }
+
+ public Long addGoods(AddGoodsDto model) {
+ //新增商品主信息
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ ScoreGoods scoreGoods = objectMapper.convertValue(model, ScoreGoods.class);
+ scoreGoods.setDelFlag(Convert.toShort(Constants.DEL_NOT_FLAG));
+ scoreGoodsMapper.insert(scoreGoods);
+ //样式信息
+ List<ScoreGoodsStyleDto> scoreGoodsStyleDtos = model.getScoreGoodsStyleDtos();
+ if(CollUtil.isNotEmpty(scoreGoodsStyleDtos)){
+ for(ScoreGoodsStyleDto scoreGoodsStyleDto : scoreGoodsStyleDtos){
+ ScoreGoodsStyle scoreGoodsStyle = objectMapper.convertValue(scoreGoodsStyleDto, ScoreGoodsStyle.class);
+ scoreGoodsStyle.setGoodsId(scoreGoods.getId());
+ scoreGoodsStyle.setDelFlag(Convert.toShort(Constants.DEL_NOT_FLAG));
+ scoreGoodsStyleMapper.insert(scoreGoodsStyle);
+ //规格信息
+ List<ScoreGoodsSkuDto> scoreGoodsSkuDtos = scoreGoodsStyleDto.getScoreGoodsSkuDtos();
+ if(CollUtil.isNotEmpty(scoreGoodsSkuDtos)){
+ for(ScoreGoodsSkuDto scoreGoodsSkuDto : scoreGoodsSkuDtos){
+ ScoreGoodsSku scoreGoodsSku = objectMapper.convertValue(scoreGoodsSkuDto, ScoreGoodsSku.class);
+ scoreGoodsSku.setGoodsId(scoreGoods.getId());
+ scoreGoodsSku.setStyleId(scoreGoodsStyle.getId());
+ scoreGoodsSku.setDelFlag(Convert.toShort(Constants.DEL_NOT_FLAG));
+ scoreGoodsSkuMapper.insert(scoreGoodsSku);
+ }
+ }
+ }
+ }
+ //轮播图信息
+ List<String> goodsImages = model.getGoodsImages();
+ if(CollUtil.isNotEmpty(goodsImages)){
+ for(String goodImage : goodsImages){
+ ScoreGoodsImages scoreGoodsImages = new ScoreGoodsImages();
+ scoreGoodsImages.setImageUrl(goodImage);
+ scoreGoodsImages.setGoodsId(scoreGoods.getId());
+ scoreGoodsImages.setDelFlag(Convert.toShort(Constants.DEL_NOT_FLAG));
+ scoreGoodsImagesMapper.insert(scoreGoodsImages);
+ }
+ }
+ return scoreGoods.getId();
+ }
+
+ public void deleteGoods(long id) {
+
+ scoreGoodsMapper.updateDelFlagById(id,Convert.toShort(Constants.DEL_FLAG));
+
+ Example exampleStyle = new Example(ScoreGoodsStyle.class);
+ Example.Criteria criteriaStyle = exampleStyle.createCriteria();
+ criteriaStyle.andEqualTo("goodsId",id);
+ List<ScoreGoodsStyle> goodsStyles = scoreGoodsStyleMapper.selectByExample(exampleStyle);
+ if(CollUtil.isNotEmpty(goodsStyles)){
+ for(ScoreGoodsStyle scoreGoodsStyle : goodsStyles){
+ scoreGoodsStyleMapper.updateDelFlagById(scoreGoodsStyle.getId(),Convert.toShort(Constants.DEL_FLAG));
+ }
+ }
+
+ Example exampleSku = new Example(ScoreGoodsStyle.class);
+ Example.Criteria criteriaSku = exampleSku.createCriteria();
+ criteriaSku.andEqualTo("goodsId",id);
+ List<ScoreGoodsSku> goodsSkus = scoreGoodsSkuMapper.selectByExample(exampleSku);
+ if(CollUtil.isNotEmpty(goodsSkus)){
+ for(ScoreGoodsSku scoreGoodsSku : goodsSkus){
+ scoreGoodsSkuMapper.updateDelFlagById(scoreGoodsSku.getId(),Convert.toShort(Constants.DEL_FLAG));
+ }
+ }
+ }
+
+ public ViewGoodsVo viewGoods(long id) {
+ ViewGoodsVo viewGoodsVo = new ViewGoodsVo();
+ ScoreGoods scoreGoods = scoreGoodsMapper.selectByPrimaryKey(id);
+ if(ObjectUtil.isNotEmpty(scoreGoods)){
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ viewGoodsVo = objectMapper.convertValue(scoreGoods, ViewGoodsVo.class);
+ //轮播图
+ List<String> goodsImages = scoreGoodsImagesMapper.selectScoreGoodsImagesByGoodsId(id);
+ viewGoodsVo.setGoodsImages(goodsImages);
+ //样式
+ List<ScoreGoodsStyleVo> scoreGoodsStyleVos = new ArrayList<>();
+ List<ScoreGoodsStyle> goodsStyles = scoreGoodsStyleMapper.selectScoreGoodsStyleByGoodsId(id);
+ if(CollUtil.isNotEmpty(goodsStyles)){
+ for(ScoreGoodsStyle goodsStyle : goodsStyles){
+ ScoreGoodsStyleVo scoreGoodsStyleVo = objectMapper.convertValue(goodsStyle, ScoreGoodsStyleVo.class);
+ //获取规格
+ Long styleId = goodsStyle.getId();
+ List<ScoreGoodsSkuVo> goodsSkus = scoreGoodsSkuMapper.selectScoreGoodsSkuByGoodsIdAndStyleId(id,styleId);
+ scoreGoodsStyleVo.setScoreGoodsSkuVos(goodsSkus);
+ scoreGoodsStyleVos.add(scoreGoodsStyleVo);
+ }
+ }
+ viewGoodsVo.setScoreGoodsStyleVos(scoreGoodsStyleVos);
+ }
+ return viewGoodsVo;
+ }
+
+ public void updateGoods(UpdateGoodsDto model) {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ ScoreGoods scoreGoods = objectMapper.convertValue(model, ScoreGoods.class);
+ scoreGoodsMapper.updateByPrimaryKey(scoreGoods);
+
+ //轮播图
+ Example exampleImages = new Example(ScoreGoodsImages.class);
+ Example.Criteria criteriaImages = exampleImages.createCriteria();
+ criteriaImages.andEqualTo("goodsId",scoreGoods.getId());
+ scoreGoodsImagesMapper.deleteByExample(exampleImages);
+ List<String> goodsImages = model.getGoodsImages();
+ if(CollUtil.isNotEmpty(goodsImages)){
+ for(String goodImage : goodsImages){
+ ScoreGoodsImages scoreGoodsImages = new ScoreGoodsImages();
+ scoreGoodsImages.setImageUrl(goodImage);
+ scoreGoodsImages.setGoodsId(scoreGoods.getId());
+ scoreGoodsImages.setDelFlag(Convert.toShort(Constants.DEL_NOT_FLAG));
+ scoreGoodsImagesMapper.insert(scoreGoodsImages);
+ }
+ }
+
+ List<ScoreGoodsStyleDto> scoreGoodsStyleDtos = model.getScoreGoodsStyleDtos();
+ if(CollUtil.isNotEmpty(scoreGoodsStyleDtos)){
+ for(ScoreGoodsStyleDto scoreGoodsStyleDto : scoreGoodsStyleDtos){
+ ScoreGoodsStyle scoreGoodsStyle = new ScoreGoodsStyle();
+ scoreGoodsStyle.setId(scoreGoodsStyleDto.getId());
+ scoreGoodsStyle.setName(scoreGoodsStyleDto.getName());
+ scoreGoodsStyle.setGoodsId(scoreGoods.getId());
+ scoreGoodsStyleMapper.updateByPrimaryKeySelective(scoreGoodsStyle);
+ //规格
+ List<ScoreGoodsSkuDto> scoreGoodsSkuDtos = scoreGoodsStyleDto.getScoreGoodsSkuDtos();
+ if(CollUtil.isNotEmpty(scoreGoodsSkuDtos)){
+ for(ScoreGoodsSkuDto scoreGoodsSkuDto : scoreGoodsSkuDtos){
+ ScoreGoodsSku scoreGoodsSku = objectMapper.convertValue(scoreGoodsSkuDto, ScoreGoodsSku.class);
+ scoreGoodsSkuMapper.updateByPrimaryKey(scoreGoodsSku);
+ }
+ }
+ }
+ }
+ }
+
+ public void saleGoods(long id, Integer issale) {
+ ScoreGoods scoreGoods = new ScoreGoods();
+ scoreGoods.setIsSale(issale);
+ Example exampleGoods = new Example(ScoreGoods.class);
+ Example.Criteria criteriaGoods = exampleGoods.createCriteria();
+ criteriaGoods.andEqualTo("id",id);
+ scoreGoodsMapper.updateByExampleSelective(scoreGoods,exampleGoods);
+ }
+
+ public void snapUpGoods(SnapUpGoodsDto model) {
+ long id = model.getId();
+ Integer isQg = model.getIsQg();
+ if(ScoreGoods.ISQG_YES == isQg){
+ ScoreGoods scoreGoods = new ScoreGoods();
+ scoreGoods.setIsQg(ScoreGoods.ISQG_YES);
+ scoreGoods.setQgStartTime(model.getQgStartTime());
+ scoreGoods.setQgEndTime(model.getQgEndTime());
+ Example exampleGoods = new Example(ScoreGoods.class);
+ Example.Criteria criteriaGoods = exampleGoods.createCriteria();
+ criteriaGoods.andEqualTo("id",id);
+ scoreGoodsMapper.updateByExampleSelective(scoreGoods,exampleGoods);
+ }else{
+ ScoreGoods scoreGoods = new ScoreGoods();
+ scoreGoods.setIsQg(ScoreGoods.ISQG_NO);
+ Example exampleGoods = new Example(ScoreGoods.class);
+ Example.Criteria criteriaGoods = exampleGoods.createCriteria();
+ criteriaGoods.andEqualTo("id",id);
+ scoreGoodsMapper.updateByExampleSelective(scoreGoods,exampleGoods);
+ }
+ }
}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/vo/QueryGoodsListVo.java b/gc-shop/src/main/java/com/xzx/gc/shop/vo/QueryGoodsListVo.java
new file mode 100644
index 0000000..8642998
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/vo/QueryGoodsListVo.java
@@ -0,0 +1,65 @@
+package com.xzx.gc.shop.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@ApiModel(value = "QueryGoodsListVo", description = "返回")
+public class QueryGoodsListVo {
+
+ private long id;
+ @ApiModelProperty(value="商品编号")
+ private String goodsNo;
+
+ @ApiModelProperty(value="商品名称")
+ private String name;
+
+ @ApiModelProperty(value="单位")
+ private String unit;
+
+ @ApiModelProperty(value="品牌")
+ private String brand;
+
+ @ApiModelProperty(value="配送方式")
+ private String shipping;
+
+ @ApiModelProperty(value="缩略图")
+ private String thumb;
+
+ @ApiModelProperty(value="商品详情")
+ private String details;
+
+ /**
+ * 是否抢购 1-是 2-否
+ */
+ @ApiModelProperty(value="是否抢购 1/是 2/否")
+ private Integer isQg;
+
+ @ApiModelProperty(value="抢购开始时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date qgStartTime;
+
+ @ApiModelProperty(value="抢购结束时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date qgEndTime;
+
+ @ApiModelProperty(value="是否上架 1/是 2/否")
+ private Integer isSale;
+
+ @ApiModelProperty(value="碳排放量")
+ private Integer carbonEmissions;
+
+ @ApiModelProperty(value="创建人")
+ private String createdBy;
+
+ @ApiModelProperty(value="是否删除 1/是 0/否")
+ private short delFlag;
+
+ @ApiModelProperty(value="创建时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date createdTime;
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsSkuVo.java b/gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsSkuVo.java
new file mode 100644
index 0000000..ead71ff
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsSkuVo.java
@@ -0,0 +1,35 @@
+package com.xzx.gc.shop.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@ApiModel(value = "ScoreGoodsSkuVo", description = "规格")
+public class ScoreGoodsSkuVo {
+
+ private long id;
+
+ @ApiModelProperty(value="规格名称")
+ private String name;
+
+ @ApiModelProperty(value="原价")
+ private BigDecimal originalPrice;
+
+ @ApiModelProperty(value="现价")
+ private BigDecimal presentPrice;
+
+ @ApiModelProperty(value="库存")
+ private Integer stock;
+
+ @ApiModelProperty(value="销量")
+ private Integer quantity;
+
+ @ApiModelProperty(value="样式ID")
+ private Long styleId;
+
+ @ApiModelProperty(value="商品ID")
+ private Long goodsId;
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsStyleVo.java b/gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsStyleVo.java
new file mode 100644
index 0000000..95929c1
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsStyleVo.java
@@ -0,0 +1,23 @@
+package com.xzx.gc.shop.vo;
+
+import com.xzx.gc.shop.dto.ScoreGoodsSkuDto;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+@Data
+@ApiModel(value = "ScoreGoodsStyleVo", description = "样式")
+public class ScoreGoodsStyleVo {
+
+ private long id;
+
+ @ApiModelProperty(value="样式名称")
+ private String name;
+
+ @ApiModelProperty(value="商品ID")
+ private Long goodsId;
+
+ @ApiModelProperty(value="积分商品规格")
+ private List<ScoreGoodsSkuVo> scoreGoodsSkuVos;
+}
diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/vo/ViewGoodsVo.java b/gc-shop/src/main/java/com/xzx/gc/shop/vo/ViewGoodsVo.java
new file mode 100644
index 0000000..d512883
--- /dev/null
+++ b/gc-shop/src/main/java/com/xzx/gc/shop/vo/ViewGoodsVo.java
@@ -0,0 +1,71 @@
+package com.xzx.gc.shop.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.xzx.gc.entity.ScoreGoodsStyle;
+import com.xzx.gc.shop.dto.ScoreGoodsStyleDto;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+@ApiModel(value = "ViewGoodsVo", description = "商品")
+public class ViewGoodsVo {
+
+ private long id;
+ @ApiModelProperty(value="商品编号",required=true)
+ private String goodsNo;
+
+ @ApiModelProperty(value="商品名称",required=true)
+ private String name;
+
+ @ApiModelProperty(value="单位",required=true)
+ private String unit;
+
+ @ApiModelProperty(value="品牌",required=true)
+ private String brand;
+
+ @ApiModelProperty(value="配送方式",required=true)
+ private String shipping;
+
+ @ApiModelProperty(value="缩略图",required=true)
+ private String thumb;
+
+ @ApiModelProperty(value="商品详情",required=true)
+ private String details;
+
+ /**
+ * 是否抢购 1-是 2-否
+ */
+ @ApiModelProperty(value="是否抢购 1/是 2/否",required=true)
+ private Integer isQg;
+
+ @ApiModelProperty(value="抢购开始时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date qgStartTime;
+
+ @ApiModelProperty(value="抢购结束时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date qgEndTime;
+
+ @ApiModelProperty(value="是否上架 1/是 2/否",required=true)
+ private Integer isSale;
+
+ @ApiModelProperty(value="碳排放量",required=true)
+ private Integer carbonEmissions;
+
+ @ApiModelProperty(value="积分商品轮播图")
+ private List<String> goodsImages;
+
+ @ApiModelProperty(value="积分商品样式")
+ private List<ScoreGoodsStyleVo> scoreGoodsStyleVos;
+
+ @ApiModelProperty(value="创建人")
+ private String createdBy;
+
+ @ApiModelProperty(value="创建时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ private Date createdTime;
+}
diff --git a/gc-shop/src/main/resources/mapper/shop/ScoreGoodsImagesMapper.xml b/gc-shop/src/main/resources/mapper/shop/ScoreGoodsImagesMapper.xml
new file mode 100644
index 0000000..aaf8394
--- /dev/null
+++ b/gc-shop/src/main/resources/mapper/shop/ScoreGoodsImagesMapper.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xzx.gc.shop.mapper.ScoreGoodsImagesMapper">
+
+ <select id="selectScoreGoodsImagesByGoodsId" resultType="java.lang.String">
+ SELECT
+ a.image_url imageUrl
+ FROM
+ xzx_score_goods_images a
+ WHERE 1 = 1
+ and a.goods_id = #{id}
+ and a.del_flag = 0
+ </select>
+
+</mapper>
diff --git a/gc-shop/src/main/resources/mapper/shop/ScoreGoodsMapper.xml b/gc-shop/src/main/resources/mapper/shop/ScoreGoodsMapper.xml
new file mode 100644
index 0000000..46c2412
--- /dev/null
+++ b/gc-shop/src/main/resources/mapper/shop/ScoreGoodsMapper.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xzx.gc.shop.mapper.ScoreGoodsMapper">
+
+ <select id="queryGoodsList" resultType="com.xzx.gc.shop.vo.QueryGoodsListVo">
+ SELECT
+ *
+ FROM
+ xzx_score_goods a
+ WHERE 1 = 1
+ <if test="name != null and name != ''">
+ and a.name like concat('%',#{name},'%')
+ </if>
+ <if test="delFlag != null and delFlag != ''">
+ and a.del_flag = #{delFlag}
+ </if>
+ order by a.CREATED_TIME desc
+ </select>
+
+
+
+ <select id="selectById" resultType="com.xzx.gc.entity.ScoreGoods">
+ SELECT
+ *
+ FROM
+ xzx_score_goods a
+ WHERE 1 = 1
+ and id = #{id}
+ </select>
+
+
+ <update id="updateDelFlagById">
+ update xzx_score_goods set del_flag=#{delFlag}
+ where id=#{id}
+ </update>
+
+</mapper>
diff --git a/gc-shop/src/main/resources/mapper/shop/ScoreGoodsSkuMapper.xml b/gc-shop/src/main/resources/mapper/shop/ScoreGoodsSkuMapper.xml
new file mode 100644
index 0000000..1fb0ce5
--- /dev/null
+++ b/gc-shop/src/main/resources/mapper/shop/ScoreGoodsSkuMapper.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xzx.gc.shop.mapper.ScoreGoodsSkuMapper">
+
+
+ <select id="selectScoreGoodsSkuByGoodsIdAndStyleId" resultType="com.xzx.gc.shop.vo.ScoreGoodsSkuVo">
+ SELECT
+ a.*
+ FROM
+ xzx_score_goods_sku a
+ WHERE 1 = 1
+ and a.goods_id = #{id}
+ and a.style_id = #{styleId}
+ and a.del_flag != 1
+ </select>
+
+
+ <update id="updateDelFlagById">
+ update xzx_score_goods_sku set del_flag=#{delFlag}
+ where id=#{id}
+ </update>
+
+</mapper>
diff --git a/gc-shop/src/main/resources/mapper/shop/ScoreGoodsStyleMapper.xml b/gc-shop/src/main/resources/mapper/shop/ScoreGoodsStyleMapper.xml
new file mode 100644
index 0000000..6eee034
--- /dev/null
+++ b/gc-shop/src/main/resources/mapper/shop/ScoreGoodsStyleMapper.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xzx.gc.shop.mapper.ScoreGoodsStyleMapper">
+
+ <select id="selectScoreGoodsStyleByGoodsId" resultType="com.xzx.gc.entity.ScoreGoodsStyle">
+ SELECT
+ a.*
+ FROM
+ xzx_score_goods_style a
+ WHERE 1 = 1
+ and a.goods_id = #{id}
+ and a.del_flag = 0
+ </select>
+
+
+ <update id="updateDelFlagById">
+ update xzx_score_goods_style set del_flag=#{delFlag}
+ where id=#{id}
+ </update>
+
+</mapper>
diff --git a/gc-shop/src/main/resources/sql b/gc-shop/src/main/resources/sql
index 56b7e26..a0f7ea1 100644
--- a/gc-shop/src/main/resources/sql
+++ b/gc-shop/src/main/resources/sql
@@ -23,4 +23,8 @@
MODIFY COLUMN `del_flag` smallint(2) NULL DEFAULT NULL COMMENT '删除标识0 正常 1已删除 ' AFTER `CREATED_TIME`;
ALTER TABLE `xzx_score_order_details`
-MODIFY COLUMN `del_flag` smallint(2) NULL DEFAULT NULL COMMENT '删除标识0 正常 1已删除 ' AFTER `CREATED_TIME`;
\ No newline at end of file
+MODIFY COLUMN `del_flag` smallint(2) NULL DEFAULT NULL COMMENT '删除标识0 正常 1已删除 ' AFTER `CREATED_TIME`;
+
+ALTER TABLE `xzx_score_goods`
+CHANGE COLUMN `gq_end_time` `qg_end_time` datetime NULL DEFAULT NULL COMMENT '抢购结束时间' AFTER `qg_start_time`;
+
--
Gitblit v1.9.1