收音机 / 客户端 商品列表

This commit is contained in:
2026-04-09 17:01:09 +08:00
parent 3448331b31
commit 084baf89b1
3 changed files with 11 additions and 9 deletions

View File

@@ -15,7 +15,6 @@ import com.czg.product.param.*;
import com.czg.product.service.ProdConsRelationService;
import com.czg.product.service.ProductService;
import com.czg.product.service.ShopSyncService;
import com.czg.product.service.UProductService;
import com.czg.product.vo.ProductStatisticsVo;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
@@ -30,7 +29,6 @@ import jakarta.servlet.http.HttpServletResponse;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@@ -84,9 +82,8 @@ public class ProductController {
*/
@GetMapping("list")
@OperationLog("商品-列表")
public CzgResult<List<ProductDTO>> getProductList(@RequestParam Long categoryId) {
List<ProductDTO> productList = productService.getProductCacheList(StpKit.USER.getShopId(), categoryId);
return CzgResult.success(productList);
public CzgResult<Map<String, Object>> getProductList(@RequestParam Long categoryId) {
return CzgResult.success(productService.getProductCacheList(StpKit.USER.getShopId(), categoryId));
}
/**

View File

@@ -9,6 +9,7 @@ import com.mybatisflex.core.service.IService;
import jakarta.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 商品
@@ -42,7 +43,7 @@ public interface ProductService extends IService<Product> {
* @param categoryId 商品分类ID
* @return 商品列表数据
*/
List<ProductDTO> getProductCacheList(Long shopId, Long categoryId);
Map<String, Object> getProductCacheList(Long shopId, Long categoryId);
/**
* 清除某个商品分类的缓存

View File

@@ -181,7 +181,10 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
lowMemberPriceIsPresent.ifPresent(record::setLowMemberPrice);
}
record.setSkuList(skuList);
record.setProdConsRelations(prodConsRelationMapper.selectListByQuery(query().eq(ProdConsRelation::getProductId, record.getId()).eq(ProdConsRelation::getShopId, record.getShopId())));
record.setProdConsRelations(prodConsRelationMapper.selectListByQuery(query()
.eq(ProdConsRelation::getProductId, record.getId())
.eq(ConsInfo::getStatus, SystemConstants.OneZero.ONE)
.eq(ProdConsRelation::getShopId, record.getShopId())));
});
return records;
}
@@ -334,7 +337,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
}
@Override
public List<ProductDTO> getProductCacheList(Long shopId, Long categoryId) {
public Map<String, Object> getProductCacheList(Long shopId, Long categoryId) {
String key = ADMIN_CLIENT_PRODUCT_LIST + "::" + shopId + "::" + categoryId;
List<ProductDTO> list;
if (!redisService.hasKey(key)) {
@@ -349,7 +352,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
.sorted(Comparator.comparingInt(ProductDTO::getSort).reversed())
.sorted(Comparator.comparingLong(ProductDTO::getId).reversed())
.toList();
return list;
List<ConsInfo> consInfos = consInfoMapper.selectListByQuery(query().eq(ConsInfo::getShopId, shopId).eq(ConsInfo::getStatus, SystemConstants.OneZero.ONE));
return Map.of("productList", list, "cons", consInfos);
}
/**