添加商品关联推荐

This commit is contained in:
gong
2025-12-24 15:23:02 +08:00
parent 506e74747a
commit a6dd4f4611
12 changed files with 164 additions and 25 deletions

View File

@@ -72,6 +72,15 @@ public class UProductController {
return CzgResult.success(list);
}
/**
* 获取相关推荐商品
*/
@GetMapping("/related/{id}")
public CzgResult<List<ShopProductVo>> getRelatedProduct(@PathVariable("id") Long id) {
AssertUtil.isNull(id, "商品id不能为空");
return CzgResult.success(uProductService.queryProductRelatedList(id));
}
/**
* 小程序点餐-商品详情
*

View File

@@ -0,0 +1,36 @@
package com.czg.service;
import com.alibaba.fastjson2.JSONObject;
import com.czg.product.dto.ProductDTO;
import com.czg.product.service.ProductService;
import com.czg.product.service.UProductService;
import com.czg.product.vo.ShopGroupProductVo;
import com.czg.product.vo.ShopProductVo;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;
/**
* @author yjjie
* @date 2025/12/24 13:36
*/
@SpringBootTest
public class ProductTest {
@Resource
private ProductService productService;
@Resource
private UProductService uProductService;
@Test
public void testGetById() {
// ProductDTO product = productService.getProductById(169L);
// System.out.println(JSONObject.toJSONString( product));
List<ShopProductVo> productVos = uProductService.queryProductRelatedList(169L);
System.out.println(JSONObject.toJSONString(productVos));
}
}