Explorar o código

查询数据部门多选

wangys %!s(int64=5) %!d(string=hai) anos
pai
achega
75af3e8cbc

+ 1 - 1
efunbox-base/efunbox-base-api/src/main/java/cn/efunbox/manage/base/vo/ManageVO.java

@@ -18,7 +18,7 @@ import java.util.List;
 @Data
 public class ManageVO implements Serializable {
 
-    private Long deptId;
+    private List<Long> deptId;
 
     private String deptName;
 

+ 12 - 4
efunbox-base/efunbox-base-web/src/main/java/cn/efunbox/manage/base/controller/ManageController.java

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * ManageController
@@ -28,11 +29,18 @@ public class ManageController {
 
     @PostMapping("/search")
     public ApiResult findManage(@RequestBody ManageVO manageVO){
-        ApiResult<List<Department>> deptResult = departmentService.getDeptChild(manageVO.getDeptId() == null ? 12345l : manageVO.getDeptId());
         List<Long> deptIds = new ArrayList<>();
-        deptResult.getData().stream().forEach(department -> {
-            deptIds.add(department.getId());
-        });
+        if(Objects.isNull(manageVO.getDeptId())){
+            ApiResult<List<Department>> deptResult = departmentService.getDeptChild(12345l);
+            deptResult.getData().stream().forEach(department -> {
+                deptIds.add(department.getId());
+            });
+        }else {
+            manageVO.getDeptId().stream().forEach(ids -> {
+                deptIds.add(ids);
+            });
+        }
+
         manageVO.setDeptIds(deptIds);
         return manageService.list(manageVO);
     }