Parcourir la source

文件删除修改

黑艺新账号
dao il y a 6 mois
Parent
révision
ae6a97c9ac
2 fichiers modifiés avec 51 ajouts et 6 suppressions
  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 Voir le fichier

@@ -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 Voir le fichier

@@ -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 });


Chargement…
Annuler
Enregistrer