mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 01:59:20 +08:00
perf(ecom-dmb): 商品卡片保存改为就地更新,无需重新加载全量列表
后端:
- UpdateProductResultDTO 新增 product 字段,返回更新后的完整商品信息
前端:
- ProductVO.UpdateProductResult 新增 product 字段
- ProductCard 保存成功后 emit('updated', product) 携带商品数据
- ProductGridView.refreshTable(product) 收到数据后原地替换 productList 中对应商品,无需重新请求列表
This commit is contained in:
+7
@@ -2,6 +2,7 @@ package top.xyquan.ecomdmbbackend.modules.ecom.product.model.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import top.xyquan.ecomdmbbackend.modules.ecom.product.model.vo.ProductVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,4 +18,10 @@ public class UpdateProductResultDTO {
|
||||
*/
|
||||
@Schema(description = "成本发生变更的规格ID列表")
|
||||
private List<Long> costChangedSpecIds;
|
||||
|
||||
/**
|
||||
* 更新后的商品完整信息
|
||||
*/
|
||||
@Schema(description = "更新后的商品完整信息")
|
||||
private ProductVO product;
|
||||
}
|
||||
|
||||
+8
@@ -316,6 +316,14 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductPO> im
|
||||
// 返回结果
|
||||
UpdateProductResultDTO result = new UpdateProductResultDTO();
|
||||
result.setCostChangedSpecIds(costChangedSpecIds);
|
||||
|
||||
// 重新查询更新后的商品完整信息
|
||||
ProductPO updatedProduct = this.getById(id);
|
||||
if (updatedProduct != null) {
|
||||
ProductVO productVO = convertToVO(updatedProduct);
|
||||
result.setProduct(productVO);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user