From b4990fac3b5cd0a936369dc51f8b3593b6478730 Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Thu, 18 Mar 2021 17:01:11 +0800
Subject: [PATCH] 积分商城4

---
 zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java |   33 ++++++++++++---------------------
 zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml            |    4 ++--
 zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java         |    4 ++--
 3 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
index e01efca..051afbe 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShoppingCartAction.java
@@ -17,6 +17,7 @@
 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.*;
@@ -50,12 +51,8 @@
     ShopSkuDao skuDao;
 
 
-    /**
-     * 根据ID删除购物车
-     *
-     * @param
-     * @return
-     */
+
+    @ApiOperation(value = "根据ID删除购物车", notes = "")
     @PostMapping("/deleteByCartId/{cartId}")
     @ResponseBody
     public AjaxResult deleteByCartId(@PathVariable("cartId") Integer cartId) {
@@ -66,12 +63,8 @@
         return new AjaxResult(AjaxResult.STATUS_SUCCESS, "删除成功");
     }
 
-    /**
-     * 根据用户ID查询购物车 没有分页
-     *
-     * @param
-     * @return
-     */
+
+    @ApiOperation(value = "根据用户ID查询购物车 没有分页", notes = "")
     @PostMapping("/findShoppingCart")
     @ResponseBody
     public AjaxResult getShoppingCartByUserId(@RequestBody ShopShoppingCart shoppingCart) {
@@ -86,9 +79,8 @@
         return result;
     }
 
-    /**
-     * 批量删除
-     */
+
+    @ApiOperation(value = "批量删除", notes = "")
     @PostMapping(value = "/delShoppingCart/{keys}")
     public
     @ResponseBody
@@ -102,12 +94,13 @@
         }
     }
 
-    @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;
         }
@@ -136,7 +129,6 @@
         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;
@@ -195,7 +187,7 @@
             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;
@@ -279,7 +271,6 @@
     @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, "修改成功");
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java
index 89a5eb1..e0824de 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/dao/ShopShoppingCartDao.java
@@ -42,9 +42,9 @@
 
 	public ShopShoppingCart selectBuyLimit(@Param("cartProductId") Integer cartProductId,@Param("cartSkuId") Integer cartSkuId);
 
-	public Integer selectUserCartCount(@Param("shopId")Long shopId, @Param("openId")String openId);
+	public Integer selectUserCartCount(@Param("shopId")Long shopId, @Param("openId")String openId,@Param("cartType") Integer cartType);
 
-	public int updateAllSelected(@Param("openId") String openId, @Param("shopId") Long shopId,  @Param("isSelected") Integer isSelected,@Param("artType") Integer artType);
+	public int updateAllSelected(@Param("openId") String openId, @Param("shopId") Long shopId,  @Param("isSelected") Integer isSelected,@Param("cartType") Integer cartType);
 
 	/**
 	 * 删除用户选中的购物车明细
diff --git a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml
index 68b9909..2beb6dd 100644
--- a/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml
+++ b/zq-erp/src/main/resources/mybatis/mapper/xcxShop/ShopShoppingCartDao.xml
@@ -223,7 +223,7 @@
 
 	<update id="updateAllSelected" >
 
-		update shop_shopping_cart set isSelected  = #{isSelected}  where  shop_id=#{shopId} and cart_user_id=#{openId} and art_type=#{artType}
+		update shop_shopping_cart set isSelected  = #{isSelected}  where  shop_id=#{shopId} and cart_user_id=#{openId} and cart_type=#{cartType}
 
 	</update>
 
@@ -363,7 +363,7 @@
 	<select id="selectUserCartCount" resultType="java.lang.Integer" >
 		select sum(cart_number) from shop_shopping_cart  c
 LEFT JOIN shop_product p on p.id = c.cart_product_id
-where c.shop_Id=#{shopId} and  p.del_flag = 2 and cart_user_id=#{openId};
+where c.shop_Id=#{shopId} and  p.del_flag = 2 and cart_user_id=#{openId} and cart_type=#{cartType};
 	</select>
 
 	<!-- 根据id 锁表查询-->

--
Gitblit v1.9.1