PC端/收银机商品查询增加缓存
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user