修改递归文件接口

master
孙亮 12 months ago
parent 627a77fdfb
commit 8a7a3758eb

@ -100,10 +100,20 @@ namespace IBKLinker_Minio.Common
{ {
RequstStoragePath subDirModel = new RequstStoragePath(); RequstStoragePath subDirModel = new RequstStoragePath();
subDirModel.Pk = subDir.Pk;//主键ID subDirModel.Pk = subDir.Pk;//主键ID
subDirModel.Upk = subDir.Upk;//父级文件夹pk
subDirModel.FileName = subDir.FileName;//文件名称 subDirModel.FileName = subDir.FileName;//文件名称
subDirModel.FilePath = subDir.FilePath;//文件路径 subDirModel.FilePath = subDir.FilePath;//文件路径
subDirModel.FileType = subDir.FileType;//文件类型 subDirModel.FileType = subDir.FileType;//文件类型
subDirModel.FileLever = subDir.FileLevel;//层级 subDirModel.FileLevel = subDir.FileLevel;//层级
subDirModel.CreatorTime = subDir.CreatorTime;//创建时间
subDirModel.CreatorUser = subDir.CreatorUser;//创建者
subDirModel.DownloadNum = subDir.DownloadNum;//下载次数
subDirModel.ModifyUsers = subDir.ModifyUsers;//修改用户
subDirModel.ModifyTime = subDir.ModifyTime;//修改时间
subDirModel.ClearUsers = subDir.ClearUsers;//删除用户
subDirModel.ClearTime = subDir.ClearTime;//删除时间
subDirModel.ClearFlag = subDir.ClearFlag;//删除标记 0未删除 1删除
subDirModel.DocumentType = subDir.DocumentType;//文件种类1、技术协议 2、质量要点 3、工艺卡 4、其他
subDirModel.requstStoragePaths = GetSubDirectories(subDir.Pk); // 递归调用获取子文件夹 subDirModel.requstStoragePaths = GetSubDirectories(subDir.Pk); // 递归调用获取子文件夹
subDirs.Add(subDirModel); subDirs.Add(subDirModel);
} }

