递归删除

 

 

/**
* 文件删除
* @param
*/
public  void delDir(File file)
{
if (file.isDirectory())
{
File zFiles[] = file.listFiles();
for (File file2 : zFiles)
{
delDir(file2);
}
}
file.delete();
}

 

/**
* 递归删除
* @param classId
*/
public void deleteByClassId(String classId)
{
QmClassType classType = findById(classId);

if (classType != null)
{
List<QmClassType> classTypeList = findClassTypeByParentId(classId);
if (classTypeList != null)
{
for (QmClassType type : classTypeList)
{
deleteByClassId(type.getQmClassId());
}
}

deleteById(classId);
}
}

 public ArrayNode getClassTypeTree(String parentId)
{
List<QmClassType> classTypeList = findClassTypeByParentId(parentId);
ArrayNode arrayNode = JacksonUtil.createArrayNode();
if (classTypeList != null)
{
for (QmClassType classType : classTypeList)
{
ObjectNode sonNode = classTypeToObjectNode(classType);
sonNode.set("children", getClassTypeTree(classType.getQmClassId()));
arrayNode.add(sonNode);
}
}
return arrayNode;
}
















posted @ 2019-07-24 13:53  zzl0916  阅读(255)  评论(0编辑  收藏  举报