浏览代码

增加接口

zhonghui 3 年之前
父节点
当前提交
77209d51d3

+ 10 - 0
boman-modules/boman-system/src/main/java/com/boman/system/controller/SysDeptController.java

@@ -108,6 +108,16 @@ public class SysDeptController extends BaseController
         return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
     }
 
+    /**
+     * 获取部门下拉树列表
+     */
+    @GetMapping("/depts")
+    public AjaxResult depts(SysDept dept)
+    {
+        List<SysDept> depts = deptService.selectDepts(dept);
+        return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
+    }
+
     /**
      * 加载对应角色部门列表树
      */

+ 8 - 0
boman-modules/boman-system/src/main/java/com/boman/system/service/ISysDeptService.java

@@ -20,6 +20,14 @@ public interface ISysDeptService
      */
     public List<SysDept> selectDeptList(SysDept dept);
 
+    /**
+     * 查询部门管理数据
+     *
+     * @param dept 部门信息
+     * @return 部门信息集合
+     */
+    public List<SysDept> selectDepts(SysDept dept);
+
     /**
      * 构建前端所需要树结构
      * 

+ 10 - 4
boman-modules/boman-system/src/main/java/com/boman/system/service/impl/SysDeptServiceImpl.java

@@ -41,12 +41,12 @@ public class SysDeptServiceImpl implements ISysDeptService
     @Override
     @DataScope(deptAlias = "d")
     public List<SysDept> selectDeptList(SysDept dept) {
+        if(StringUtils.isNotEmpty(dept.getDeptName()) || StringUtils.isNotEmpty(dept.getStatus())) {
+            dept.setListByParentId(Boolean.TRUE);
+            return deptMapper.selectDeptList(dept);
+        }
         Long id = dept.getId();
         if(id == null) {
-            if(StringUtils.isNotEmpty(dept.getDeptName()) || StringUtils.isNotEmpty(dept.getStatus())) {
-                dept.setListByParentId(Boolean.TRUE);
-                return deptMapper.selectDeptList(dept);
-            }
             dept.setListByParentId(Boolean.FALSE);
         }else{
             dept.setListByParentId(Boolean.TRUE);
@@ -75,6 +75,12 @@ public class SysDeptServiceImpl implements ISysDeptService
         return depts;
     }
 
+    @Override
+    @DataScope(deptAlias = "d")
+    public List<SysDept> selectDepts(SysDept dept) {
+        return deptMapper.selectDeptList(dept);
+    }
+
     /**
      * 构建前端所需要树结构
      *