Ztree工具类重名
This commit is contained in:
parent
b618aac0d2
commit
c441961682
|
|
@ -13,14 +13,14 @@ import java.util.Map;
|
||||||
* @author solo
|
* @author solo
|
||||||
* @date 2019/09/05.
|
* @date 2019/09/05.
|
||||||
*/
|
*/
|
||||||
public class Ztree extends BaseBean {
|
public class Ztree2 extends BaseBean {
|
||||||
private String id;
|
private String id;
|
||||||
private String text;
|
private String text;
|
||||||
private String state;
|
private String state;
|
||||||
private boolean isParent;
|
private boolean isParent;
|
||||||
private boolean checked;;
|
private boolean checked;;
|
||||||
private int locked;
|
private int locked;
|
||||||
private List<Ztree> children;
|
private List<Ztree2> children;
|
||||||
private String iconCls;
|
private String iconCls;
|
||||||
private String pid;
|
private String pid;
|
||||||
private Map<String, Object> attributes = new HashMap<String, Object>();
|
private Map<String, Object> attributes = new HashMap<String, Object>();
|
||||||
|
|
@ -86,11 +86,11 @@ public class Ztree extends BaseBean {
|
||||||
this.locked = locked;
|
this.locked = locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Ztree> getChildren() {
|
public List<Ztree2> getChildren() {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChildren(List<Ztree> children) {
|
public void setChildren(List<Ztree2> children) {
|
||||||
this.children = children;
|
this.children = children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -14,9 +14,9 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class ZtreeUtil {
|
public class ZtreeUtil {
|
||||||
|
|
||||||
public static List<Ztree> ztreeList(List<Ztree> list,String pid) {
|
public static List<Ztree2> ztreeList(List<Ztree2> list, String pid) {
|
||||||
List<Ztree> returnList = new ArrayList<Ztree>();
|
List<Ztree2> returnList = new ArrayList<Ztree2>();
|
||||||
for (Ztree t : list) {
|
for (Ztree2 t : list) {
|
||||||
if (StringUtils.equals(t.getPid(), pid)) {
|
if (StringUtils.equals(t.getPid(), pid)) {
|
||||||
recursionFn(list, t);
|
recursionFn(list, t);
|
||||||
returnList.add(t);
|
returnList.add(t);
|
||||||
|
|
@ -25,16 +25,16 @@ public class ZtreeUtil {
|
||||||
return returnList;
|
return returnList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void recursionFn(List<Ztree> list, Ztree t) {
|
private static void recursionFn(List<Ztree2> list, Ztree2 t) {
|
||||||
List<Ztree> childList = getChildList(list, t);// 得到子节点列表
|
List<Ztree2> childList = getChildList(list, t);// 得到子节点列表
|
||||||
t.setChildren(childList);
|
t.setChildren(childList);
|
||||||
t.setState("open");
|
t.setState("open");
|
||||||
t.setIsParent(false);
|
t.setIsParent(false);
|
||||||
for (Ztree tChild : childList) {
|
for (Ztree2 tChild : childList) {
|
||||||
t.setState("closed");
|
t.setState("closed");
|
||||||
t.setIsParent(true);
|
t.setIsParent(true);
|
||||||
if (hasChild(list, tChild)) {// 判断是否有子节点
|
if (hasChild(list, tChild)) {// 判断是否有子节点
|
||||||
for (Ztree n : childList) {
|
for (Ztree2 n : childList) {
|
||||||
recursionFn(list, n);
|
recursionFn(list, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -43,9 +43,9 @@ public class ZtreeUtil {
|
||||||
|
|
||||||
|
|
||||||
// 得到子节点列表
|
// 得到子节点列表
|
||||||
private static List<Ztree> getChildList(List<Ztree> list, Ztree t) {
|
private static List<Ztree2> getChildList(List<Ztree2> list, Ztree2 t) {
|
||||||
List<Ztree> tlist = new ArrayList<Ztree>();
|
List<Ztree2> tlist = new ArrayList<Ztree2>();
|
||||||
for (Ztree n : list) {
|
for (Ztree2 n : list) {
|
||||||
if (StringUtils.equals(n.getPid(), t.getId())) {
|
if (StringUtils.equals(n.getPid(), t.getId())) {
|
||||||
tlist.add(n);
|
tlist.add(n);
|
||||||
}
|
}
|
||||||
|
|
@ -54,7 +54,7 @@ public class ZtreeUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断是否有子节点
|
// 判断是否有子节点
|
||||||
private static boolean hasChild(List<Ztree> list, Ztree t) {
|
private static boolean hasChild(List<Ztree2> list, Ztree2 t) {
|
||||||
return getChildList(list, t).size() > 0;
|
return getChildList(list, t).size() > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue