From dbff53150cdc807faa56c0d1a947d24b69f372b9 Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期四, 31 八月 2023 18:43:20 +0800
Subject: [PATCH] bug

---
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/sys/SysDeptServiceImpl.java |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/sys/SysDeptServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/sys/SysDeptServiceImpl.java
index 63c79a6..b7b4b70 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/sys/SysDeptServiceImpl.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/sys/SysDeptServiceImpl.java
@@ -225,8 +225,13 @@
         }
         dept.setAncestors(info.getAncestors() + "," + dept.getParentId());
         //新增部门
-        deptMapper.insertDept(dept);
-        return insertDeptMenu(dept);
+        int i = deptMapper.insertDept(dept);
+        if(dept.getMenuIds()!=null||dept.getStaffMenuIds()!=null){
+            return insertDeptMenu(dept);
+        }else{
+            return i;
+        }
+
     }
 
     /**
@@ -244,6 +249,14 @@
             SysDeptMenu rm = new SysDeptMenu();
             rm.setDeptId(dept.getDeptId());
             rm.setMenuId(menuId);
+            rm.setMenuFrom(1);
+            list.add(rm);
+        }
+        for(Long menuId : dept.getStaffMenuIds()){
+            SysDeptMenu rm = new SysDeptMenu();
+            rm.setDeptId(dept.getDeptId());
+            rm.setMenuId(menuId);
+            rm.setMenuFrom(2);
             list.add(rm);
         }
         if (list.size() > 0)
@@ -370,4 +383,19 @@
     {
         return getChildList(list, t).size() > 0 ? true : false;
     }
+
+
+    /**
+     * @description  通过微信部门id获取部门
+     * @author  jqs
+     * @date    2023/8/17 16:21
+     * @param wxDeptId
+     * @return  SysDept
+     */
+    @Override
+    public SysDept getByWxDeptId(Long wxDeptId){
+        return deptMapper.getByWxDeptId(wxDeptId);
+    }
+
+
 }

--
Gitblit v1.7.1