【同步】BOOT 和 CLOUD 的功能(所有)

This commit is contained in:
YunaiV
2024-12-27 22:19:09 +08:00
parent c322c53b45
commit e5c036a60d
43 changed files with 338 additions and 95 deletions

View File

@@ -48,4 +48,9 @@ public class AppProductSpuRespVO {
@Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Integer salesCount;
// ========== 物流相关字段 =========
@Schema(description = "配送方式数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private List<Integer> deliveryTypes;
}

View File

@@ -78,7 +78,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
@Transactional(rollbackFor = Exception.class)
public void updateSpu(ProductSpuSaveReqVO updateReqVO) {
// 校验 SPU 是否存在
validateSpuExists(updateReqVO.getId());
ProductSpuDO spu = validateSpuExists(updateReqVO.getId());
// 校验分类、品牌
validateCategory(updateReqVO.getCategoryId());
brandService.validateProductBrand(updateReqVO.getBrandId());
@@ -87,7 +87,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
productSkuService.validateSkuList(skuSaveReqList, updateReqVO.getSpecType());
// 更新 SPU
ProductSpuDO updateObj = BeanUtils.toBean(updateReqVO, ProductSpuDO.class);
ProductSpuDO updateObj = BeanUtils.toBean(updateReqVO, ProductSpuDO.class).setStatus(spu.getStatus());
initSpuFromSkus(updateObj, skuSaveReqList);
productSpuMapper.updateById(updateObj);
// 批量更新 SKU
@@ -176,10 +176,12 @@ public class ProductSpuServiceImpl implements ProductSpuService {
productSkuService.deleteSkuBySpuId(id);
}
private void validateSpuExists(Long id) {
if (productSpuMapper.selectById(id) == null) {
private ProductSpuDO validateSpuExists(Long id) {
ProductSpuDO spuDO = productSpuMapper.selectById(id);
if (spuDO == null) {
throw exception(SPU_NOT_EXISTS);
}
return spuDO;
}
@Override