‘linchangsheng’ 1 week ago
parent
commit
4a66e77c10

+ 1 - 1
src/main/java/com/gree/mall/miniapp/commonmapper/AppMapper.java

@@ -23,7 +23,7 @@ public interface AppMapper {
      * @return
      */
     @InterceptorIgnore(tenantLine = "1", blockAttack = "1", illegalSql = "1")
-    public List<ShoppingCartList> queryShoppingCartList(@Param("userId") String userId);
+    public List<ShoppingCartList> queryShoppingCartList(@Param("userId") String userId,@Param("websitId") String websitId);
 
 
     /**

+ 10 - 6
src/main/java/com/gree/mall/miniapp/logic/order/ShoppingCartLogic.java

@@ -63,9 +63,9 @@ public class ShoppingCartLogic {
      * 查询购物车
      */
     public ShoppingCartDetail queryShoppingCart(String userId) throws InterruptedException {
-
-        List<ShoppingCartList> list = appMapper.queryShoppingCartList(userId);
         User user = userService.getById(userId);
+        List<ShoppingCartList> list = appMapper.queryShoppingCartList(userId,user.getWebsitId());
+
         String promotionGroupUserId = user.getPromotionGroupUserId();
         if(user.getPromotionGroupLeader()){
             promotionGroupUserId = user.getUserId();
@@ -144,8 +144,10 @@ public class ShoppingCartLogic {
             if(user.getType().equals(UserTypeEnum.GENERAL.toString())) {
                 shoppingCart.setWxSceneId(buyGood.getWxSceneId());
             }
-            shoppingCart.setCompanyId(currentCompanyWechat.getCurrentCompanyWechatId());
-            shoppingCart.setCompanyName(currentCompanyWechat.getCurrentCompanyName());
+            shoppingCart.setCompanyId(user.getCompanyId());
+            shoppingCart.setCompanyName(user.getCompanyName());
+            shoppingCart.setWebsitId(user.getWebsitId());
+            shoppingCart.setWebsitName(user.getWebsitName());
             shoppingCarts.add(shoppingCart);
         }
         shoppingCartService.saveBatch(shoppingCarts);
@@ -193,8 +195,10 @@ public class ShoppingCartLogic {
             if(user.getType().equals(UserTypeEnum.GENERAL.toString())) {
                 bean.setWxSceneId(buyGood.getWxSceneId());
             }
-            bean.setCompanyId(currentCompanyWechat.getCurrentCompanyWechatId());
-            bean.setCompanyName(currentCompanyWechat.getCurrentCompanyName());
+            shoppingCart.setCompanyId(user.getCompanyId());
+            shoppingCart.setCompanyName(user.getCompanyName());
+            shoppingCart.setWebsitId(user.getWebsitId());
+            shoppingCart.setWebsitName(user.getWebsitName());
             bean.insert();
         }else{
             shoppingCart.setNum(shoppingCart.getNum()+buyGood.getNum());

+ 1 - 1
src/main/resources/mapper/AppMapper.xml

@@ -13,7 +13,7 @@
         from shopping_cart a
                  join goods_spec b on a.goods_spec_id = b.goods_spec_id
                  join goods c on c.goods_id = a.goods_id
-        where a.user_id = #{userId}
+        where a.user_id = #{userId} and a.websit_id = #{websitId}
     </select>
 
 

+ 19 - 13
src/main/resources/mapper/OrderShareRankMapper.xml

@@ -2,19 +2,25 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.gree.mall.miniapp.commonmapper.OrderShareRankMapper">
     <select id="queryRankList" resultType="com.gree.mall.miniapp.bean.user.RankItemBean">
-        select
-                ur.user_id as workUserId,
-                ifnull(ur.work_name,ur.nick_name) as work_user_name,
-                ur.avatar,
-                ifnull(aw.name,'') as websitName,
-                sum(od.pay_amount) as 'total',
-                row_number() over(order by sum(od.pay_amount) desc) as 'ranking'
-            from order_info os join order_detail od on os.order_id = od.order_id
-            join user ur on ur.user_id = od.share_user_id
-            join admin_company_wechat d on d.company_wechat_id = os.company_wechat_id
-            left join enterprise_wechat_worker eww on eww.wechat_user_id = os.worker_id and eww.corp_id=d.corp_id
-            left join admin_websit aw on aw.websit_id = eww.main_department and aw.corp_id= d.corp_id
-        where od.share_user_id !='' and os.order_status in('DFH','YFH','OVER')
+        SELECT
+        ur.user_id AS workUserId,
+        ifnull( ur.work_name, ur.nick_name ) AS work_user_name,
+        ur.avatar,
+        ifnull( ur.websit_name, '' ) AS websitName,
+        sum( od.pay_amount ) AS 'total',
+        row_number() over ( ORDER BY sum( od.pay_amount ) DESC ) AS 'ranking'
+        FROM
+        order_info os
+        JOIN order_detail od ON os.order_id = od.order_id
+        JOIN `user` ur ON ur.user_id = od.share_user_id
+        JOIN admin_company d ON d.admin_company_id = os.company_id
+
+        WHERE
+        od.share_user_id != ''
+        AND os.order_status IN (
+        'DFH',
+        'YFH',
+        'OVER')
           and os.create_time between #{startTime} and #{endTime} and os.company_wechat_id=#{companyWechatId}
           <if test="userId != null and userId !=''">
               and od.share_user_id = #{userId}