Commit 670c0962a76fbf8e393d347c78ae66b2c4af1ee0
1 parent
cbaadc3a
refactor: 会员商品收藏
Showing
1 changed file
with
3 additions
and
26 deletions
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; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; | |
| 7 | 6 | import cn.iocoder.yudao.module.product.controller.admin.favorite.vo.ProductFavoritePageReqVO; |
| 8 | -import cn.iocoder.yudao.module.product.controller.admin.favorite.vo.ProductFavoriteReqVO; | |
| 9 | 7 | import cn.iocoder.yudao.module.product.controller.admin.favorite.vo.ProductFavoriteRespVO; |
| 10 | 8 | import cn.iocoder.yudao.module.product.convert.favorite.ProductFavoriteConvert; |
| 11 | 9 | import cn.iocoder.yudao.module.product.dal.dataobject.favorite.ProductFavoriteDO; |
| ... | ... | @@ -16,7 +14,9 @@ import io.swagger.v3.oas.annotations.Operation; |
| 16 | 14 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 17 | 15 | import org.springframework.security.access.prepost.PreAuthorize; |
| 18 | 16 | import org.springframework.validation.annotation.Validated; |
| 19 | -import org.springframework.web.bind.annotation.*; | |
| 17 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 18 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 19 | +import org.springframework.web.bind.annotation.RestController; | |
| 20 | 20 | |
| 21 | 21 | import javax.annotation.Resource; |
| 22 | 22 | import javax.validation.Valid; |
| ... | ... | @@ -37,21 +37,6 @@ public class ProductFavoriteController { |
| 37 | 37 | @Resource |
| 38 | 38 | private ProductSpuService productSpuService; |
| 39 | 39 | |
| 40 | - @PostMapping("/create") | |
| 41 | - @Operation(summary = "添加单个商品收藏") | |
| 42 | - @PreAuthorize("@ss.hasPermission('product:favorite:create')") | |
| 43 | - public CommonResult<Long> createFavorite(@Valid @RequestBody ProductFavoriteReqVO reqVO) { | |
| 44 | - return success(productFavoriteService.createFavorite(reqVO.getUserId(), reqVO.getSpuId())); | |
| 45 | - } | |
| 46 | - | |
| 47 | - @DeleteMapping("/delete") | |
| 48 | - @Operation(summary = "取消单个商品收藏") | |
| 49 | - @PreAuthorize("@ss.hasPermission('product:favorite:delete')") | |
| 50 | - public CommonResult<Boolean> deleteFavorite(@Valid @RequestBody ProductFavoriteReqVO reqVO) { | |
| 51 | - productFavoriteService.deleteFavorite(reqVO.getUserId(), reqVO.getSpuId()); | |
| 52 | - return success(Boolean.TRUE); | |
| 53 | - } | |
| 54 | - | |
| 55 | 40 | @GetMapping("/page") |
| 56 | 41 | @Operation(summary = "获得商品收藏分页") |
| 57 | 42 | @PreAuthorize("@ss.hasPermission('product:favorite:query')") |
| ... | ... | @@ -72,12 +57,4 @@ public class ProductFavoriteController { |
| 72 | 57 | |
| 73 | 58 | return success(pageResult); |
| 74 | 59 | } |
| 75 | - | |
| 76 | - @PostMapping(value = "/exits") | |
| 77 | - @Operation(summary = "检查是否收藏过商品") | |
| 78 | - @PreAuthenticated | |
| 79 | - public CommonResult<Boolean> isFavoriteExists(@Valid @RequestBody ProductFavoriteReqVO reqVO) { | |
| 80 | - ProductFavoriteDO favorite = productFavoriteService.getFavorite(reqVO.getUserId(), reqVO.getSpuId()); | |
| 81 | - return success(favorite != null); | |
| 82 | - } | |
| 83 | 60 | } | ... | ... |