|
@@ -18,10 +18,7 @@ import java.util.Objects;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
import static cn.iocoder.yudao.module.product.enums.favorite.ProductFavoriteTypeEnum.COLLECT;
|
|
|
|
|
|
-/**
|
|
|
- * @author jason
|
|
|
- */
|
|
|
-@Tag(name = "用户 APP - 喜爱商品")
|
|
|
+@Tag(name = "用户 APP - 商品收藏")
|
|
|
@RestController
|
|
|
@RequestMapping("/product/favorite")
|
|
|
public class AppFavoriteController {
|
|
@@ -29,6 +26,7 @@ public class AppFavoriteController {
|
|
|
@Resource
|
|
|
private ProductFavoriteService productFavoriteService;
|
|
|
|
|
|
+ // TODO @jason:创建;create
|
|
|
@PostMapping(value = "/collect")
|
|
|
@Operation(summary = "商品收藏")
|
|
|
public CommonResult<Boolean> collect(@RequestBody @Valid AppFavoriteReqVO reqVO) {
|
|
@@ -36,16 +34,22 @@ public class AppFavoriteController {
|
|
|
return success(productFavoriteService.collect(reqVO));
|
|
|
}
|
|
|
|
|
|
+ // TODO @jason:创建;delete;使用 @DeleteMapping
|
|
|
@PostMapping(value = "/cancelCollect")
|
|
|
@Operation(summary = "取消商品收藏(通过商品详情)")
|
|
|
public CommonResult<Boolean> cancelCollect(@RequestBody @Valid AppFavoriteReqVO reqVO) {
|
|
|
+ // TODO @jason:是不是不用校验呀?
|
|
|
Assert.isTrue(Objects.equals(COLLECT.getType(), reqVO.getType()), "参数type 不匹配");
|
|
|
return success(productFavoriteService.cancelCollect(reqVO));
|
|
|
}
|
|
|
|
|
|
+ // TODO @jason:page;分页
|
|
|
@GetMapping(value = "/collectList")
|
|
|
@Operation(summary = "商品收藏列表")
|
|
|
public CommonResult<PageResult<AppFavoriteRespVO>> pageCollectList(AppFavoritePageReqVO reqVO) {
|
|
|
return success(productFavoriteService.pageCollectList(reqVO));
|
|
|
}
|
|
|
+
|
|
|
+ // TODO @json:需要在给一个,用户查询某个商品是否收藏;详情页要用
|
|
|
+
|
|
|
}
|