diff --git a/aspnet-core/Directory.Build.Volo.targets b/aspnet-core/Directory.Build.Volo.targets
index 143bcc6c..05aa4ccf 100644
--- a/aspnet-core/Directory.Build.Volo.targets
+++ b/aspnet-core/Directory.Build.Volo.targets
@@ -10,6 +10,8 @@
+
+
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/CreateFileObjectInput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/CreateFileObjectInput.cs
deleted file mode 100644
index 2c9ad759..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/CreateFileObjectInput.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files;
-
-///
-/// 创建文件
-///
-public class CreateFileObjectInput
-{
- ///
- /// 文件Provider
- ///
- [Required(ErrorMessage = "文件Provider不能为空")]
- public string ProviderKey { get; set; }
- ///
- /// 文件扩展名
- ///
- [Required(ErrorMessage = "文件扩展名不能为空")]
- public string FileExtension { get; set; }
- ///
- /// 二进制数据
- ///
- [Required(ErrorMessage = "二进制数据不能为空")]
- public long Bytes { get; set; }
- ///
- /// 文件大小
- ///
- [Required(ErrorMessage = "文件大小不能为空")]
- public long FileSize { get; set; }
- ///
- /// 文件名称
- ///
- [Required(ErrorMessage = "文件名称不能为空")]
- public string ContentType { get; set; }
- ///
- /// 文件名称
- ///
- [Required(ErrorMessage = "文件名称不能为空")]
- public string FileName { get; set; }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectInput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectInput.cs
deleted file mode 100644
index 2b011195..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectInput.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files;
-
-public class GetFileObjectInput
-{
- ///
- /// 文件Id
- ///
- public Guid Id { get; set; }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectOutput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectOutput.cs
deleted file mode 100644
index e2da2dff..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectOutput.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files;
-
-public class GetFileObjectOutput
-{
- ///
- /// 文件Id
- ///
- public Guid Id { get; set; }
-
- ///
- /// 文件Provider
- ///
- public string ProviderKey { get; set; }
-
- ///
- /// 文件扩展名
- ///
- public string FileExtension { get; set; }
-
- ///
- /// 二进制数据
- ///
- public byte[] Bytes { get; set; }
-
- ///
- /// 文件大小
- ///
- public long FileSize { get; set; }
-
- ///
- /// 文件名称
- ///
- public string ContentType { get; set; }
-
- ///
- /// 文件名称
- ///
- public string FileName { get; set; }
-
- ///
- /// 创建时间
- ///
- public DateTime CreationTime { get; set; }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/IFileAppService.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/IFileAppService.cs
index 8ebfe68c..44b9a5e4 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/IFileAppService.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/IFileAppService.cs
@@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
+using Volo.Abp.Content;
namespace Lion.AbpPro.FileManagement.Files;
@@ -18,17 +19,16 @@ public interface IFileAppService : IApplicationService
///
/// 上传文件
///
- Task> UploadAsync(List files);
+ Task UploadAsync(List files);
///
/// 删除文件
///
Task DeleteAsync(DeleteFileObjectInput input);
- Task GetAsync(GetFileObjectInput input);
///
/// 下载文件
///
- Task DownloadAsync(DownloadFileObjectInput input);
+ Task DownloadAsync(DownloadFileObjectInput input);
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectOutput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectOutput.cs
index cab050f8..2525a40f 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectOutput.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectOutput.cs
@@ -9,39 +9,26 @@ public class PageFileObjectOutput
/// 文件Id
///
public Guid Id { get; set; }
-
- ///
- /// 文件Provider
- ///
- public string ProviderKey { get; set; }
-
- ///
- /// 文件扩展名
- ///
- public string FileExtension { get; set; }
-
- // ///
- // /// 二进制数据
- // ///
- // public byte[] Bytes { get; set; }
-
+
///
/// 文件大小
///
public long FileSize { get; set; }
-
+
+ public string BeautifySize => SizeHelper.BeautifySize(FileSize);
+
///
/// 文件名称
///
public string ContentType { get; set; }
-
+
///
/// 文件名称
///
public string FileName { get; set; }
-
+
///
/// 创建时间
///
- public DateTime CreationTime { get; set; }
+ public DateTime CreationTime { get; set; }
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UpdateFileInput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UpdateFileInput.cs
deleted file mode 100644
index 38eddc81..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UpdateFileInput.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files;
-
-///
-/// 更新文件
-///
-public class UpdateFileInput
-{
- ///
- /// 文件Id
- ///
- public Guid Id { get; set; }
-
- ///
- /// 文件Provider
- ///
- [Required(ErrorMessage = "文件Provider不能为空")]
- public string ProviderKey { get; set; }
- ///
- /// 文件扩展名
- ///
- [Required(ErrorMessage = "文件扩展名不能为空")]
- public string FileExtension { get; set; }
- ///
- /// 二进制数据
- ///
- [Required(ErrorMessage = "二进制数据不能为空")]
- public long Bytes { get; set; }
- ///
- /// 文件大小
- ///
- [Required(ErrorMessage = "文件大小不能为空")]
- public long FileSize { get; set; }
- ///
- /// 文件名称
- ///
- [Required(ErrorMessage = "文件名称不能为空")]
- public string ContentType { get; set; }
- ///
- /// 文件名称
- ///
- [Required(ErrorMessage = "文件名称不能为空")]
- public string FileName { get; set; }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UploadOutput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UploadFileObjectOutput.cs
similarity index 84%
rename from aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UploadOutput.cs
rename to aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UploadFileObjectOutput.cs
index 478cd849..7b4f86ba 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UploadOutput.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UploadFileObjectOutput.cs
@@ -1,6 +1,6 @@
namespace Lion.AbpPro.FileManagement.Files;
-public class UploadOutput
+public class UploadFileObjectOutput
{
public Guid Id { get; set; }
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissionDefinitionProvider.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissionDefinitionProvider.cs
index 71f46e69..76dc91ff 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissionDefinitionProvider.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissionDefinitionProvider.cs
@@ -4,10 +4,11 @@ public class FileManagementPermissionDefinitionProvider : PermissionDefinitionPr
{
public override void Define(IPermissionDefinitionContext context)
{
- var abpIdentityGroup = context.GetGroup("AbpIdentity");
-
- var fileManagement = abpIdentityGroup.AddPermission(FileManagementPermissions.FileManagement.Default,
- L("Permission:FileManagement"));
+ var fileManagementGroup = context.AddGroup(FileManagementPermissions.GroupName, L("Permission:FileManagement"));
+ var filePermission = fileManagementGroup.AddPermission(FileManagementPermissions.FileManagement.Default, L("Permission:FileManagement:File"));
+ filePermission.AddChild(FileManagementPermissions.FileManagement.Upload, L("Permission:FileManagement:File:Upload"));
+ filePermission.AddChild(FileManagementPermissions.FileManagement.Download, L("Permission:FileManagement:File:Download"));
+ filePermission.AddChild(FileManagementPermissions.FileManagement.Delete, L("Permission:FileManagement:File:Delete"));
}
private static LocalizableString L(string name)
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissions.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissions.cs
index 1fc7f0fb..94017928 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissions.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissions.cs
@@ -2,14 +2,16 @@ namespace Lion.AbpPro.FileManagement.Permissions;
public class FileManagementPermissions
{
- public const string GroupName = "AbpIdentity";
+ public const string GroupName = "FileManagement";
public static class FileManagement
{
- public const string Default = GroupName + ".FileManagement";
+ public const string Default = GroupName + ".File";
public const string Upload = Default + ".Upload";
- public const string Down = Default + ".Down";
+ public const string Download = Default + ".Download";
+ public const string Delete = Default + ".Delete";
}
+
public static string[] GetAll()
{
return ReflectionHelper.GetPublicConstantsRecursively(typeof(FileManagementPermissions));
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationAutoMapperProfile.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationAutoMapperProfile.cs
index 0e110b91..b617b2d5 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationAutoMapperProfile.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationAutoMapperProfile.cs
@@ -7,6 +7,5 @@ public class FileManagementApplicationAutoMapperProfile : Profile
public FileManagementApplicationAutoMapperProfile()
{
CreateMap();
- CreateMap();
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Files/FileAppService.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Files/FileAppService.cs
index 14b2da5b..ec3829d4 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Files/FileAppService.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Files/FileAppService.cs
@@ -1,23 +1,20 @@
-using Lion.AbpPro.FileManagement.Provider;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
-
namespace Lion.AbpPro.FileManagement.Files;
///
/// 文件
///
-[Authorize]
+[Authorize(FileManagementPermissions.FileManagement.Default)]
public class FileAppService : ApplicationService, IFileAppService
{
private readonly FileObjectManager _fileObjectManager;
- private readonly IFileProvider _fileProvider;
+ private readonly FileManager _fileManager;
+ private readonly IBlobContainer _blobContainer;
- public FileAppService(FileObjectManager fileObjectManager, IFileProvider fileProvider)
+ public FileAppService(FileObjectManager fileObjectManager, IBlobContainer blobContainer, FileManager fileManager)
{
_fileObjectManager = fileObjectManager;
- _fileProvider = fileProvider;
+ _blobContainer = blobContainer;
+ _fileManager = fileManager;
}
///
@@ -34,71 +31,34 @@ public class FileAppService : ApplicationService, IFileAppService
return result;
}
- public async Task> UploadAsync(List files)
+ [Authorize(FileManagementPermissions.FileManagement.Upload)]
+ public async Task UploadAsync(List files)
{
- var result = new List();
foreach (var formFile in files)
{
- try
- {
- var item = new UploadOutput();
- // 获取文件的二进制数据
- using var memoryStream = new MemoryStream();
- await formFile.CopyToAsync(memoryStream);
- var fileBytes = memoryStream.ToArray();
-
- // 这里可以对 fileBytes 进行后续处理,例如保存到数据库或文件系统等
- // 示例:将文件保存到数据库
- var updateResult = await _fileProvider.UploadAsync(new UpdateDto()
- {
- FileName = formFile.FileName,
- Bytes = fileBytes,
- ContentType = formFile.ContentType,
- FileSize = formFile.Length
- });
-
- result.Add(new UploadOutput()
- {
- Id = updateResult.Id,
- Name = updateResult.FileName,
- Path = updateResult.FilePath,
- Success = true
- });
- }
- catch (Exception e)
- {
- Logger.LogError(e, "上传文件失败");
- result.Add(new UploadOutput()
- {
- Id = Guid.Empty,
- Name = formFile.FileName,
- Path = string.Empty,
- Success = false
- });
- }
+ // 获取文件的二进制数据
+ using var memoryStream = new MemoryStream();
+ await formFile.CopyToAsync(memoryStream);
+ var fileBytes = memoryStream.ToArray();
+ await _fileManager.CreateAsync(GuidGenerator.Create(), formFile.FileName, formFile.Length, formFile.ContentType, fileBytes, true);
}
-
- return result;
}
///
/// 删除文件
///
+ [Authorize(FileManagementPermissions.FileManagement.Delete)]
public Task DeleteAsync(DeleteFileObjectInput input)
{
- return _fileObjectManager.DeleteAsync(input.Id);
- }
-
- public async Task GetAsync(GetFileObjectInput input)
- {
- var file = await _fileObjectManager.GetAsync(input.Id);
- return ObjectMapper.Map(file);
+ return _fileManager.DeleteAsync(input.Id);
}
- public async Task DownloadAsync(DownloadFileObjectInput input)
+ [Authorize(FileManagementPermissions.FileManagement.Download)]
+ public async Task DownloadAsync(DownloadFileObjectInput input)
{
- var file = await _fileObjectManager.GetAsync(input.Id);
- return new Microsoft.AspNetCore.Mvc.FileContentResult(file.Bytes, file.ContentType);
+ var fileObject = await _fileObjectManager.GetAsync(input.Id);
+ var file = await _blobContainer.GetAsync(input.Id.ToString());
+ return new RemoteStreamContent(file, fileObject.FileName, fileObject.ContentType);
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/GlobalUsings.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/GlobalUsings.cs
index c7d27333..086045cb 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/GlobalUsings.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/GlobalUsings.cs
@@ -6,10 +6,13 @@ global using AutoMapper;
global using Lion.AbpPro.FileManagement.Localization;
global using Lion.AbpPro.FileManagement.Permissions;
global using Microsoft.AspNetCore.Authorization;
+global using Microsoft.AspNetCore.Http;
global using Microsoft.Extensions.Configuration;
global using Microsoft.Extensions.DependencyInjection;
global using Volo.Abp.Application;
global using Volo.Abp.Application.Dtos;
global using Volo.Abp.Application.Services;
global using Volo.Abp.AutoMapper;
+global using Volo.Abp.BlobStoring;
+global using Volo.Abp.Content;
global using Volo.Abp.Modularity;
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/FileManagementConsts.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/FileManagementConsts.cs
new file mode 100644
index 00000000..028e2e07
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/FileManagementConsts.cs
@@ -0,0 +1,15 @@
+namespace Lion.AbpPro.FileManagement
+{
+ public class FileManagementConsts
+ {
+ /// 名称空间
+ public const string NameSpace = "Lion.AbpPro.FileManagement";
+ /// 默认语言
+ public const string DefaultCultureName = "zh-Hans";
+
+ public const int Kilobyte = 1024;
+ public const int Megabyte = Kilobyte * 1024;
+ public const long Gigabyte = Megabyte * 1024;
+ public const long Terabyte = Gigabyte * 1024;
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/FileManagementDomainSharedModule.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/FileManagementDomainSharedModule.cs
index 65c63570..0fada807 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/FileManagementDomainSharedModule.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/FileManagementDomainSharedModule.cs
@@ -15,11 +15,11 @@ public class FileManagementDomainSharedModule : AbpModule
Configure(options =>
{
options.Resources
- .Add("en")
+ .Add(FileManagementConsts.DefaultCultureName)
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/Localization/FileManagement");
});
- Configure(options => { options.MapCodeNamespace("FileManagement", typeof(FileManagementResource)); });
+ Configure(options => { options.MapCodeNamespace(FileManagementConsts.NameSpace, typeof(FileManagementResource)); });
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/FileManagementErrorCodes.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/FileManagementErrorCodes.cs
index 6e4df5ce..5e1483f3 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/FileManagementErrorCodes.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/FileManagementErrorCodes.cs
@@ -2,5 +2,7 @@ namespace Lion.AbpPro.FileManagement;
public static class FileManagementErrorCodes
{
- //Add your business exception error codes here...
+ public const string FileAlreadyExist = FileManagementConsts.NameSpace + ":100001";
+
+ public const string FileNotFound = FileManagementConsts.NameSpace + ":100002";
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/FileObjectDto.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/FileObjectDto.cs
index b1731526..2f573863 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/FileObjectDto.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/FileObjectDto.cs
@@ -3,7 +3,7 @@ namespace Lion.AbpPro.FileManagement.Files;
///
/// 文件
///
-public class FileObjectDto
+public class FileObjectDto
{
///
/// 主键Id
@@ -13,29 +13,18 @@ public class FileObjectDto
///
/// 创建时间
///
- public DateTime CreationTime { get; set; }
+ public DateTime CreationTime { get; set; }
- ///
- /// 文件Provider
- ///
- public string ProviderKey { get; set; }
- ///
- /// 文件扩展名
- ///
- public string FileExtension { get; set; }
-
- ///
- /// 二进制数据
- ///
- public byte[] Bytes { get; set; }
///
/// 文件大小
///
public long FileSize { get; set; }
+
///
/// 文件名称
///
public string ContentType { get; set; }
+
///
/// 文件名称
///
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/SizeHelper.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/SizeHelper.cs
new file mode 100644
index 00000000..b8b0cd1d
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/SizeHelper.cs
@@ -0,0 +1,45 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+public static class SizeHelper
+{
+ public static string BeautifySize(long size)
+ {
+ if (size == 0 || size == 1)
+ {
+ return $"{size} Byte";
+ }
+
+ if (size >= FileManagementConsts.Terabyte)
+ {
+ var fixedSize = ((float)size / (float)FileManagementConsts.Terabyte);
+ return $"{FormatSize(fixedSize)} TB";
+ }
+
+ if (size >= FileManagementConsts.Gigabyte)
+ {
+ var fixedSize = ((float)size / (float)FileManagementConsts.Gigabyte);
+ return $"{FormatSize(fixedSize)} GB";
+ }
+
+ if (size >= FileManagementConsts.Megabyte)
+ {
+ var fixedSize = ((float)size / (float)FileManagementConsts.Megabyte);
+ return $"{FormatSize(fixedSize)} MB";
+ }
+
+ if (size >= FileManagementConsts.Kilobyte)
+ {
+ var fixedSize = ((float)size / (float)FileManagementConsts.Kilobyte);
+ return $"{FormatSize(fixedSize)} KB";
+ }
+
+ return $"{size} B";
+ }
+
+ public static string FormatSize(float size)
+ {
+ var s = $"{size:0.00}";
+
+ return s.EndsWith("00") ? ((int)size).ToString() : s;
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Localization/FileManagement/en.json b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Localization/FileManagement/en.json
index 21c325ca..edc792ae 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Localization/FileManagement/en.json
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Localization/FileManagement/en.json
@@ -4,7 +4,11 @@
"MyAccount": "My account",
"SamplePageMessage": "A sample page for the FileManagement module",
"Permission:FileManagement": "FileManagement",
- "Permission:Upload": "Upload",
- "Permission:Down": "Down"
+ "Permission:FileManagement:File": "FileManagement",
+ "Permission:FileManagement:File:Upload": "Upload",
+ "Permission:FileManagement:File:Download": "Download",
+ "Permission:FileManagement:File:Delete": "Delete",
+ "FileManagement:100001": "FileAlreadyExist",
+ "FileManagement:100002": "FileNotFound"
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Localization/FileManagement/zh-Hans.json b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Localization/FileManagement/zh-Hans.json
index 9b1c8d60..3669fe2b 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Localization/FileManagement/zh-Hans.json
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Localization/FileManagement/zh-Hans.json
@@ -4,7 +4,11 @@
"MyAccount": "我的账户",
"SamplePageMessage": "FileManagement模块的示例页面",
"Permission:FileManagement": "文件管理",
- "Permission:Upload": "上传",
- "Permission:Down": "下载"
+ "Permission:FileManagement:File": "文件管理",
+ "Permission:FileManagement:File:Upload": "上传",
+ "Permission:FileManagement:File:Download": "下载",
+ "Permission:FileManagement:File:Delete": "删除",
+ "FileManagement:100001": "文件已经存在",
+ "FileManagement:100002": "文件未找到"
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainModule.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainModule.cs
index ee0cf99b..7014ecd7 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainModule.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainModule.cs
@@ -5,7 +5,8 @@ namespace Lion.AbpPro.FileManagement;
[DependsOn(
typeof(AbpDddDomainModule),
typeof(AbpAutoMapperModule),
- typeof(FileManagementDomainSharedModule)
+ typeof(FileManagementDomainSharedModule),
+ typeof(AbpBlobStoringModule)
)]
public class FileManagementDomainModule : AbpModule
{
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/AbpProFileManagementContainer.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/AbpProFileManagementContainer.cs
new file mode 100644
index 00000000..0111494d
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/AbpProFileManagementContainer.cs
@@ -0,0 +1,6 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+[BlobContainerName("abp-file-management")]
+public class AbpProFileManagementContainer
+{
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/DomainFileManagementException.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/DomainFileManagementException.cs
new file mode 100644
index 00000000..35ea29e9
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/DomainFileManagementException.cs
@@ -0,0 +1,13 @@
+namespace Lion.AbpPro.FileManagement.Files
+{
+ public class DomainFileManagementException : BusinessException
+ {
+ public DomainFileManagementException(string code = null, string message = null, string details = null, Exception innerException = null,
+ LogLevel logLevel = LogLevel.Warning) : base(code, message, details,
+ innerException,
+ logLevel
+ )
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileManager.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileManager.cs
new file mode 100644
index 00000000..fbf15833
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileManager.cs
@@ -0,0 +1,39 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+public class FileManager : DomainService
+{
+ private readonly IBlobContainer _blobContainer;
+ private readonly FileObjectManager _fileObjectManager;
+
+ public FileManager(IBlobContainer blobContainer, FileObjectManager fileObjectManager)
+ {
+ _blobContainer = blobContainer;
+ _fileObjectManager = fileObjectManager;
+ }
+
+ ///
+ /// 创建文件
+ ///
+ public virtual async Task CreateAsync(
+ Guid id,
+ string fileName,
+ long fileSize,
+ string contentType,
+ byte[] content,
+ bool overwrite = false
+ )
+ {
+ var entity = await _fileObjectManager.CreateAsync(id, fileName, fileSize, contentType, content, overwrite);
+ await _blobContainer.SaveAsync(id.ToString(), content, true);
+ return entity;
+ }
+
+ ///
+ /// 删除文件
+ ///
+ public virtual async Task DeleteAsync(Guid id)
+ {
+ await _fileObjectManager.DeleteAsync(id);
+ await _blobContainer.DeleteAsync(id.ToString());
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObject.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObject.cs
index 80ef6af4..c7863668 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObject.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObject.cs
@@ -1,3 +1,4 @@
+using JetBrains.Annotations;
using Lion.AbpPro.Core;
namespace Lion.AbpPro.FileManagement.Files;
@@ -7,20 +8,14 @@ namespace Lion.AbpPro.FileManagement.Files;
///
public class FileObject : FullAuditedAggregateRoot, IMultiTenant
{
-
-
public FileObject(
Guid id,
- string providerKey,
- byte[] bytes,
+ string fileName,
long fileSize,
string contentType,
- string fileName,
Guid? tenantId = null
) : base(id)
{
- SetProviderKey(providerKey);
- SetBytes(bytes);
SetFileSize(fileSize);
SetContentType(contentType);
SetFileName(fileName);
@@ -34,70 +29,27 @@ public class FileObject : FullAuditedAggregateRoot, IMultiTenant
///
public string FileName { get; private set; }
- ///
- /// 文件名称
- ///
- public string ContentType { get; private set; }
-
-
///
/// 文件大小
///
public long FileSize { get; private set; }
-
- ///
- /// 文件扩展名
- ///
- public string FileExtension { get; private set; }
-
///
- /// 二进制数据
+ /// 文件类型
///
- public byte[] Bytes { get; private set; }
-
- ///
- /// 文件Provider
- ///
- public string ProviderKey { get; private set; }
-
-
- ///
- /// 设置文件Provider
- ///
- private void SetProviderKey(string providerKey)
- {
- Guard.NotNullOrWhiteSpace(providerKey, nameof(providerKey), 128, 0);
- ProviderKey = providerKey;
- }
-
- ///
- /// 设置文件扩展名
- ///
- private void SetFileExtension(string fileExtension)
- {
- Guard.NotNullOrWhiteSpace(fileExtension, nameof(fileExtension), 36, 0);
- FileExtension = fileExtension;
- }
+ public string ContentType { get; private set; }
- ///
- /// 设置二进制数据
- ///
- private void SetBytes(byte[] bytes)
- {
- Bytes = bytes;
- }
///
/// 设置文件大小
///
- private void SetFileSize(long fileSize)
+ public void SetFileSize(long fileSize)
{
FileSize = fileSize;
}
///
- /// 设置文件名称
+ /// 设置文件类型
///
private void SetContentType(string contentType)
{
@@ -111,7 +63,6 @@ public class FileObject : FullAuditedAggregateRoot, IMultiTenant
private void SetFileName(string fileName)
{
Guard.NotNullOrWhiteSpace(fileName, nameof(fileName), 128, 0);
- SetFileExtension(Path.GetExtension(fileName));
FileName = fileName;
}
@@ -119,17 +70,11 @@ public class FileObject : FullAuditedAggregateRoot, IMultiTenant
/// 更新文件
///
public void Update(
- string providerKey,
- string fileExtension,
- byte[] bytes,
long fileSize,
string contentType,
string fileName
)
{
- SetProviderKey(providerKey);
- SetFileExtension(fileExtension);
- SetBytes(bytes);
SetFileSize(fileSize);
SetContentType(contentType);
SetFileName(fileName);
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObjectManager.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObjectManager.cs
index 802ae5c3..fa1816cb 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObjectManager.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObjectManager.cs
@@ -8,16 +8,19 @@ public class FileObjectManager : DomainService
private readonly IObjectMapper _objectMapper;
private readonly ICurrentTenant _currentTenant;
- public FileObjectManager(IFileObjectRepository iIFileObjectRepository, IObjectMapper objectMapper, ICurrentTenant currentTenant)
+ public FileObjectManager(IFileObjectRepository fileObjectRepository,
+ IObjectMapper objectMapper,
+ ICurrentTenant currentTenant)
{
- _fileObjectRepository = iIFileObjectRepository;
+ _fileObjectRepository = fileObjectRepository;
_objectMapper = objectMapper;
_currentTenant = currentTenant;
}
public async Task> GetListAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null, int maxResultCount = 10, int skipCount = 0)
{
- return await _fileObjectRepository.GetListAsync(fileName, startDateTime, endDateTime, maxResultCount, skipCount);
+ var list = await _fileObjectRepository.GetListAsync(fileName, startDateTime, endDateTime, maxResultCount, skipCount);
+ return _objectMapper.Map, List>(list);
}
public async Task GetCountAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null)
@@ -31,14 +34,29 @@ public class FileObjectManager : DomainService
public async Task CreateAsync(
Guid id,
string fileName,
- byte[] bytes,
long fileSize,
string contentType,
- string providerKey
+ byte[] content,
+ bool overwrite = false
)
{
- var entity = new FileObject(id, providerKey, bytes, fileSize, contentType, fileName, _currentTenant.Id);
- entity = await _fileObjectRepository.InsertAsync(entity);
+ var entity = await _fileObjectRepository.FindAsync(fileName);
+ if (entity != null)
+ {
+ if (!overwrite)
+ {
+ throw new DomainFileManagementException(FileManagementErrorCodes.FileAlreadyExist);
+ }
+
+ entity.SetFileSize(fileSize);
+ await _fileObjectRepository.UpdateAsync(entity);
+ }
+ else
+ {
+ entity = new FileObject(id, fileName, fileSize, contentType);
+ await _fileObjectRepository.InsertAsync(entity);
+ }
+
return _objectMapper.Map(entity);
}
@@ -49,17 +67,17 @@ public class FileObjectManager : DomainService
public async Task DeleteAsync(Guid id)
{
var entity = await _fileObjectRepository.FindAsync(id);
- if (entity == null) throw new UserFriendlyException($"文件不存在");
+ if (entity == null) throw new DomainFileManagementException(FileManagementErrorCodes.FileNotFound);
await _fileObjectRepository.DeleteAsync(entity);
}
///
- /// 删除文件
+ /// 获取文件
///
public async Task GetAsync(Guid id)
{
var entity = await _fileObjectRepository.FindAsync(id);
- if (entity == null) throw new UserFriendlyException($"文件不存在");
+ if (entity == null) throw new DomainFileManagementException(FileManagementErrorCodes.FileNotFound);
return _objectMapper.Map(entity);
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileObjectRepository.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileObjectRepository.cs
index a9dc2c00..9169887a 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileObjectRepository.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileObjectRepository.cs
@@ -2,7 +2,10 @@ namespace Lion.AbpPro.FileManagement.Files;
public interface IFileObjectRepository : IBasicRepository
{
- Task> GetListAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null, int maxResultCount = 10, int skipCount = 0);
+ Task> GetListAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null, int maxResultCount = 10, int skipCount = 0);
Task GetCountAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null);
+
+ Task FindAsync(string fileName);
+
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/GlobalUsings.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/GlobalUsings.cs
index bbc1c117..0ac05c38 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/GlobalUsings.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/GlobalUsings.cs
@@ -6,11 +6,13 @@ global using System.Diagnostics;
global using System.IO;
global using System.Linq;
global using System.Runtime.InteropServices;
+global using System.Runtime.Serialization;
global using System.Threading;
global using System.Threading.Tasks;
global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Logging.Abstractions;
global using Volo.Abp;
+global using Volo.Abp.BlobStoring;
global using Volo.Abp.Data;
global using Volo.Abp.DependencyInjection;
global using Volo.Abp.Domain;
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Lion.AbpPro.FileManagement.Domain.csproj b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Lion.AbpPro.FileManagement.Domain.csproj
index fd901280..01d0ecf7 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Lion.AbpPro.FileManagement.Domain.csproj
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Lion.AbpPro.FileManagement.Domain.csproj
@@ -7,9 +7,10 @@
-
-
-
+
+
+
+
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/DatabaseFileProvider.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/DatabaseFileProvider.cs
deleted file mode 100644
index 14a3ca39..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/DatabaseFileProvider.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using Lion.AbpPro.FileManagement.Files;
-using Volo.Abp.Guids;
-
-namespace Lion.AbpPro.FileManagement.Provider;
-
-public class DatabaseFileProvider : IFileProvider, ITransientDependency
-{
- public const string Name = nameof(DatabaseFileProvider);
- private readonly FileObjectManager _fileObjectManager;
- private readonly IGuidGenerator _guidGenerator;
-
- public DatabaseFileProvider(FileObjectManager fileObjectManager, IGuidGenerator guidGenerator)
- {
- _fileObjectManager = fileObjectManager;
- _guidGenerator = guidGenerator;
- }
-
- public async Task UploadAsync(UpdateDto input)
- {
- var id = _guidGenerator.Create();
- var fileName = id + "_" + input.FileName;
- await _fileObjectManager.CreateAsync(id, fileName, input.Bytes, input.FileSize, input.ContentType, Name);
- return new UpdateResult()
- {
- Id = id,
- FileName = fileName,
- FilePath = fileName
- };
- }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/IFileProvider.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/IFileProvider.cs
deleted file mode 100644
index a2823bc4..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/IFileProvider.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Provider;
-
-public interface IFileProvider
-{
- Task UploadAsync(UpdateDto input);
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContextModelCreatingExtensions.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContextModelCreatingExtensions.cs
index d64637b1..f7477668 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContextModelCreatingExtensions.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContextModelCreatingExtensions.cs
@@ -11,9 +11,6 @@ public static class FileManagementDbContextModelCreatingExtensions
builder.Entity(b =>
{
b.ToTable(FileManagementDbProperties.DbTablePrefix + "FileObjects");
- b.Property(e => e.ProviderKey).IsRequired().HasMaxLength(128).HasComment("文件Provider");
- b.Property(e => e.FileExtension).IsRequired().HasMaxLength(36).HasComment("文件扩展名");
- b.Property(e => e.Bytes).HasComment("二进制数据");
b.Property(e => e.FileSize).HasComment("文件大小");
b.Property(e => e.ContentType).IsRequired().HasMaxLength(128).HasComment("文件名称");
b.Property(e => e.FileName).IsRequired().HasMaxLength(128).HasComment("文件名称");
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileObjectRepository.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileObjectRepository.cs
index c48fd497..6df63eb5 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileObjectRepository.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileObjectRepository.cs
@@ -8,7 +8,7 @@ namespace Lion.AbpPro.FileManagement.EntityFrameworkCore.Files;
///
/// 文件 仓储Ef core 实现
///
-public class EfCoreFileObjectRepository :
+public class EfCoreFileObjectRepository :
EfCoreRepository,
IFileObjectRepository
{
@@ -16,34 +16,28 @@ public class EfCoreFileObjectRepository :
{
}
- public async Task> GetListAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null,int maxResultCount = 10, int skipCount = 0)
+ public async Task> GetListAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null, int maxResultCount = 10, int skipCount = 0)
{
return await (await GetDbSetAsync())
- .WhereIf(fileName.IsNotNullOrWhiteSpace(),e=>e.FileName.Contains(fileName))
+ .WhereIf(fileName.IsNotNullOrWhiteSpace(), e => e.FileName.Contains(fileName))
.WhereIf(startDateTime.HasValue, e => e.CreationTime >= startDateTime.Value)
.WhereIf(endDateTime.HasValue, e => e.CreationTime <= endDateTime.Value)
.OrderByDescending(e => e.CreationTime)
.PageBy(skipCount, maxResultCount)
- .Select(e => new FileObjectDto
- {
-
- Id = e.Id,
- CreationTime = e.CreationTime,
- FileName = e.FileName,
- FileSize = e.FileSize,
- FileExtension = e.FileExtension,
- ContentType = e.ContentType,
- ProviderKey = e.ProviderKey
- }) // 选择指定字段
.ToListAsync();
}
public async Task GetCountAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null)
{
return await (await GetDbSetAsync())
- .WhereIf(fileName.IsNotNullOrWhiteSpace(),e=>e.FileName.Contains(fileName))
+ .WhereIf(fileName.IsNotNullOrWhiteSpace(), e => e.FileName.Contains(fileName))
.WhereIf(startDateTime.HasValue, e => e.CreationTime >= startDateTime.Value)
.WhereIf(endDateTime.HasValue, e => e.CreationTime <= endDateTime.Value)
.CountAsync();
}
+
+ public async Task FindAsync(string fileName)
+ {
+ return await (await GetDbSetAsync()).FirstOrDefaultAsync(e => e.FileName == fileName);
+ }
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Files/FileController.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Files/FileController.cs
index b310fb34..b75605e4 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Files/FileController.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Files/FileController.cs
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Http;
+using Volo.Abp.Content;
namespace Lion.AbpPro.FileManagement.Files;
@@ -21,9 +22,9 @@ public class FileController : AbpController, IFileAppService
[HttpPost("Upload")]
[SwaggerOperation(summary: "上传文件", Tags = new[] { "Files" })]
- public async Task> UploadAsync(List files)
+ public async Task UploadAsync(List files)
{
- return await _fileAppService.UploadAsync(files);
+ await _fileAppService.UploadAsync(files);
}
@@ -34,16 +35,10 @@ public class FileController : AbpController, IFileAppService
await _fileAppService.DeleteAsync(input);
}
- [HttpPost("Get")]
- [SwaggerOperation(summary: "获取文件", Tags = new[] { "Files" })]
- public Task GetAsync(GetFileObjectInput input)
- {
- return _fileAppService.GetAsync(input);
- }
[HttpPost("Download")]
[SwaggerOperation(summary: "下载文件", Tags = new[] { "Files" })]
- public Task DownloadAsync(DownloadFileObjectInput input)
+ public Task DownloadAsync(DownloadFileObjectInput input)
{
return _fileAppService.DownloadAsync(input);
}
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.Configure.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.Configure.cs
index 76027f2d..0bf1a443 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.Configure.cs
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.Configure.cs
@@ -1,5 +1,7 @@
using Medallion.Threading;
using Medallion.Threading.Redis;
+using Volo.Abp.BlobStoring;
+using Volo.Abp.BlobStoring.FileSystem;
namespace Lion.AbpPro;
@@ -287,4 +289,21 @@ public partial class AbpProHttpApiHostModule
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
});
}
+
+ ///
+ /// 配置blob设置
+ ///
+ private void ConfigureBlobStorage()
+ {
+ Configure(options =>
+ {
+ options.Containers.ConfigureDefault(container =>
+ {
+ container.UseFileSystem(fileSystem =>
+ {
+ fileSystem.BasePath = "C:\\my-files";
+ });
+ });
+ });
+ }
}
\ No newline at end of file
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
index 490e955f..374c7c2d 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
@@ -1,3 +1,4 @@
+using Volo.Abp.BlobStoring.FileSystem;
using Volo.Abp.DistributedLocking;
namespace Lion.AbpPro
@@ -15,7 +16,8 @@ namespace Lion.AbpPro
typeof(AbpProCapEntityFrameworkCoreModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpCachingStackExchangeRedisModule),
- typeof(AbpDistributedLockingModule)
+ typeof(AbpDistributedLockingModule),
+ typeof(AbpBlobStoringFileSystemModule)
//typeof(AbpBackgroundJobsHangfireModule)
)]
public partial class AbpProHttpApiHostModule : AbpModule
@@ -41,6 +43,7 @@ namespace Lion.AbpPro
ConfigureAuditLog(context);
ConfigurationSignalR(context);
ConfigurationMultiTenancy();
+ ConfigureBlobStorage();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj
index 3150398d..4df1ce68 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/Lion.AbpPro.HttpApi.Host.csproj
@@ -42,6 +42,7 @@
+
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
index e28b7837..9df02e23 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
@@ -34,16 +34,16 @@
"CorsOrigins": "https://*.AbpPro.com,http://localhost:4200,http://localhost:3100"
},
"ConnectionStrings": {
- "Default": "Data Source=localhost;Port=3306;Database=LionAbpPro9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
+ "Default": "Data Source=localhost;Port=3306;Database=LionAbpPro91;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
},
"Hangfire": {
"Redis": {
"Host": "localhost:localhost,password=1q2w3E*",
- "DB": "2"
+ "DB": "3"
}
},
"Redis": {
- "Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=5"
+ "Configuration": "localhost:6379,password=1q2w3E*,defaultdatabase=3"
},
"Jwt": {
"Audience": "Lion.AbpPro",
diff --git a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json
index 551870f2..e63fa70b 100644
--- a/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json
+++ b/aspnet-core/services/src/Lion.AbpPro.DbMigrator/appsettings.json
@@ -1,5 +1,5 @@
{
"ConnectionStrings": {
- "Default": "Data Source=localhost;Port=3306;Database=LionAbpPro9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
+ "Default": "Data Source=localhost;Port=3306;Database=LionAbpPro91;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
}
}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20250219151836_1.0.3.Designer.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20250219151836_1.0.3.Designer.cs
new file mode 100644
index 00000000..d5218f60
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20250219151836_1.0.3.Designer.cs
@@ -0,0 +1,2163 @@
+//
+using System;
+using Lion.AbpPro.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Volo.Abp.EntityFrameworkCore;
+
+#nullable disable
+
+namespace Lion.AbpPro.Migrations
+{
+ [DbContext(typeof(AbpProDbContext))]
+ [Migration("20250219151836_1.0.3")]
+ partial class _103
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
+ .HasAnnotation("ProductVersion", "9.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
+
+ modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionary", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("Code")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(1024)
+ .HasColumnType("varchar(1024)");
+
+ b.Property("DisplayText")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.ToTable("AbpDataDictionaries", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionaryDetail", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("Code")
+ .HasColumnType("longtext");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DataDictionaryId")
+ .HasColumnType("char(36)");
+
+ b.Property("Description")
+ .HasColumnType("longtext");
+
+ b.Property("DisplayText")
+ .HasColumnType("longtext");
+
+ b.Property("IsEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DataDictionaryId");
+
+ b.ToTable("AbpDataDictionaryDetails", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.FileManagement.Files.FileObject", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("ContentType")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("文件名称");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("FileName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("文件名称");
+
+ b.Property("FileSize")
+ .HasColumnType("bigint")
+ .HasComment("文件大小");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("FileName");
+
+ b.ToTable("AbpFileObjects", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.LanguageManagement.LanguageTexts.Aggregates.LanguageText", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("CultureName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("语言名称");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasComment("名称");
+
+ b.Property("ResourceName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("资源名称");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasComment("值");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TenantId", "ResourceName", "CultureName");
+
+ b.ToTable("AbpLanguageTexts", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.LanguageManagement.Languages.Aggregates.Language", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("CultureName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("语言名称");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("显示名称");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("FlagIcon")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("图标");
+
+ b.Property("IsDefault")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("IsEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.Property("UiCultureName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("Ui语言名称");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CultureName");
+
+ b.ToTable("AbpLanguages", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasMaxLength(1024)
+ .HasColumnType("varchar(1024)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("MessageLevel")
+ .HasColumnType("int");
+
+ b.Property("MessageType")
+ .HasColumnType("int");
+
+ b.Property("Read")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ReadTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("ReceiveUserId")
+ .HasColumnType("char(36)");
+
+ b.Property("ReceiveUserName")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("SenderUserId")
+ .HasColumnType("char(36)");
+
+ b.Property("SenderUserName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.HasKey("Id");
+
+ b.ToTable("AbpNotifications", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("NotificationId")
+ .HasColumnType("char(36)");
+
+ b.Property("Read")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ReadTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("ReceiveUserId")
+ .HasColumnType("char(36)");
+
+ b.Property("ReceiveUserName")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NotificationId");
+
+ b.HasIndex("ReceiveUserId");
+
+ b.ToTable("AbpNotificationSubscriptions", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ApplicationName")
+ .HasMaxLength(96)
+ .HasColumnType("varchar(96)")
+ .HasColumnName("ApplicationName");
+
+ b.Property("BrowserInfo")
+ .HasMaxLength(512)
+ .HasColumnType("varchar(512)")
+ .HasColumnName("BrowserInfo");
+
+ b.Property("ClientId")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("ClientId");
+
+ b.Property("ClientIpAddress")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("ClientIpAddress");
+
+ b.Property("ClientName")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("ClientName");
+
+ b.Property("Comments")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("Comments");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CorrelationId")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("CorrelationId");
+
+ b.Property("Exceptions")
+ .HasColumnType("longtext");
+
+ b.Property("ExecutionDuration")
+ .HasColumnType("int")
+ .HasColumnName("ExecutionDuration");
+
+ b.Property("ExecutionTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("HttpMethod")
+ .HasMaxLength(16)
+ .HasColumnType("varchar(16)")
+ .HasColumnName("HttpMethod");
+
+ b.Property("HttpStatusCode")
+ .HasColumnType("int")
+ .HasColumnName("HttpStatusCode");
+
+ b.Property("ImpersonatorTenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("ImpersonatorTenantId");
+
+ b.Property("ImpersonatorTenantName")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("ImpersonatorTenantName");
+
+ b.Property("ImpersonatorUserId")
+ .HasColumnType("char(36)")
+ .HasColumnName("ImpersonatorUserId");
+
+ b.Property("ImpersonatorUserName")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("ImpersonatorUserName");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.Property("TenantName")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("TenantName");
+
+ b.Property("Url")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("Url");
+
+ b.Property("UserId")
+ .HasColumnType("char(36)")
+ .HasColumnName("UserId");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("UserName");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TenantId", "ExecutionTime");
+
+ b.HasIndex("TenantId", "UserId", "ExecutionTime");
+
+ b.ToTable("AbpAuditLogs", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("AuditLogId")
+ .HasColumnType("char(36)")
+ .HasColumnName("AuditLogId");
+
+ b.Property("ExecutionDuration")
+ .HasColumnType("int")
+ .HasColumnName("ExecutionDuration");
+
+ b.Property("ExecutionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("ExecutionTime");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("MethodName")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("MethodName");
+
+ b.Property("Parameters")
+ .HasMaxLength(2000)
+ .HasColumnType("varchar(2000)")
+ .HasColumnName("Parameters");
+
+ b.Property("ServiceName")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("ServiceName");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuditLogId");
+
+ b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime");
+
+ b.ToTable("AbpAuditLogActions", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("AuditLogId")
+ .HasColumnType("char(36)")
+ .HasColumnName("AuditLogId");
+
+ b.Property("ChangeTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("ChangeTime");
+
+ b.Property("ChangeType")
+ .HasColumnType("tinyint unsigned")
+ .HasColumnName("ChangeType");
+
+ b.Property("EntityId")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("EntityId");
+
+ b.Property("EntityTenantId")
+ .HasColumnType("char(36)");
+
+ b.Property("EntityTypeFullName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("EntityTypeFullName");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuditLogId");
+
+ b.HasIndex("TenantId", "EntityTypeFullName", "EntityId");
+
+ b.ToTable("AbpEntityChanges", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("EntityChangeId")
+ .HasColumnType("char(36)");
+
+ b.Property("NewValue")
+ .HasMaxLength(512)
+ .HasColumnType("varchar(512)")
+ .HasColumnName("NewValue");
+
+ b.Property("OriginalValue")
+ .HasMaxLength(512)
+ .HasColumnType("varchar(512)")
+ .HasColumnName("OriginalValue");
+
+ b.Property("PropertyName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("PropertyName");
+
+ b.Property("PropertyTypeFullName")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("PropertyTypeFullName");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("EntityChangeId");
+
+ b.ToTable("AbpEntityPropertyChanges", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsAbandoned")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false);
+
+ b.Property("JobArgs")
+ .IsRequired()
+ .HasMaxLength(1048576)
+ .HasColumnType("longtext");
+
+ b.Property("JobName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("LastTryTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("NextTryTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Priority")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint unsigned")
+ .HasDefaultValue((byte)15);
+
+ b.Property("TryCount")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("smallint")
+ .HasDefaultValue((short)0);
+
+ b.HasKey("Id");
+
+ b.HasIndex("IsAbandoned", "NextTryTime");
+
+ b.ToTable("AbpBackgroundJobs", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureDefinitionRecord", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("AllowedProviders")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("DefaultValue")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("Description")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("GroupName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("IsAvailableToHost")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("IsVisibleToClients")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("ParentName")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("ValueType")
+ .HasMaxLength(2048)
+ .HasColumnType("varchar(2048)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GroupName");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.ToTable("AbpFeatures", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureGroupDefinitionRecord", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.ToTable("AbpFeatureGroups", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("ProviderKey")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)");
+
+ b.Property("ProviderName")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name", "ProviderName", "ProviderKey")
+ .IsUnique();
+
+ b.ToTable("AbpFeatureValues", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("Description")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsStatic")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("Regex")
+ .HasMaxLength(512)
+ .HasColumnType("varchar(512)");
+
+ b.Property("RegexDescription")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("Required")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ValueType")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.ToTable("AbpClaimTypes", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityLinkUser", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("SourceTenantId")
+ .HasColumnType("char(36)");
+
+ b.Property("SourceUserId")
+ .HasColumnType("char(36)");
+
+ b.Property("TargetTenantId")
+ .HasColumnType("char(36)");
+
+ b.Property("TargetUserId")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SourceUserId", "SourceTenantId", "TargetUserId", "TargetTenantId")
+ .IsUnique();
+
+ b.ToTable("AbpLinkUsers", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("EntityVersion")
+ .HasColumnType("int");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDefault")
+ .HasColumnType("tinyint(1)")
+ .HasColumnName("IsDefault");
+
+ b.Property("IsPublic")
+ .HasColumnType("tinyint(1)")
+ .HasColumnName("IsPublic");
+
+ b.Property("IsStatic")
+ .HasColumnType("tinyint(1)")
+ .HasColumnName("IsStatic");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property("NormalizedName")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)");
+
+ b.Property