【fix sonar】 FindsDepartsChildrenUtil.java文件
This commit is contained in:
+10
-6
@@ -12,12 +12,16 @@ import java.util.List;
|
|||||||
* <P>
|
* <P>
|
||||||
* 对应部门的表,处理并查找树级数据
|
* 对应部门的表,处理并查找树级数据
|
||||||
* <P>
|
* <P>
|
||||||
*
|
*
|
||||||
* @Author: Steve
|
* @Author: Steve
|
||||||
* @Date: 2019-01-22
|
* @Date: 2019-01-22
|
||||||
*/
|
*/
|
||||||
public class FindsDepartsChildrenUtil {
|
public class FindsDepartsChildrenUtil {
|
||||||
|
|
||||||
|
private FindsDepartsChildrenUtil(){}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queryTreeList的子方法 ====1=====
|
* queryTreeList的子方法 ====1=====
|
||||||
* 该方法是s将SysDepart类型的list集合转换成SysDepartTreeModel类型的集合
|
* 该方法是s将SysDepart类型的list集合转换成SysDepartTreeModel类型的集合
|
||||||
@@ -25,7 +29,7 @@ public class FindsDepartsChildrenUtil {
|
|||||||
public static List<SysDepartTreeModel> wrapTreeDataToTreeList(List<SysDepart> recordList) {
|
public static List<SysDepartTreeModel> wrapTreeDataToTreeList(List<SysDepart> recordList) {
|
||||||
// 在该方法每请求一次,都要对全局list集合进行一次清理
|
// 在该方法每请求一次,都要对全局list集合进行一次清理
|
||||||
//idList.clear();
|
//idList.clear();
|
||||||
List<DepartIdModel> idList = new ArrayList<DepartIdModel>();
|
List<DepartIdModel> idList = new ArrayList<>();
|
||||||
List<SysDepartTreeModel> records = new ArrayList<>();
|
List<SysDepartTreeModel> records = new ArrayList<>();
|
||||||
for (int i = 0; i < recordList.size(); i++) {
|
for (int i = 0; i < recordList.size(); i++) {
|
||||||
SysDepart depart = recordList.get(i);
|
SysDepart depart = recordList.get(i);
|
||||||
@@ -47,7 +51,7 @@ public class FindsDepartsChildrenUtil {
|
|||||||
public static List<DepartIdModel> wrapTreeDataToDepartIdTreeList(List<SysDepart> recordList) {
|
public static List<DepartIdModel> wrapTreeDataToDepartIdTreeList(List<SysDepart> recordList) {
|
||||||
// 在该方法每请求一次,都要对全局list集合进行一次清理
|
// 在该方法每请求一次,都要对全局list集合进行一次清理
|
||||||
//idList.clear();
|
//idList.clear();
|
||||||
List<DepartIdModel> idList = new ArrayList<DepartIdModel>();
|
List<DepartIdModel> idList = new ArrayList<>();
|
||||||
List<SysDepartTreeModel> records = new ArrayList<>();
|
List<SysDepartTreeModel> records = new ArrayList<>();
|
||||||
for (int i = 0; i < recordList.size(); i++) {
|
for (int i = 0; i < recordList.size(); i++) {
|
||||||
SysDepart depart = recordList.get(i);
|
SysDepart depart = recordList.get(i);
|
||||||
@@ -78,7 +82,7 @@ public class FindsDepartsChildrenUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
getGrandChildren(treeList,recordList,departIdList);
|
getGrandChildren(treeList,recordList,departIdList);
|
||||||
|
|
||||||
//idList = departIdList;
|
//idList = departIdList;
|
||||||
return treeList;
|
return treeList;
|
||||||
}
|
}
|
||||||
@@ -105,7 +109,7 @@ public class FindsDepartsChildrenUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queryTreeList的子方法 ====4====
|
* queryTreeList的子方法 ====4====
|
||||||
@@ -115,7 +119,7 @@ public class FindsDepartsChildrenUtil {
|
|||||||
|
|
||||||
for (int i = 0; i < treeList.size(); i++) {
|
for (int i = 0; i < treeList.size(); i++) {
|
||||||
SysDepartTreeModel model = treeList.get(i);
|
SysDepartTreeModel model = treeList.get(i);
|
||||||
if (model.getChildren().size() == 0) {
|
if (model.getChildren().isEmpty()) {
|
||||||
model.setChildren(null);
|
model.setChildren(null);
|
||||||
model.setIsLeaf(true);
|
model.setIsLeaf(true);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user