Browse Source

文件删除修改

黑艺新账号
dao 6 months ago
parent
commit
ae6a97c9ac
2 changed files with 51 additions and 6 deletions
  1. +49
    -4
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileFolder/FileFolderService.cs
  2. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs

+ 49
- 4
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileFolder/FileFolderService.cs View File

@@ -57,11 +57,56 @@ namespace Learun.Application.OA.File.FileFolder
/// <param name="keyValue">主键</param>
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>


+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/File/FileInfo/FileInfoService.cs View File

@@ -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<FileInfoEntity>(strSql.ToString(), new { userId = userId });


Loading…
Cancel
Save