gt 2 năm trước cách đây
mục cha
commit
f8bffc7e00

+ 3 - 6
chuanyi_server/src/main/java/com/judong/chuanyiserver/util/KepOpcServerUtil.java

@@ -312,17 +312,14 @@ public class KepOpcServerUtil {
     public static List<JSONObject> recursionChildren(Collection<Branch> branchCollection) {
         List<JSONObject> jsonList = new ArrayList<>();
         for (Branch branch : branchCollection) {
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("label", branch.getName());
             if (Blank.isNotEmpty(branch.getBranches())) {
-                JSONObject jsonObject = new JSONObject();
-                jsonObject.put("label", branch.getName());
                 jsonObject.put("children", recursionChildren(branch.getBranches()));
-                jsonList.add(jsonObject);
             } else {
-                JSONObject jsonObject = new JSONObject();
-                jsonObject.put("label", branch.getName());
                 jsonObject.put("children", generLeaf(branch.getLeaves()));
-                jsonList.add(jsonObject);
             }
+            jsonList.add(jsonObject);
         }
         return jsonList;
     }