添加商品关联推荐
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序点餐-商品详情
|
||||
*
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user