TRX hai 1 ano
pai
achega
e7c7f7f43e

+ 1 - 1
FullCardClient/src/main/java/com/zhongshu/card/client/model/org/DepartmentModel.java

@@ -27,5 +27,5 @@ public class DepartmentModel extends SuperModel implements ITree<DepartmentModel
     private String parentId;
 
     @Schema(description = "子层级")
-    private List<DepartmentModel> child = new ArrayList<>();
+    private List<DepartmentModel> children = new ArrayList<>();
 }

+ 2 - 2
FullCardClient/src/main/java/com/zhongshu/card/client/utils/ITree.java

@@ -12,8 +12,8 @@ public interface ITree<T> {
 
     public String getParentId();
 
-    public void setChild(List<T> tree);
+    public void setChildren(List<T> tree);
 
-    public List<T> getChild();
+    public List<T> getChildren();
 
 }

+ 2 - 2
FullCardClient/src/main/java/com/zhongshu/card/client/utils/TreeUtil.java

@@ -38,7 +38,7 @@ public class TreeUtil {
 
             if (parent != null) {
                 List<T> children = doBuildTree(list, parentId);
-                parent.setChild(children);
+                parent.setChildren(children);
 
                 List<T> ret = new ArrayList<>();
 
@@ -67,7 +67,7 @@ public class TreeUtil {
                 if (tempList == null || tempList.size() <= 0) {
                     tempList = new ArrayList();
                 }
-                m.setChild(tempList);
+                m.setChildren(tempList);
                 ret.add(m);
             }
         }

+ 8 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/org/DepartmentController.java

@@ -2,12 +2,14 @@ package com.zhongshu.card.server.core.controller.org;
 
 import com.github.microservice.auth.security.annotations.ResourceAuth;
 import com.github.microservice.auth.security.type.AuthType;
+import com.zhongshu.card.client.model.base.OidModel;
 import com.zhongshu.card.client.model.org.DepartmentParam;
 import com.zhongshu.card.client.ret.ResultContent;
 import com.zhongshu.card.client.service.org.DepartmentService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -27,6 +29,11 @@ public class DepartmentController {
         return this.departmentService.addDepartment(param);
     }
 
-
+    @ResourceAuth(value = "user",type = AuthType.User)
+    @Operation(summary = "得到机构部门树", description = "得到机构部门树")
+    @RequestMapping(value = "getDepartmentTree", method = {RequestMethod.POST})
+    public ResultContent getDepartmentTree(@RequestBody OidModel param) {
+        return this.departmentService.getDepartmentTree(param.getOid());
+    }
 
 }

+ 1 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/DepartmentServiceImpl.java

@@ -113,7 +113,7 @@ public class DepartmentServiceImpl extends SuperService implements DepartmentSer
     @Override
     public ResultContent<List<ITree>> getDepartmentTree(String oid) {
         if (StringUtils.isEmpty(oid)) {
-            oid = authHelper.getOrgId();
+            oid = getCurrentOid();
         }
         List<Department> list = departmentDao.findByOidOrderBySortAsc(oid);
         List<ITree> models = list.stream().map(this::toModel).collect(Collectors.toList());