将删除文件及文件夹的物理删除方式改为标志位判断

master
孙亮 1 year ago
parent fd8707e899
commit 87668b7e65

@ -748,8 +748,15 @@ namespace IBKLinker_Minio.Controller.MinioController
{ {
if (item.FileType == 1) //如果类型是文件 if (item.FileType == 1) //如果类型是文件
{ {
minio.RemoveObjectAsync(buckname, item.FileName);//minio操作删除文件 //minio.RemoveObjectAsync(buckname, item.FileName);//minio操作删除文件
string sql = string.Format(" delete from MINIO_FILEASSOCIATION where FILE_PK like'%{0}%' or ASSOCIATION_FILE_PK like'%{0}%'", item.Pk);//删除关联表中的关联关系 string sql = string.Format("update MINIO_STORAGE_PATH set CLEAR_FLAG='1',CLEAR_USERS='{0}',CLEAR_TIME='{1}' where PK='{2}' ", item.ClearUsers, item.ClearTime, item.Pk);//更新文件路径表中的删除状态
db.Execute(sql);
sql = string.Format(" delete from MINIO_FILEASSOCIATION where FILE_PK like'%{0}%' or ASSOCIATION_FILE_PK like'%{0}%'", item.Pk);//删除关联表中的关联关系
db.Execute(sql);
}
else
{
string sql = string.Format("update MINIO_STORAGE_PATH set CLEAR_FLAG='1',CLEAR_USERS='{0}',CLEAR_TIME='{1}' where PK='{2}' ",item.ClearUsers,item.ClearTime, item.Pk);//更新文件路径表中的删除状态
db.Execute(sql); db.Execute(sql);
} }
} }
@ -759,6 +766,7 @@ namespace IBKLinker_Minio.Controller.MinioController
} }
catch (Exception ex) catch (Exception ex)
{ {
db.Rollback();
request.code = "1"; request.code = "1";
logger.ErrorFormat("主表:MINIO_ROLE_PERMISSION创建数据库连接对象失败错误原因:{0}", ex); logger.ErrorFormat("主表:MINIO_ROLE_PERMISSION创建数据库连接对象失败错误原因:{0}", ex);
} }
@ -786,7 +794,7 @@ namespace IBKLinker_Minio.Controller.MinioController
sql += " and FILE_NAME ='" + minioStoragePath.FileName + "'"; sql += " and FILE_NAME ='" + minioStoragePath.FileName + "'";
} }
request.data = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH where 1=1 " + sql + " ORDER BY PK"); request.data = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH where 1=1 " + sql + " and CLEAR_FLAG='0' ORDER BY PK");
request.code = "0"; request.code = "0";
} }
} }
@ -819,7 +827,7 @@ namespace IBKLinker_Minio.Controller.MinioController
sql += " and UPK =" + int.Parse(PK); sql += " and UPK =" + int.Parse(PK);
} }
date = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH where 1=1 " + sql + " ORDER BY PK").ToList(); date = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH where 1=1 " + sql + "and CLEAR_FLAG='0' ORDER BY PK").ToList();
} }
return date; return date;
@ -842,7 +850,7 @@ namespace IBKLinker_Minio.Controller.MinioController
string sql = string.Empty; string sql = string.Empty;
date = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH ORDER BY PK").ToList(); date = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH where CLEAR_FLAG='0' ORDER BY PK").ToList();
} }
if (date.Count > 0) if (date.Count > 0)

@ -96,6 +96,33 @@ namespace IBKLinker_Minio.Entity.MinioController
[Persistent("ALTERNATE_FIELDS"), DisplayName("备用字段")] [Persistent("ALTERNATE_FIELDS"), DisplayName("备用字段")]
public string AlternateFields { get; set; } public string AlternateFields { get; set; }
/// <summary>
///删除时间
/// </summary>
[Persistent("CLEAR_TIME"), DisplayName("删除时间")]
public DateTime? ClearTime { get; set; }
/// <summary>
///删除用户
/// </summary>
[Persistent("CLEAR_USERS"), DisplayName("删除用户")]
public string ClearUsers { get; set; }
/// <summary>
///删除标记 0未删除 1删除
/// </summary>
[Persistent("CLEAR_FLAG"), DisplayName("删除标记 0未删除 1删除")]
public string ClearFlag { get; set; }
/// <summary> /// <summary>
///文件格式 ///文件格式
/// </summary> /// </summary>

Loading…
Cancel
Save