根据拼团ID查询商品详情
This commit is contained in:
parent
1fe3cb369e
commit
ab90c26311
@ -2,6 +2,8 @@ package com.yzt.front.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.yzt.common.model.combination.StoreCombination;
|
||||
import com.yzt.common.model.combination.StorePink;
|
||||
import com.yzt.common.model.product.StoreProduct;
|
||||
import com.yzt.common.page.CommonPage;
|
||||
import com.yzt.common.request.ClaimProductRequest;
|
||||
import com.yzt.common.request.PageParamRequest;
|
||||
@ -10,6 +12,7 @@ import com.yzt.common.response.*;
|
||||
import com.yzt.common.result.CommonResult;
|
||||
import com.yzt.service.service.StoreCombinationService;
|
||||
import com.yzt.service.service.StorePinkService;
|
||||
import com.yzt.service.service.StoreProductService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -33,6 +36,9 @@ public class CombinationController {
|
||||
@Autowired
|
||||
private StorePinkService storePinkService;
|
||||
|
||||
@Autowired
|
||||
private StoreProductService storeProductService;
|
||||
|
||||
/**
|
||||
* 拼团首页
|
||||
*/
|
||||
@ -119,4 +125,30 @@ public class CombinationController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据拼团ID查询商品详情
|
||||
*/
|
||||
@ApiOperation(value = "根据拼团ID查询商品详情")
|
||||
@RequestMapping(value = "/product/{pinkId}", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProduct> getProductByPinkId(@PathVariable(value = "pinkId") Integer pinkId) {
|
||||
try {
|
||||
// 根据拼团ID查询拼团信息
|
||||
StorePink storePink = storePinkService.getById(pinkId);
|
||||
if (storePink == null) {
|
||||
return CommonResult.failed("拼团信息不存在");
|
||||
}
|
||||
|
||||
// 根据商品ID查询商品基本信息
|
||||
StoreProduct storeProduct = storeProductService.getById(storePink.getPid());
|
||||
if (storeProduct == null) {
|
||||
return CommonResult.failed("商品信息不存在");
|
||||
}
|
||||
|
||||
return CommonResult.success(storeProduct);
|
||||
} catch (Exception e) {
|
||||
log.error("根据拼团ID查询商品详情失败: {}", e.getMessage(), e);
|
||||
return CommonResult.failed(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user