PC端/收银机商品查询增加缓存

This commit is contained in:
Tankaikai
2025-03-27 10:30:16 +08:00
parent ef62920a60
commit 43afa5b4a2
9 changed files with 115 additions and 19 deletions

View File

@@ -61,7 +61,10 @@ public class ProductController {
@OperationLog("商品-列表")
//@SaAdminCheckPermission("product:list")
public CzgResult<List<ProductDTO>> getProductList(ProductDTO param) {
Long shopId = StpKit.USER.getShopId(0L);
param.setShopId(shopId);
List<ProductDTO> data = productService.getProductList(param);
productService.refreshProductStock(param, data);
return CzgResult.success(data);
}

View File

@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
@@ -39,6 +40,7 @@ public class UProductController {
public CzgResult<List<ShopProductVo>> queryHotsProductList() {
Long shopId = StpKit.USER.getShopId(0L);
List<ShopProductVo> list = uProductService.queryHotsProductList(shopId);
uProductService.refreshProductStock(shopId, list);
return CzgResult.success(list);
}
@@ -49,6 +51,10 @@ public class UProductController {
public CzgResult<List<ShopGroupProductVo>> queryGroupProductList() {
Long shopId = StpKit.USER.getShopId(0L);
List<ShopGroupProductVo> list = uProductService.queryGroupProductList(shopId);
Map<Long, Integer> productStock = uProductService.findShopProductStock(shopId);
list.forEach(item -> {
uProductService.refreshProductStock(productStock, item.getProductList());
});
return CzgResult.success(list);
}