Commit 412c017f210358d60d766e1f9c6a03944be5c973
1 parent
69c87f8b
code review 商品模块
Showing
10 changed files
with
16 additions
and
6 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java
| ... | ... | @@ -55,9 +55,11 @@ public class ProductSpuDetailRespVO extends ProductSpuBaseVO { |
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | + // TODO @luowenfeng: categoryIds => categoryId,example 也要改下哈 | |
| 58 | 59 | @ApiModelProperty(value = "分类 id 数组,一直递归到一级父节点", example = "[1,2,4]") |
| 59 | 60 | private Long categoryIds; |
| 60 | 61 | |
| 62 | + // TODO @芋艿:在瞅瞅~ | |
| 61 | 63 | @ApiModelProperty(value = "规格属性修改和详情展示组合", example = "[{\"propertyId\":2,\"name\":\"内存\",\"propertyValues\":[{\"v1\":11,\"v2\":\"64G\"},{\"v1\":10,\"v2\":\"32G\"}]},{\"propertyId\":3,\"name\":\"尺寸\",\"propertyValues\":[{\"v1\":16,\"v2\":\"6.1\"},{\"v1\":15,\"v2\":\"5.7\"}]}]") |
| 62 | 64 | private List<ProductPropertyViewRespVO> productPropertyViews; |
| 63 | 65 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java
| ... | ... | @@ -26,8 +26,8 @@ public interface ProductPropertyConvert { |
| 26 | 26 | ProductPropertyDO convert(ProductPropertyCreateReqVO bean); |
| 27 | 27 | |
| 28 | 28 | ProductPropertyDO convert(ProductPropertyUpdateReqVO bean); |
| 29 | - ProductPropertyAndValueRespVO convert(ProductPropertyRespVO bean); | |
| 30 | 29 | |
| 30 | + ProductPropertyAndValueRespVO convert(ProductPropertyRespVO bean); | |
| 31 | 31 | |
| 32 | 32 | ProductPropertyRespVO convert(ProductPropertyDO bean); |
| 33 | 33 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyMapper.java
| ... | ... | @@ -25,6 +25,7 @@ public interface ProductPropertyMapper extends BaseMapperX<ProductPropertyDO> { |
| 25 | 25 | .orderByDesc(ProductPropertyDO::getId)); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | + // TODO @luowenfeng: selectByNameLike,这样更清晰哈。 | |
| 28 | 29 | default ProductPropertyDO selectByName(String name) { |
| 29 | 30 | return selectOne(new LambdaQueryWrapperX<ProductPropertyDO>() |
| 30 | 31 | .likeIfPresent(ProductPropertyDO::getName, name)); | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyValueMapper.java
| ... | ... | @@ -17,6 +17,7 @@ import java.util.List; |
| 17 | 17 | @Mapper |
| 18 | 18 | public interface ProductPropertyValueMapper extends BaseMapperX<ProductPropertyValueDO> { |
| 19 | 19 | |
| 20 | + // TODO @luowenfeng: selectListByPropertyId 是不是就可以啦 | |
| 20 | 21 | default List<ProductPropertyValueDO> selectListByPropertyValueListByPropertyId(List<Long> propertyIds) { |
| 21 | 22 | return selectList(new LambdaQueryWrapperX<ProductPropertyValueDO>() |
| 22 | 23 | .inIfPresent(ProductPropertyValueDO::getPropertyId, propertyIds)); | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/sku/ProductSkuMapper.java
| ... | ... | @@ -39,7 +39,10 @@ public interface ProductSkuMapper extends BaseMapperX<ProductSkuDO> { |
| 39 | 39 | this.update(null, lambdaUpdateWrapper); |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | + | |
| 43 | + // TODO @luowenfeng: selectListByRemind,虽然不是很好,但是感觉会更清晰一些 | |
| 42 | 44 | default List<ProductSkuDO> selectRemindSpuIds(){ |
| 43 | 45 | return selectList(new QueryWrapper<ProductSkuDO>().apply("stock <= warn_stock")); |
| 44 | 46 | } |
| 47 | + | |
| 45 | 48 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImpl.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyService.java
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java
| ... | ... | @@ -43,7 +43,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { |
| 43 | 43 | @Transactional(rollbackFor = Exception.class) |
| 44 | 44 | public Long createProperty(ProductPropertyCreateReqVO createReqVO) { |
| 45 | 45 | // 校验存在 |
| 46 | - if(productPropertyMapper.selectByName(createReqVO.getName()) != null){ | |
| 46 | + if (productPropertyMapper.selectByName(createReqVO.getName()) != null) { | |
| 47 | 47 | throw exception(PROPERTY_EXISTS); |
| 48 | 48 | } |
| 49 | 49 | // 插入 |
| ... | ... | @@ -58,7 +58,8 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { |
| 58 | 58 | public void updateProperty(ProductPropertyUpdateReqVO updateReqVO) { |
| 59 | 59 | // 校验存在 |
| 60 | 60 | this.validatePropertyExists(updateReqVO.getId()); |
| 61 | - if(productPropertyMapper.selectByName(updateReqVO.getName()) != null){ | |
| 61 | + // TODO @luowenfeng:如果是自己的情况下,名字相同也是 ok 的呀~ | |
| 62 | + if (productPropertyMapper.selectByName(updateReqVO.getName()) != null) { | |
| 62 | 63 | throw exception(PROPERTY_EXISTS); |
| 63 | 64 | } |
| 64 | 65 | // 更新 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueServiceImpl.java
| ... | ... | @@ -19,9 +19,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU |
| 19 | 19 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_EXISTS; |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * <p> | |
| 23 | - * 规格值 Service 实现类 | |
| 24 | - * </p> | |
| 22 | + * 规格值 Service 实现类 | |
| 25 | 23 | * |
| 26 | 24 | * @author LuoWenFeng |
| 27 | 25 | */ |
| ... | ... | @@ -44,6 +42,7 @@ public class ProductPropertyValueServiceImpl implements ProductPropertyValueServ |
| 44 | 42 | |
| 45 | 43 | @Override |
| 46 | 44 | public void updatePropertyValue(ProductPropertyValueUpdateReqVO updateReqVO) { |
| 45 | + // TODO @luowenfeng:如果是自己的情况下,名字相同也是 ok 的呀~ | |
| 47 | 46 | if (productPropertyValueMapper.selectByName(updateReqVO.getPropertyId(), updateReqVO.getName()) != null) { |
| 48 | 47 | throw exception(PROPERTY_VALUE_EXISTS); |
| 49 | 48 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java
| ... | ... | @@ -38,6 +38,7 @@ import java.util.stream.Stream; |
| 38 | 38 | import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; |
| 39 | 39 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 40 | 40 | |
| 41 | +// TODO @芋艿:review 下单元测试 | |
| 41 | 42 | /** |
| 42 | 43 | * {@link ProductSpuServiceImpl} 的单元测试类 |
| 43 | 44 | * | ... | ... |