فهرست منبع

pms 瑞恒日报 查询指定公司下所有部门

zhangcl 6 روز پیش
والد
کامیت
e914a5fed1

+ 15 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java

@@ -92,6 +92,21 @@ public class DeptController {
         return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
     }
 
+    @GetMapping("/specifiedSimpleDepts")
+    @Operation(summary = "获取指定部门精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
+    @PermitAll
+    @Parameter(name = "deptId", description = "部门id", required = true, example = "1024")
+    public CommonResult<List<DeptSimpleRespVO>> specifiedSimpleDepts(@RequestParam("deptId") Long deptId) {
+        DeptListReqVO reqVO = new DeptListReqVO();
+        reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
+        reqVO.setDeptId(deptId);
+        List<DeptDO> list = deptService.getChildDeptList(deptId);
+        // 查询 deptId 对应的部门 加入 最终返回的集合
+        DeptDO currentDept = deptService.getDept(deptId);
+        list.add(currentDept);
+        return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
+    }
+
     @GetMapping("/get")
     @Operation(summary = "获得部门信息")
     @Parameter(name = "id", description = "编号", required = true, example = "1024")

+ 3 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptListReqVO.java

@@ -18,4 +18,7 @@ public class DeptListReqVO {
     @Schema(description = "部门id集合", example = "[12,14]")
     private Collection<Long> deptIds;
 
+    @Schema(description = "指定的部门id", example = "123")
+    private Long deptId;
+
 }