Kaynağa Gözat

修改餐桌码

qmj 1 ay önce
ebeveyn
işleme
49fbf711c3

+ 9 - 5
ruoyi-admin/src/main/java/com/ruoyi/app/tableqrcode/TableQrcodeController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.app.tableqrcode;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ruoyi.common.annotation.Anonymous;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -74,17 +75,20 @@ public class TableQrcodeController extends BaseController
                 return error("摊主只能创建摊位码");
             }
             // storeId 从用户信息获取
-            if (currentUser.getStoreId() == null)
+            if ("4".equals(userType) && currentUser.getStoreId() == null)
             {
                 return error("当前用户未关联摊位");
             }
-            tableQrcode.setStoreId(currentUser.getStoreId());
+            PosStore store=posStoreService.getOne(new LambdaQueryWrapper<PosStore>().eq(PosStore::getId,tableQrcode.getStoreId()));
+            if("4".equals(userType)) {
+                tableQrcode.setStoreId(currentUser.getStoreId());
 
-            // nightMarketId 从摊位信息获取
-            PosStore store = posStoreService.selectPosStoreById(currentUser.getStoreId());
+                // nightMarketId 从摊位信息获取
+                 store = posStoreService.selectPosStoreById(currentUser.getStoreId());
+            }
             if (store == null)
             {
-                return error("摊位不存在");
+                return error("店铺/摊位不存在");
             }
             tableQrcode.setNightMarketId(store.getNightMarketId());
         }