From 670c0962a76fbf8e393d347c78ae66b2c4af1ee0 Mon Sep 17 00:00:00 2001 From: niou233 <2922564446@qq.com> Date: Wed, 8 Nov 2023 17:03:37 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=9A=E5=91=98=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../favorite/ProductFavoriteController.java | 29 ++----------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/favorite/ProductFavoriteController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/favorite/ProductFavoriteController.java index 9157e8a05..6f66c2062 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/favorite/ProductFavoriteController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/favorite/ProductFavoriteController.java @@ -3,9 +3,7 @@ package cn.iocoder.yudao.module.product.controller.admin.favorite; import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; import cn.iocoder.yudao.module.product.controller.admin.favorite.vo.ProductFavoritePageReqVO; -import cn.iocoder.yudao.module.product.controller.admin.favorite.vo.ProductFavoriteReqVO; import cn.iocoder.yudao.module.product.controller.admin.favorite.vo.ProductFavoriteRespVO; import cn.iocoder.yudao.module.product.convert.favorite.ProductFavoriteConvert; import cn.iocoder.yudao.module.product.dal.dataobject.favorite.ProductFavoriteDO; @@ -16,7 +14,9 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.validation.Valid; @@ -37,21 +37,6 @@ public class ProductFavoriteController { @Resource private ProductSpuService productSpuService; - @PostMapping("/create") - @Operation(summary = "添加单个商品收藏") - @PreAuthorize("@ss.hasPermission('product:favorite:create')") - public CommonResult createFavorite(@Valid @RequestBody ProductFavoriteReqVO reqVO) { - return success(productFavoriteService.createFavorite(reqVO.getUserId(), reqVO.getSpuId())); - } - - @DeleteMapping("/delete") - @Operation(summary = "取消单个商品收藏") - @PreAuthorize("@ss.hasPermission('product:favorite:delete')") - public CommonResult deleteFavorite(@Valid @RequestBody ProductFavoriteReqVO reqVO) { - productFavoriteService.deleteFavorite(reqVO.getUserId(), reqVO.getSpuId()); - return success(Boolean.TRUE); - } - @GetMapping("/page") @Operation(summary = "获得商品收藏分页") @PreAuthorize("@ss.hasPermission('product:favorite:query')") @@ -72,12 +57,4 @@ public class ProductFavoriteController { return success(pageResult); } - - @PostMapping(value = "/exits") - @Operation(summary = "检查是否收藏过商品") - @PreAuthenticated - public CommonResult isFavoriteExists(@Valid @RequestBody ProductFavoriteReqVO reqVO) { - ProductFavoriteDO favorite = productFavoriteService.getFavorite(reqVO.getUserId(), reqVO.getSpuId()); - return success(favorite != null); - } }