From 4b628f61b361ce982dbae40d77e27f89dbe7aee8 Mon Sep 17 00:00:00 2001 From: zhoushen <2013650704@qq.com> Date: Tue, 10 Dec 2024 21:39:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OmsCartItemController.java | 111 ------------------ 1 file changed, 111 deletions(-) diff --git a/mall-portal/src/main/java/com/macro/mall/portal/controller/OmsCartItemController.java b/mall-portal/src/main/java/com/macro/mall/portal/controller/OmsCartItemController.java index 47f39b2..e69de29 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/controller/OmsCartItemController.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/controller/OmsCartItemController.java @@ -1,111 +0,0 @@ -package com.macro.mall.portal.controller; - -import com.macro.mall.common.api.CommonResult; -import com.macro.mall.model.OmsCartItem; -import com.macro.mall.portal.domain.CartProduct; -import com.macro.mall.portal.domain.CartPromotionItem; -import com.macro.mall.portal.service.OmsCartItemService; -import com.macro.mall.portal.service.UmsMemberService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 购物车管理Controller - * Created by macro on 2018/8/2. - */ -@Controller -@Api(tags = "OmsCartItemController") -@Tag(name = "OmsCartItemController", description = "购物车管理") -@RequestMapping("/cart") -public class OmsCartItemController { - @Autowired - private OmsCartItemService cartItemService; - @Autowired - private UmsMemberService memberService; - - @ApiOperation("添加商品到购物车") - @RequestMapping(value = "/add", method = RequestMethod.POST) - @ResponseBody - public CommonResult add(@RequestBody OmsCartItem cartItem) { - int count = cartItemService.add(cartItem); - if (count > 0) { - return CommonResult.success(count); - } - return CommonResult.failed(); - } - - @ApiOperation("获取当前会员的购物车列表") - @RequestMapping(value = "/list", method = RequestMethod.GET) - @ResponseBody - public CommonResult> list() { - List cartItemList = cartItemService.list(memberService.getCurrentMember().getId()); - return CommonResult.success(cartItemList); - } - - @ApiOperation("获取当前会员的购物车列表,包括促销信息") - @RequestMapping(value = "/list/promotion", method = RequestMethod.GET) - @ResponseBody - public CommonResult> listPromotion(@RequestParam(required = false) List cartIds) { - List cartPromotionItemList = cartItemService.listPromotion(memberService.getCurrentMember().getId(), cartIds); - return CommonResult.success(cartPromotionItemList); - } - - @ApiOperation("修改购物车中指定商品的数量") - @RequestMapping(value = "/update/quantity", method = RequestMethod.GET) - @ResponseBody - public CommonResult updateQuantity(@RequestParam Long id, - @RequestParam Integer quantity) { - int count = cartItemService.updateQuantity(id, memberService.getCurrentMember().getId(), quantity); - if (count > 0) { - return CommonResult.success(count); - } - return CommonResult.failed(); - } - - @ApiOperation("获取购物车中指定商品的规格,用于重选规格") - @RequestMapping(value = "/getProduct/{productId}", method = RequestMethod.GET) - @ResponseBody - public CommonResult getCartProduct(@PathVariable Long productId) { - CartProduct cartProduct = cartItemService.getCartProduct(productId); - return CommonResult.success(cartProduct); - } - - @ApiOperation("修改购物车中商品的规格") - @RequestMapping(value = "/update/attr", method = RequestMethod.POST) - @ResponseBody - public CommonResult updateAttr(@RequestBody OmsCartItem cartItem) { - int count = cartItemService.updateAttr(cartItem); - if (count > 0) { - return CommonResult.success(count); - } - return CommonResult.failed(); - } - - @ApiOperation("删除购物车中的指定商品") - @RequestMapping(value = "/delete", method = RequestMethod.POST) - @ResponseBody - public CommonResult delete(@RequestParam("ids") List ids) { - int count = cartItemService.delete(memberService.getCurrentMember().getId(), ids); - if (count > 0) { - return CommonResult.success(count); - } - return CommonResult.failed(); - } - - @ApiOperation("清空当前会员的购物车") - @RequestMapping(value = "/clear", method = RequestMethod.POST) - @ResponseBody - public CommonResult clear() { - int count = cartItemService.clear(memberService.getCurrentMember().getId()); - if (count > 0) { - return CommonResult.success(count); - } - return CommonResult.failed(); - } -}