|
@@ -57,11 +57,56 @@ namespace Learun.Application.OA.File.FileFolder |
|
|
/// <param name="keyValue">主键</param> |
|
|
/// <param name="keyValue">主键</param> |
|
|
public void RemoveForm(string keyValue) |
|
|
public void RemoveForm(string keyValue) |
|
|
{ |
|
|
{ |
|
|
FileFolderEntity fileFolderEntity = new FileFolderEntity(); |
|
|
|
|
|
fileFolderEntity.Modify(keyValue); |
|
|
|
|
|
fileFolderEntity.F_DeleteMark = 1; |
|
|
|
|
|
this.BaseRepository().Update(fileFolderEntity); |
|
|
|
|
|
|
|
|
var db = this.BaseRepository().BeginTrans(); |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
var fid = new List<string>(); |
|
|
|
|
|
fid.Add(keyValue); |
|
|
|
|
|
var floder = db.FindList<FileFolderEntity>(x => x.F_DeleteMark != 1).ToList(); |
|
|
|
|
|
DelFloderChild(keyValue, fid, floder); |
|
|
|
|
|
|
|
|
|
|
|
var fs = floder.Where(x => fid.Contains(x.F_FolderId)).ToList(); |
|
|
|
|
|
foreach (var f in fs) |
|
|
|
|
|
{ |
|
|
|
|
|
f.F_DeleteMark = 1; |
|
|
|
|
|
f.F_ModifyDate = DateTime.Now; |
|
|
|
|
|
} |
|
|
|
|
|
db.Update(fs); |
|
|
|
|
|
|
|
|
|
|
|
var file=db.FindList<FileInfoEntity>(x=>x.F_DeleteMark!=1 && fid.Contains(x.F_FolderId)).ToList(); |
|
|
|
|
|
if(file.Any()) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var f in file) |
|
|
|
|
|
{ |
|
|
|
|
|
f.F_DeleteMark = 1; |
|
|
|
|
|
f.F_ModifyDate = DateTime.Now; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
db.Update(file); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
db.Commit(); |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception) |
|
|
|
|
|
{ |
|
|
|
|
|
db.Rollback(); |
|
|
|
|
|
throw; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void DelFloderChild(string kv,List<string> fid,List<FileFolderEntity> floder) |
|
|
|
|
|
{ |
|
|
|
|
|
var child=floder.Where(x=>x.F_ParentId == kv); |
|
|
|
|
|
if(child.Any()) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var f in child) |
|
|
|
|
|
{ |
|
|
|
|
|
fid.Add(f.F_FolderId); |
|
|
|
|
|
DelFloderChild(f.F_FolderId,fid,floder); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/// <summary> |
|
|
/// <summary> |
|
|
/// 彻底删除文件夹 |
|
|
/// 彻底删除文件夹 |
|
|
/// </summary> |
|
|
/// </summary> |
|
|