|  |  | 
 |  |  | import com.matrix.system.shopXcx.dao.ShopShoppingCartDao; | 
 |  |  | import com.matrix.system.shopXcx.dao.ShopSkuDao; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import org.apache.commons.collections.CollectionUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  | 
 |  |  |     ShopSkuDao skuDao; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据ID删除购物车 | 
 |  |  |      * | 
 |  |  |      * @param | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "根据ID删除购物车", notes = "") | 
 |  |  |     @PostMapping("/deleteByCartId/{cartId}") | 
 |  |  |     @ResponseBody | 
 |  |  |     public AjaxResult deleteByCartId(@PathVariable("cartId") Integer cartId) { | 
 |  |  | 
 |  |  |         return new AjaxResult(AjaxResult.STATUS_SUCCESS, "删除成功"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 根据用户ID查询购物车 没有分页 | 
 |  |  |      * | 
 |  |  |      * @param | 
 |  |  |      * @return | 
 |  |  |      */ | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "根据用户ID查询购物车 没有分页", notes = "") | 
 |  |  |     @PostMapping("/findShoppingCart") | 
 |  |  |     @ResponseBody | 
 |  |  |     public AjaxResult getShoppingCartByUserId(@RequestBody ShopShoppingCart shoppingCart) { | 
 |  |  | 
 |  |  |         return result; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 批量删除 | 
 |  |  |      */ | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "批量删除", notes = "") | 
 |  |  |     @PostMapping(value = "/delShoppingCart/{keys}") | 
 |  |  |     public | 
 |  |  |     @ResponseBody | 
 |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping(value = "/getUserCartCount/{shopId}") | 
 |  |  |     @ApiOperation(value = "查询微商城购物车数量", notes = "") | 
 |  |  |     @PostMapping(value = "/getUserCartCount/{shopId}/{cartType}") | 
 |  |  |     public | 
 |  |  |     @ResponseBody | 
 |  |  |     AjaxResult getUserCartCount(@PathVariable("shopId") Long shopId) { | 
 |  |  |     AjaxResult getUserCartCount(@PathVariable("shopId") Long shopId,@PathVariable("cartType") Integer cartType) { | 
 |  |  |         BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); | 
 |  |  |         Integer userCartCount = shoppingCartDao.selectUserCartCount(shopId, loginUser.getOpenId()); | 
 |  |  |         Integer userCartCount = shoppingCartDao.selectUserCartCount(shopId, loginUser.getOpenId(),cartType); | 
 |  |  |         if (userCartCount == null) { | 
 |  |  |             userCartCount = 0; | 
 |  |  |         } | 
 |  |  | 
 |  |  |         shoppingCart.setCreateBy(loginUser.getOpenId()); | 
 |  |  |         shoppingCart.setUpdateBy(loginUser.getOpenId()); | 
 |  |  |         shoppingCart.setCartUserId(loginUser.getOpenId()); | 
 |  |  |         shoppingCart.setCartType(ShopShoppingCart.CAR_TYPE_MICRO); | 
 |  |  |         ShopShoppingCart shoppCartLimt = shoppingCartDao.selectBuyLimit(shoppingCart.getCartProductId(), | 
 |  |  |                 shoppingCart.getCartSkuId()); | 
 |  |  |         // Integer buyLimitNum = 0; | 
 |  |  | 
 |  |  |             return new AjaxResult(AjaxResult.STATUS_FAIL, "保存失败"); | 
 |  |  |         } | 
 |  |  |         int userCartCount = shoppingCartDao.selectUserCartCount(shoppingCart.getShopId(), | 
 |  |  |                 loginUser.getOpenId()); | 
 |  |  |                 loginUser.getOpenId(),shoppingCart.getCartType()); | 
 |  |  |         AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, "保存成功"); | 
 |  |  |         result.putInMap("userCartCount", userCartCount); | 
 |  |  |         return result; | 
 |  |  | 
 |  |  |     @ResponseBody | 
 |  |  |     public AjaxResult updateCartAllSelected(@PathVariable("isSelected") Integer isSelected, | 
 |  |  |                                             @PathVariable("shopId") Long shopId,@PathVariable("cartType") Integer cartType) { | 
 |  |  |         Map<String, Object> modifyMap = new HashMap<>(); | 
 |  |  |         BizUser user = redisUserLoginUtils.getLoginUser(BizUser.class); | 
 |  |  |         shoppingCartDao.updateAllSelected(user.getOpenId(),shopId, isSelected,cartType); | 
 |  |  |         return new AjaxResult(AjaxResult.STATUS_SUCCESS, "修改成功"); |