xiaoyong931011
2021-06-24 ccb35b497df342c6de15f3a6be4c065b0ca7f1f1
20210624 商品分类
20 files added
1 files renamed
10 files modified
1048 ■■■■■ changed files
gc-core/src/main/java/com/xzx/gc/common/entity/BaseEntity.java 2 ●●● patch | view | raw | blame | history
gc-core/src/main/java/com/xzx/gc/entity/ScoreGoods.java 6 ●●●● patch | view | raw | blame | history
gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsImages.java 3 ●●●● patch | view | raw | blame | history
gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsSku.java 3 ●●●● patch | view | raw | blame | history
gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsStyle.java 21 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsCategoryController.java 16 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsController.java 185 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/dto/AddGoodsDto.java 64 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsCategoryDto.java 2 ●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsDto.java 9 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/dto/QueryGoodsListDto.java 19 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/dto/SaleGoodsDto.java 13 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsSkuDto.java 33 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsStyleDto.java 22 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/dto/SnapUpGoodsDto.java 22 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsCategoryDto.java 2 ●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsDto.java 64 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsImagesMapper.java 12 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsMapper.java 10 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsSkuMapper.java 15 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsStyleMapper.java 14 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/service/GoodsService.java 215 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/vo/QueryGoodsListVo.java 65 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsSkuVo.java 35 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsStyleVo.java 23 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/java/com/xzx/gc/shop/vo/ViewGoodsVo.java 71 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/resources/mapper/shop/ScoreGoodsImagesMapper.xml 15 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/resources/mapper/shop/ScoreGoodsMapper.xml 37 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/resources/mapper/shop/ScoreGoodsSkuMapper.xml 23 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/resources/mapper/shop/ScoreGoodsStyleMapper.xml 21 ●●●●● patch | view | raw | blame | history
gc-shop/src/main/resources/sql 6 ●●●● patch | view | raw | blame | history
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;
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;
}
gc-core/src/main/java/com/xzx/gc/entity/ScoreGoodsImages.java
@@ -11,7 +11,6 @@
    private String imageUrl;
    private Integer seq;
    private Long goodsId;
}
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;
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;
gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsCategoryController.java
File was renamed from gc-shop/src/main/java/com/xzx/gc/shop/controller/GoodsController.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 @@
    }
}
gc-shop/src/main/java/com/xzx/gc/shop/controller/AdminGoodsController.java
New file
@@ -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("操作成功!");
    }
}
gc-shop/src/main/java/com/xzx/gc/shop/dto/AddGoodsDto.java
New file
@@ -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;
}
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;
}
gc-shop/src/main/java/com/xzx/gc/shop/dto/DeleteGoodsDto.java
New file
@@ -0,0 +1,9 @@
package com.xzx.gc.shop.dto;
import lombok.Data;
@Data
public class DeleteGoodsDto {
    private Long id;
}
gc-shop/src/main/java/com/xzx/gc/shop/dto/QueryGoodsListDto.java
New file
@@ -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;
}
gc-shop/src/main/java/com/xzx/gc/shop/dto/SaleGoodsDto.java
New file
@@ -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;
}
gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsSkuDto.java
New file
@@ -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;
}
gc-shop/src/main/java/com/xzx/gc/shop/dto/ScoreGoodsStyleDto.java
New file
@@ -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;
}
gc-shop/src/main/java/com/xzx/gc/shop/dto/SnapUpGoodsDto.java
New file
@@ -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;
}
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="类别标识")
gc-shop/src/main/java/com/xzx/gc/shop/dto/UpdateGoodsDto.java
New file
@@ -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;
}
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsImagesMapper.java
New file
@@ -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);
}
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);
}
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsSkuMapper.java
New file
@@ -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);
}
gc-shop/src/main/java/com/xzx/gc/shop/mapper/ScoreGoodsStyleMapper.java
New file
@@ -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);
}
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);
        }
    }
}
gc-shop/src/main/java/com/xzx/gc/shop/vo/QueryGoodsListVo.java
New file
@@ -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;
}
gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsSkuVo.java
New file
@@ -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;
}
gc-shop/src/main/java/com/xzx/gc/shop/vo/ScoreGoodsStyleVo.java
New file
@@ -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;
}
gc-shop/src/main/java/com/xzx/gc/shop/vo/ViewGoodsVo.java
New file
@@ -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;
}
gc-shop/src/main/resources/mapper/shop/ScoreGoodsImagesMapper.xml
New file
@@ -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>
gc-shop/src/main/resources/mapper/shop/ScoreGoodsMapper.xml
New file
@@ -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>
gc-shop/src/main/resources/mapper/shop/ScoreGoodsSkuMapper.xml
New file
@@ -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>
gc-shop/src/main/resources/mapper/shop/ScoreGoodsStyleMapper.xml
New file
@@ -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>
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`;
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`;