Commit c118d8198ba2f25045392fc43a1e92452fcb564c
Merge remote-tracking branch 'origin/feature/1.8.0-uniapp' into feature/1.8.0-uniapp
# Conflicts: # yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java
Showing
9 changed files
with
67 additions
and
53 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/ProductSkuController.java
| 1 | 1 | package cn.iocoder.yudao.module.product.controller.admin.sku; |
| 2 | 2 | |
| 3 | -import org.springframework.web.bind.annotation.*; | |
| 4 | -import javax.annotation.Resource; | |
| 5 | -import org.springframework.validation.annotation.Validated; | |
| 6 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 7 | -import io.swagger.annotations.*; | |
| 8 | - | |
| 9 | -import javax.validation.constraints.*; | |
| 10 | -import javax.validation.*; | |
| 11 | -import javax.servlet.http.*; | |
| 12 | -import java.util.*; | |
| 13 | -import java.io.IOException; | |
| 14 | - | |
| 15 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 16 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 17 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 18 | - | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 19 | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 20 | - | |
| 21 | 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 22 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; | |
| 23 | - | |
| 24 | 7 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; |
| 25 | -import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | |
| 26 | 8 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; |
| 9 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | |
| 27 | 10 | import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; |
| 11 | +import io.swagger.annotations.Api; | |
| 12 | +import io.swagger.annotations.ApiImplicitParam; | |
| 13 | +import io.swagger.annotations.ApiOperation; | |
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | +import org.springframework.validation.annotation.Validated; | |
| 16 | +import org.springframework.web.bind.annotation.*; | |
| 17 | + | |
| 18 | +import javax.annotation.Resource; | |
| 19 | +import javax.servlet.http.HttpServletResponse; | |
| 20 | +import javax.validation.Valid; | |
| 21 | +import java.io.IOException; | |
| 22 | +import java.util.Collection; | |
| 23 | +import java.util.List; | |
| 24 | + | |
| 25 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 26 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | |
| 28 | 27 | |
| 28 | +// TODO @franky:中英文之间要有空格哈。商品 sku | |
| 29 | 29 | @Api(tags = "管理后台 - 商品sku") |
| 30 | 30 | @RestController |
| 31 | 31 | @RequestMapping("/product/sku") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/sku/vo/ProductSkuBaseVO.java
| ... | ... | @@ -12,9 +12,13 @@ import javax.validation.constraints.*; |
| 12 | 12 | @Data |
| 13 | 13 | public class ProductSkuBaseVO { |
| 14 | 14 | |
| 15 | + // TODO @franky:example 要写哈; | |
| 16 | + | |
| 15 | 17 | @ApiModelProperty(value = "spu编号") |
| 16 | 18 | private Long spuId; |
| 17 | 19 | |
| 20 | + // TODO @franky:类似这种字段,有额外说明的。可以写成; @ApiModelProperty(value = "规格值数组", required = true, notes = "json格式, [{propertyId: , valueId: }, {propertyId: , valueId: }]") | |
| 21 | + | |
| 18 | 22 | @ApiModelProperty(value = "规格值数组-json格式, [{propertyId: , valueId: }, {propertyId: , valueId: }]", required = true) |
| 19 | 23 | @NotNull(message = "规格值数组-json格式, [{propertyId: , valueId: }, {propertyId: , valueId: }]不能为空") |
| 20 | 24 | private List<Property> properties; |
| ... | ... | @@ -42,6 +46,7 @@ public class ProductSkuBaseVO { |
| 42 | 46 | @ApiModelProperty(value = "状态: 0-正常 1-禁用") |
| 43 | 47 | private Integer status; |
| 44 | 48 | |
| 49 | + // TODO @franky 要有 swagger 注解 | |
| 45 | 50 | @Data |
| 46 | 51 | public static class Property { |
| 47 | 52 | @NotNull(message = "规格属性名id不能为空") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/ProductSpuController.java
| 1 | 1 | package cn.iocoder.yudao.module.product.controller.admin.spu; |
| 2 | 2 | |
| 3 | -import nonapi.io.github.classgraph.utils.LogNode; | |
| 4 | -import org.springframework.web.bind.annotation.*; | |
| 5 | -import javax.annotation.Resource; | |
| 6 | -import org.springframework.validation.annotation.Validated; | |
| 7 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 8 | -import io.swagger.annotations.*; | |
| 9 | - | |
| 10 | -import javax.validation.constraints.*; | |
| 11 | -import javax.validation.*; | |
| 12 | -import javax.servlet.http.*; | |
| 13 | -import java.util.*; | |
| 14 | -import java.io.IOException; | |
| 15 | - | |
| 16 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 17 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 18 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 19 | - | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 20 | 5 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 21 | - | |
| 22 | 6 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 23 | -import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; | |
| 24 | - | |
| 25 | 7 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; |
| 26 | -import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | |
| 27 | 8 | import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; |
| 9 | +import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | |
| 28 | 10 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; |
| 11 | +import io.swagger.annotations.Api; | |
| 12 | +import io.swagger.annotations.ApiImplicitParam; | |
| 13 | +import io.swagger.annotations.ApiOperation; | |
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 15 | +import org.springframework.validation.annotation.Validated; | |
| 16 | +import org.springframework.web.bind.annotation.*; | |
| 17 | + | |
| 18 | +import javax.annotation.Resource; | |
| 19 | +import javax.servlet.http.HttpServletResponse; | |
| 20 | +import javax.validation.Valid; | |
| 21 | +import java.io.IOException; | |
| 22 | +import java.util.Collection; | |
| 23 | +import java.util.List; | |
| 24 | + | |
| 25 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 26 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | |
| 29 | 27 | |
| 30 | 28 | @Api(tags = "管理后台 - 商品spu") |
| 31 | 29 | @RestController |
| ... | ... | @@ -43,6 +41,7 @@ public class ProductSpuController { |
| 43 | 41 | return success(spuService.createSpu(createReqVO)); |
| 44 | 42 | } |
| 45 | 43 | |
| 44 | + // TODO @franky:SpuUpdateReqVO 缺少前缀 | |
| 46 | 45 | @PutMapping("/update") |
| 47 | 46 | @ApiOperation("更新商品spu") |
| 48 | 47 | @PreAuthorize("@ss.hasPermission('product:spu:update')") | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuCreateReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.product.controller.admin.spu.vo; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateReqVO; |
| 4 | -import lombok.*; | |
| 5 | -import java.util.*; | |
| 6 | -import io.swagger.annotations.*; | |
| 4 | +import io.swagger.annotations.ApiModel; | |
| 5 | +import io.swagger.annotations.ApiModelProperty; | |
| 6 | +import lombok.Data; | |
| 7 | +import lombok.EqualsAndHashCode; | |
| 8 | +import lombok.ToString; | |
| 7 | 9 | |
| 8 | 10 | import javax.validation.Valid; |
| 9 | -import javax.validation.constraints.*; | |
| 11 | +import java.util.List; | |
| 10 | 12 | |
| 11 | 13 | @ApiModel("管理后台 - 商品spu创建 Request VO") |
| 12 | 14 | @Data |
| ... | ... | @@ -14,6 +16,7 @@ import javax.validation.constraints.*; |
| 14 | 16 | @ToString(callSuper = true) |
| 15 | 17 | public class ProductSpuCreateReqVO extends ProductSpuBaseVO { |
| 16 | 18 | |
| 19 | + // TODO @franky:这种可以缩写下,skus | |
| 17 | 20 | @ApiModelProperty(value = "sku组合") |
| 18 | 21 | @Valid |
| 19 | 22 | List<ProductSkuCreateReqVO> productSkuCreateReqVOS; | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java
| 1 | 1 | package cn.iocoder.yudao.module.product.dal.dataobject.spu; |
| 2 | 2 | |
| 3 | -import cn.hutool.log.Log; | |
| 4 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | 4 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 6 | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| 7 | 6 | import com.baomidou.mybatisplus.annotation.TableName; |
| 8 | 7 | import lombok.*; |
| 9 | 8 | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | 9 | /** |
| 13 | 10 | * 商品spu DO |
| 14 | 11 | * |
| ... | ... | @@ -48,7 +45,7 @@ public class ProductSpuDO extends BaseDO { |
| 48 | 45 | /** |
| 49 | 46 | * 商品主图地址,* 数组,以逗号分隔,最多上传15张 |
| 50 | 47 | */ |
| 51 | - // TODO franky:List<String> | |
| 48 | + // TODO franky:List<String>。可以参考别的模块,怎么处理这种类型的哈 | |
| 52 | 49 | private String picUrls; |
| 53 | 50 | /** |
| 54 | 51 | * 排序字段 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/CategoryService.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/CategoryServiceImpl.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuService.java
| 1 | 1 | package cn.iocoder.yudao.module.product.service.sku; |
| 2 | 2 | |
| 3 | -import java.util.*; | |
| 4 | -import javax.validation.*; | |
| 5 | -import cn.iocoder.yudao.module.product.controller.admin.sku.vo.*; | |
| 6 | -import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | |
| 7 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuExportReqVO; | |
| 6 | +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuUpdateReqVO; | |
| 8 | +import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | |
| 9 | + | |
| 10 | +import javax.validation.Valid; | |
| 11 | +import java.util.Collection; | |
| 12 | +import java.util.List; | |
| 8 | 13 | |
| 9 | 14 | /** |
| 10 | 15 | * 商品sku Service 接口 |
| ... | ... | @@ -67,8 +72,10 @@ public interface ProductSkuService { |
| 67 | 72 | */ |
| 68 | 73 | List<ProductSkuDO> getSkuList(ProductSkuExportReqVO exportReqVO); |
| 69 | 74 | |
| 75 | + // TODO @franky:validateSkus;skuCreateReqList => list | |
| 70 | 76 | /** |
| 71 | - *对sku的组合的属性等进行合法性校验 | |
| 77 | + * 对 sku 的组合的属性等进行合法性校验 | |
| 78 | + * | |
| 72 | 79 | * @param skuCreateReqList sku组合的集合 |
| 73 | 80 | */ |
| 74 | 81 | void validatedSkuReq(List<ProductSkuCreateReqVO> skuCreateReqList); |
| ... | ... | @@ -76,7 +83,7 @@ public interface ProductSkuService { |
| 76 | 83 | /** |
| 77 | 84 | * 批量保存sku |
| 78 | 85 | * @param skuDOList sku对象集合 |
| 79 | - * @return | |
| 86 | + * @return // TODO @franky:这里的 return 可以去掉;方法名可以改成 createSkus(list) | |
| 80 | 87 | */ |
| 81 | 88 | void batchSave(List<ProductSkuDO> skuDOList); |
| 82 | 89 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java
| ... | ... | @@ -88,6 +88,7 @@ public class ProductSkuServiceImpl implements ProductSkuService { |
| 88 | 88 | return productSkuMapper.selectList(exportReqVO); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | + // TODO @franky:这个方法,貌似实现的还是有点问题哈。例如说,throw 异常,后面还执行逻辑~ | |
| 91 | 92 | @Override |
| 92 | 93 | public void validatedSkuReq(List<ProductSkuCreateReqVO> skuCreateReqList) { |
| 93 | 94 | List<ProductSkuBaseVO.Property> skuPropertyList = skuCreateReqList.stream().flatMap(p -> p.getProperties().stream()).collect(Collectors.toList()); | ... | ... |