【fix sonar】 FindsDepartsChildrenUtil.java文件

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