@ -1132,49 +1132,39 @@ namespace IBKLinker_Minio.Controller.MinioController
return date; return date;
} }
/// <summary> /// <summary>
/// 获取根目录和根目录下一级得菜单信息 /// 获取所有文件夹
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost, Route("GetRecursion")] [HttpPost, Route("GetRecursion")]
public RequestEntity GetRecursion() public RequestEntity GetRecursion()
{ {
MinioBusinessLogic bb = new MinioBusinessLogic();//定义业务逻辑方法
RequestEntity request = new RequestEntity(); RequestEntity request = new RequestEntity();
try try
{ {
//拿到根目录
List<RequstStoragePath> requstStoragePaths = new List<RequstStoragePath>(); List<RequstStoragePath> requstStoragePaths = new List<RequstStoragePath>();
List<MinioStoragePath> date = new List<MinioStoragePath>();
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db")) using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
{ {
string sql = string.Empty; List<MinioStoragePath> rootDirectories = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH where CLEAR_FLAG='0' and FILE_TYPE='0'and FILE_LEVEL='1' ORDER BY PK").ToList();//查询根文件夹
foreach (var rootDir in rootDirectories)
date = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH where CLEAR_FLAG='0'and FILE_TYPE='0' ORDER BY PK").ToList();
//UPK=0 AND FILE_LEVEL=1 and
}
if (date.Count > 0)
{
foreach (var item in date)
{ {
RequstStoragePath model = new RequstStoragePath(); RequstStoragePath rootModel = new RequstStoragePath();
rootModel.Pk = rootDir.Pk;//主键ID
model.Pk = item.Pk; rootModel.Upk = rootDir.Upk;//父级文件夹pk
model.FileName = item.FileName; rootModel.FileName = rootDir.FileName;//文件名称
model.FilePath = item.FilePath; rootModel.FilePath = rootDir.FilePath;//文件路径
model.FileType = item.FileType; rootModel.FileType = rootDir.FileType;//文件类型
model.FileLever = item.FileLevel; rootModel.FileLevel = rootDir.FileLevel;//层级
model.requstStoragePaths = new List<StoragePath>(); rootModel.CreatorTime = rootDir.CreatorTime;//创建时间
List<MinioStoragePath> ds = GetMenuTree(item.Pk.ToString()); rootModel.CreatorUser = rootDir.CreatorUser;//创建者
foreach (var items in ds) rootModel.DownloadNum = rootDir.DownloadNum;//下载次数
{ rootModel.ModifyUsers = rootDir.ModifyUsers;//修改用户
StoragePath models = new StoragePath(); rootModel.ModifyTime = rootDir.ModifyTime;//修改时间
models.Pk = items.Pk; rootModel.ClearUsers = rootDir.ClearUsers;//删除用户
models.FileName = items.FileName; rootModel.ClearTime = rootDir.ClearTime;//删除时间
models.FilePath = items.FilePath; rootModel.ClearFlag = rootDir.ClearFlag;//删除标记 0未删除 1删除
models.FileType = items.FileType; rootModel.requstStoragePaths = bb.GetSubDirectories(rootDir.Pk);//子级存进list
models.FileLever = items.FileLevel; requstStoragePaths.Add(rootModel);//添加list
model.requstStoragePaths.Add(models);
}
requstStoragePaths.Add(model);
} }
} }
request.data = requstStoragePaths; request.data = requstStoragePaths;
@ -1188,8 +1178,6 @@ namespace IBKLinker_Minio.Controller.MinioController
return request; return request;
} }
/// <summary> /// <summary>
/// 权限查询 /// 权限查询
/// </summary> /// </summary>
@ -1346,7 +1334,7 @@ namespace IBKLinker_Minio.Controller.MinioController
{ {
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db")) using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
{ {
request.data = db.Query<MinioOperationlog>("select * from MINIO_OPERATIONLOG where 1=1"); request.data = db.Query<MinioOperationlog>("select * from MINIO_OPERATIONLOG where 1=1 order by OPERATE_TIME desc");
request.code = "0"; request.code = "0";
} }
} }
@ -1590,42 +1578,6 @@ namespace IBKLinker_Minio.Controller.MinioController
} }
#endregion #endregion
#region
[HttpPost, Route("CESHI")]
public RequestEntity CESHI()
{
MinioBusinessLogic bb = new MinioBusinessLogic();//定义业务逻辑方法
RequestEntity request = new RequestEntity();
try
{
List<RequstStoragePath> requstStoragePaths = new List<RequstStoragePath>();
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
{
List<MinioStoragePath> rootDirectories = db.Query<MinioStoragePath>("select * from MINIO_STORAGE_PATH where CLEAR_FLAG='0' and FILE_TYPE='0'and FILE_LEVEL='1' ORDER BY PK").ToList();//查询根文件夹
foreach (var rootDir in rootDirectories)
{
RequstStoragePath rootModel = new RequstStoragePath();
rootModel.Pk = rootDir.Pk;//主键ID
rootModel.FileName = rootDir.FileName;//文件名称
rootModel.FilePath = rootDir.FilePath;//文件路径
rootModel.FileType = rootDir.FileType;//文件类型
rootModel.FileLever = rootDir.FileLevel;//层级
rootModel.requstStoragePaths = bb.GetSubDirectories(rootDir.Pk);//子级存进list
requstStoragePaths.Add(rootModel);//添加list
}
}
request.data = requstStoragePaths;
request.code = "0";
}
catch (Exception)
{
request.code = "1";
throw;
}
return request;
}
#endregion
} }
} }

@ -14,6 +14,12 @@ namespace IBKLinker_Minio.Entity.MinioController
/// 主键 /// 主键
/// </summary> /// </summary>
public int Pk { get; set; } public int Pk { get; set; }
/// <summary>
/// 主键
/// </summary>
public int Upk { get; set; }
/// <summary> /// <summary>
///文件名称 ///文件名称
/// </summary> /// </summary>
@ -31,7 +37,52 @@ namespace IBKLinker_Minio.Entity.MinioController
/// <summary> /// <summary>
///层级 ///层级
/// </summary> /// </summary>
public int FileLever { get; set; } public int FileLevel { get; set; }
/// <summary>
///下载次数
/// </summary>
public int DownloadNum { get; set; }
/// <summary>
///创建者
/// </summary>
public string CreatorUser { get; set; }
/// <summary>
///创建时间
/// </summary>
public DateTime? CreatorTime { get; set; }
/// <summary>
///修改用户
/// </summary>
public string ModifyUsers { get; set; }
/// <summary>
///修改时间
/// </summary>
public DateTime? ModifyTime { get; set; }
/// <summary>
///删除标记 0未删除 1删除
/// </summary>
public string ClearFlag { get; set; }
/// <summary>
///删除用户
/// </summary>
public string ClearUsers { get; set; }
/// <summary>
///删除时间
/// </summary>
public DateTime? ClearTime { get; set; }
/// <summary>
///文件种类1、技术协议 2、质量要点 3、工艺卡 4、其他
/// </summary>
public string DocumentType { get; set; }
} }
public class RequstStoragePath: StoragePath public class RequstStoragePath: StoragePath
{ {

Loading…
Cancel
Save