diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileFolder/FileFolderService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileFolder/FileFolderService.cs index 37012d28a..6a93bf7a3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileFolder/FileFolderService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileFolder/FileFolderService.cs @@ -57,11 +57,56 @@ namespace Learun.Application.OA.File.FileFolder /// 主键 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(); + fid.Add(keyValue); + var floder = db.FindList(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(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 fid,List 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); + } + } } + /// /// 彻底删除文件夹 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs index 0eb33dba8..8f16e7ef4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs @@ -243,7 +243,7 @@ namespace Learun.Application.OA.File.FileInfo 'folder' AS F_FileType , F_CreateUserId, F_ModifyDate - FROM LR_OA_FileFolder where F_DeleteMark = 1 and F_ParentId is null + FROM LR_OA_FileFolder where F_DeleteMark = 1 UNION SELECT F_FileId , F_FolderId , @@ -252,7 +252,7 @@ namespace Learun.Application.OA.File.FileInfo F_FileType , F_CreateUserId, F_ModifyDate - FROM LR_OA_FileInfo where F_DeleteMark = 1 and F_FolderId = '0' + FROM LR_OA_FileInfo where F_DeleteMark = 1 ) t WHERE F_CreateUserId = @userId"); strSql.Append(" ORDER BY F_ModifyDate DESC"); return this.BaseRepository().FindList(strSql.ToString(), new { userId = userId });