feature(商城): 商城review改
parent
2bd2cb56a1
commit
8c4e3db32b
|
@ -12,6 +12,6 @@ public class ProductPropertyValueUpdateReqVO extends ProductPropertyValueBaseVO
|
||||||
|
|
||||||
@ApiModelProperty(value = "主键", required = true, example = "1024")
|
@ApiModelProperty(value = "主键", required = true, example = "1024")
|
||||||
@NotNull(message = "主键不能为空")
|
@NotNull(message = "主键不能为空")
|
||||||
private Integer id;
|
private Long id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,9 +55,8 @@ public class ProductSpuDetailRespVO extends ProductSpuBaseVO {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @luowenfeng: categoryIds => categoryId,example 也要改下哈
|
@ApiModelProperty(value = "分类 id 数组,一直递归到一级父节点", example = "4")
|
||||||
@ApiModelProperty(value = "分类 id 数组,一直递归到一级父节点", example = "[1,2,4]")
|
private Long categoryId;
|
||||||
private Long categoryIds;
|
|
||||||
|
|
||||||
// TODO @芋艿:在瞅瞅~
|
// TODO @芋艿:在瞅瞅~
|
||||||
@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\"}]}]")
|
@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\"}]}]")
|
||||||
|
|
|
@ -25,10 +25,9 @@ public interface ProductPropertyMapper extends BaseMapperX<ProductPropertyDO> {
|
||||||
.orderByDesc(ProductPropertyDO::getId));
|
.orderByDesc(ProductPropertyDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @luowenfeng: selectByNameLike,这样更清晰哈。
|
|
||||||
default ProductPropertyDO selectByName(String name) {
|
default ProductPropertyDO selectByName(String name) {
|
||||||
return selectOne(new LambdaQueryWrapperX<ProductPropertyDO>()
|
return selectOne(new LambdaQueryWrapperX<ProductPropertyDO>()
|
||||||
.likeIfPresent(ProductPropertyDO::getName, name));
|
.eqIfPresent(ProductPropertyDO::getName, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,7 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ProductPropertyValueMapper extends BaseMapperX<ProductPropertyValueDO> {
|
public interface ProductPropertyValueMapper extends BaseMapperX<ProductPropertyValueDO> {
|
||||||
|
|
||||||
// TODO @luowenfeng: selectListByPropertyId 是不是就可以啦
|
default List<ProductPropertyValueDO> selectListByPropertyId(List<Long> propertyIds) {
|
||||||
default List<ProductPropertyValueDO> selectListByPropertyValueListByPropertyId(List<Long> propertyIds) {
|
|
||||||
return selectList(new LambdaQueryWrapperX<ProductPropertyValueDO>()
|
return selectList(new LambdaQueryWrapperX<ProductPropertyValueDO>()
|
||||||
.inIfPresent(ProductPropertyValueDO::getPropertyId, propertyIds));
|
.inIfPresent(ProductPropertyValueDO::getPropertyId, propertyIds));
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,7 @@ public interface ProductSkuMapper extends BaseMapperX<ProductSkuDO> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @luowenfeng: selectListByRemind,虽然不是很好,但是感觉会更清晰一些
|
default List<ProductSkuDO> selectListByRemind(){
|
||||||
default List<ProductSkuDO> selectRemindSpuIds(){
|
|
||||||
return selectList(new QueryWrapper<ProductSkuDO>().apply("stock <= warn_stock"));
|
return selectList(new QueryWrapper<ProductSkuDO>().apply("stock <= warn_stock"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ import javax.annotation.Resource;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_EXISTS;
|
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_EXISTS;
|
||||||
|
@ -58,8 +59,8 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
|
||||||
public void updateProperty(ProductPropertyUpdateReqVO updateReqVO) {
|
public void updateProperty(ProductPropertyUpdateReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validatePropertyExists(updateReqVO.getId());
|
this.validatePropertyExists(updateReqVO.getId());
|
||||||
// TODO @luowenfeng:如果是自己的情况下,名字相同也是 ok 的呀~
|
ProductPropertyDO productPropertyDO = productPropertyMapper.selectByName(updateReqVO.getName());
|
||||||
if (productPropertyMapper.selectByName(updateReqVO.getName()) != null) {
|
if (productPropertyDO != null && !productPropertyDO.getId().equals(updateReqVO.getId())) {
|
||||||
throw exception(PROPERTY_EXISTS);
|
throw exception(PROPERTY_EXISTS);
|
||||||
}
|
}
|
||||||
// 更新
|
// 更新
|
||||||
|
@ -97,10 +98,6 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
|
||||||
return ProductPropertyConvert.INSTANCE.convertPage(pageResult);
|
return ProductPropertyConvert.INSTANCE.convertPage(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ProductPropertyValueDO> getPropertyValueListByPropertyId(List<Long> propertyIds) {
|
|
||||||
return productPropertyValueMapper.selectListByPropertyValueListByPropertyId(propertyIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProductPropertyRespVO getProperty(Long id) {
|
public ProductPropertyRespVO getProperty(Long id) {
|
||||||
ProductPropertyDO property = productPropertyMapper.selectById(id);
|
ProductPropertyDO property = productPropertyMapper.selectById(id);
|
||||||
|
@ -117,7 +114,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
|
||||||
List<ProductPropertyRespVO> propertyList = getPropertyList(listReqVO);
|
List<ProductPropertyRespVO> propertyList = getPropertyList(listReqVO);
|
||||||
|
|
||||||
// 查询属性值
|
// 查询属性值
|
||||||
List<ProductPropertyValueDO> valueDOList = productPropertyValueMapper.selectListByPropertyValueListByPropertyId(CollectionUtils.convertList(propertyList, ProductPropertyRespVO::getId));
|
List<ProductPropertyValueDO> valueDOList = productPropertyValueMapper.selectListByPropertyId(CollectionUtils.convertList(propertyList, ProductPropertyRespVO::getId));
|
||||||
Map<Long, List<ProductPropertyValueDO>> valueDOMap = CollectionUtils.convertMultiMap(valueDOList, ProductPropertyValueDO::getPropertyId);
|
Map<Long, List<ProductPropertyValueDO>> valueDOMap = CollectionUtils.convertMultiMap(valueDOList, ProductPropertyValueDO::getPropertyId);
|
||||||
return CollectionUtils.convertList(propertyList, m -> {
|
return CollectionUtils.convertList(propertyList, m -> {
|
||||||
ProductPropertyAndValueRespVO productPropertyAndValueRespVO = ProductPropertyConvert.INSTANCE.convert(m);
|
ProductPropertyAndValueRespVO productPropertyAndValueRespVO = ProductPropertyConvert.INSTANCE.convert(m);
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_EXISTS;
|
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_EXISTS;
|
||||||
|
@ -42,8 +43,8 @@ public class ProductPropertyValueServiceImpl implements ProductPropertyValueServ
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updatePropertyValue(ProductPropertyValueUpdateReqVO updateReqVO) {
|
public void updatePropertyValue(ProductPropertyValueUpdateReqVO updateReqVO) {
|
||||||
// TODO @luowenfeng:如果是自己的情况下,名字相同也是 ok 的呀~
|
ProductPropertyValueDO productPropertyValueDO = productPropertyValueMapper.selectByName(updateReqVO.getPropertyId(), updateReqVO.getName());
|
||||||
if (productPropertyValueMapper.selectByName(updateReqVO.getPropertyId(), updateReqVO.getName()) != null) {
|
if (productPropertyValueDO != null && !productPropertyValueDO.getId().equals(updateReqVO.getId())) {
|
||||||
throw exception(PROPERTY_VALUE_EXISTS);
|
throw exception(PROPERTY_VALUE_EXISTS);
|
||||||
}
|
}
|
||||||
ProductPropertyValueDO convert = ProductPropertyValueConvert.INSTANCE.convert(updateReqVO);
|
ProductPropertyValueDO convert = ProductPropertyValueConvert.INSTANCE.convert(updateReqVO);
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class ProductSkuServiceImpl implements ProductSkuService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProductSkuDO> getRemindSpuIds() {
|
public List<ProductSkuDO> getRemindSpuIds() {
|
||||||
return productSkuMapper.selectRemindSpuIds();
|
return productSkuMapper.selectListByRemind();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -164,7 +164,6 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
||||||
});
|
});
|
||||||
respVO.setProductPropertyViews(productPropertyViews);
|
respVO.setProductPropertyViews(productPropertyViews);
|
||||||
}
|
}
|
||||||
respVO.setCategoryIds(respVO.getCategoryId());
|
|
||||||
}
|
}
|
||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue