😎调整文件上传接口
This commit is contained in:
parent
14a808c9b3
commit
d5f9a60f47
@ -6,45 +6,9 @@
|
|||||||
|
|
||||||
namespace Admin.NET.Core.Service;
|
namespace Admin.NET.Core.Service;
|
||||||
|
|
||||||
public class FileInput : BaseIdInput
|
/// <summary>
|
||||||
{
|
/// 文件分页查询
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// 文件名称
|
|
||||||
/// </summary>
|
|
||||||
public string FileName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件类型
|
|
||||||
/// </summary>
|
|
||||||
public string FileType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否公开
|
|
||||||
/// 若为true则所有人都可以查看,默认只有自己或有权限的可以查看
|
|
||||||
/// </summary>
|
|
||||||
public bool IsPublic { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件Url
|
|
||||||
/// </summary>
|
|
||||||
public string? Url { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 所属实体ID
|
|
||||||
/// </summary>
|
|
||||||
public long BelongId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关联对象Id
|
|
||||||
/// </summary>
|
|
||||||
public long RelationId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关联对象名称
|
|
||||||
/// </summary>
|
|
||||||
public string RelationName { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PageFileInput : BasePageInput
|
public class PageFileInput : BasePageInput
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -52,6 +16,11 @@ public class PageFileInput : BasePageInput
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件后缀
|
||||||
|
/// </summary>
|
||||||
|
public string? Suffix { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开始时间
|
/// 开始时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -67,7 +36,37 @@ public class DeleteFileInput : BaseIdInput
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UploadFileFromBase64Input
|
/// <summary>
|
||||||
|
/// 上传文件
|
||||||
|
/// </summary>
|
||||||
|
public class UploadFileInput : SysFile
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 文件
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public IFormFile File { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件路径
|
||||||
|
/// </summary>
|
||||||
|
public string Path { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 文件保存路径
|
||||||
|
/// </summary>
|
||||||
|
public string SavePath { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 允许格式:.jpeg.jpg.png.bmp.gif.tif
|
||||||
|
/// </summary>
|
||||||
|
public string AllowSuffix { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 上传文件Base64
|
||||||
|
/// </summary>
|
||||||
|
public class UploadFileFromBase64Input : SysFile
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件内容
|
/// 文件内容
|
||||||
@ -79,84 +78,10 @@ public class UploadFileFromBase64Input
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string ContentType { get; set; }
|
public string ContentType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件名称
|
|
||||||
/// </summary>
|
|
||||||
public string FileName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存路径
|
/// 保存路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件类型
|
|
||||||
/// </summary>
|
|
||||||
public string FileType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否公开
|
|
||||||
/// 若为true则所有人都可以查看,默认只有自己或有权限的可以查看
|
|
||||||
/// </summary>
|
|
||||||
public bool IsPublic { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 所属实体ID
|
|
||||||
/// </summary>
|
|
||||||
public long BelongId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关联对象Id
|
|
||||||
/// </summary>
|
|
||||||
public long RelationId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关联对象名称
|
|
||||||
/// </summary>
|
|
||||||
public string RelationName { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 上传文件
|
|
||||||
/// </summary>
|
|
||||||
public class FileUploadInput
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 文件
|
|
||||||
/// </summary>
|
|
||||||
[Required]
|
|
||||||
public IFormFile File { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件类型
|
|
||||||
/// </summary>
|
|
||||||
public string FileType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否公开
|
|
||||||
/// 若为true则所有人都可以查看,默认只有自己或有权限的可以查看
|
|
||||||
/// </summary>
|
|
||||||
public bool IsPublic { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件路径
|
|
||||||
/// </summary>
|
|
||||||
public string Path { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 所属实体ID
|
|
||||||
/// </summary>
|
|
||||||
public long BelongId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关联对象Id
|
|
||||||
/// </summary>
|
|
||||||
public long RelationId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关联对象名称
|
|
||||||
/// </summary>
|
|
||||||
public string RelationName { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -175,7 +100,7 @@ public class RelationQueryInput
|
|||||||
public long? RelationId { get; set; }
|
public long? RelationId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 文件,多个以","分割
|
/// 文件类型:多个以","分割
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string FileTypes { get; set; }
|
public string FileTypes { get; set; }
|
||||||
|
|
||||||
@ -185,80 +110,11 @@ public class RelationQueryInput
|
|||||||
public long? BelongId { get; set; }
|
public long? BelongId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// 文件类型分割
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public string[] GetFileTypeBS()
|
public string[] GetFileTypeBS()
|
||||||
{
|
{
|
||||||
return FileTypes.Split(',');
|
return FileTypes.Split(',');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public class FileOutput
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Id
|
|
||||||
/// </summary>
|
|
||||||
public long Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 名称
|
|
||||||
/// </summary>
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// URL
|
|
||||||
/// </summary>
|
|
||||||
public string Url { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 大小
|
|
||||||
/// </summary>
|
|
||||||
public long SizeKb { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 后缀
|
|
||||||
/// </summary>
|
|
||||||
public string Suffix { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 路径
|
|
||||||
/// </summary>
|
|
||||||
public string FilePath { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 文件类别
|
|
||||||
/// </summary>
|
|
||||||
public string FileType { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 是否公开
|
|
||||||
/// 若为true则所有人都可以查看,默认只有自己或有权限的可以查看
|
|
||||||
/// </summary>
|
|
||||||
public bool IsPublic { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 上传人
|
|
||||||
/// </summary>
|
|
||||||
public string CreateUserName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 上传时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime? CreateTime { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关联对象名称
|
|
||||||
/// </summary>
|
|
||||||
public string RelationName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 关联对象Id
|
|
||||||
/// </summary>
|
|
||||||
public long? RelationId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 所属Id
|
|
||||||
/// </summary>
|
|
||||||
public long? BelongId { get; set; }
|
|
||||||
}
|
}
|
||||||
@ -50,11 +50,11 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
var privateList = _sysFileRep.AsQueryable().Where(u => u.IsPublic == false);
|
var privateList = _sysFileRep.AsQueryable().Where(u => u.IsPublic == false);
|
||||||
// 合并公开和私有附件并分页
|
// 合并公开和私有附件并分页
|
||||||
return await _sysFileRep.Context.UnionAll(publicList, privateList)
|
return await _sysFileRep.Context.UnionAll(publicList, privateList)
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.FileName), u => u.FileName.Contains(input.FileName.Trim()))
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FileName), u => u.FileName.Contains(input.FileName.Trim()))
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.StartTime.ToString()) && !string.IsNullOrWhiteSpace(input.EndTime.ToString()),
|
.WhereIF(!string.IsNullOrWhiteSpace(input.StartTime.ToString()) && !string.IsNullOrWhiteSpace(input.EndTime.ToString()),
|
||||||
u => u.CreateTime >= input.StartTime && u.CreateTime <= input.EndTime)
|
u => u.CreateTime >= input.StartTime && u.CreateTime <= input.EndTime)
|
||||||
.OrderBy(u => u.CreateTime, OrderByType.Desc)
|
.OrderBy(u => u.CreateTime, OrderByType.Desc)
|
||||||
.ToPagedListAsync(input.Page, input.PageSize);
|
.ToPagedListAsync(input.Page, input.PageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -63,9 +63,9 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DisplayName("上传文件")]
|
[DisplayName("上传文件")]
|
||||||
public async Task<SysFile> UploadFile([FromForm] FileUploadInput input)
|
public async Task<SysFile> UploadFile([FromForm] UploadFileInput input)
|
||||||
{
|
{
|
||||||
return await HandleUploadFile(input.File, input.Path, fileType: input.FileType, isPublic: input.IsPublic, belongId: input.BelongId, relationId: input.RelationId, relationName: input.RelationName);
|
return await HandleUploadFile(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -93,7 +93,9 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
Headers = new HeaderDictionary(),
|
Headers = new HeaderDictionary(),
|
||||||
ContentType = contentType
|
ContentType = contentType
|
||||||
};
|
};
|
||||||
return await UploadFile(new FileUploadInput { File = formFile, Path = input.Path, FileType = input.FileType, IsPublic = input.IsPublic });
|
var uploadFileInput = input.Adapt<UploadFileInput>();
|
||||||
|
uploadFileInput.File = formFile;
|
||||||
|
return await UploadFile(uploadFileInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -107,7 +109,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
var filelist = new List<SysFile>();
|
var filelist = new List<SysFile>();
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
{
|
{
|
||||||
filelist.Add(await UploadFile(new FileUploadInput { File = file }));
|
filelist.Add(await UploadFile(new UploadFileInput { File = file }));
|
||||||
}
|
}
|
||||||
return filelist;
|
return filelist;
|
||||||
}
|
}
|
||||||
@ -118,7 +120,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DisplayName("根据文件Id或Url下载")]
|
[DisplayName("根据文件Id或Url下载")]
|
||||||
public async Task<IActionResult> DownloadFile(FileInput input)
|
public async Task<IActionResult> DownloadFile(SysFile input)
|
||||||
{
|
{
|
||||||
var file = input.Id > 0 ? await GetFile(input) : await _sysFileRep.CopyNew().GetFirstAsync(u => u.Url == input.Url);
|
var file = input.Id > 0 ? await GetFile(input) : await _sysFileRep.CopyNew().GetFirstAsync(u => u.Url == input.Url);
|
||||||
var fileName = HttpUtility.UrlEncode(file.FileName, Encoding.GetEncoding("UTF-8"));
|
var fileName = HttpUtility.UrlEncode(file.FileName, Encoding.GetEncoding("UTF-8"));
|
||||||
@ -152,7 +154,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
[DisplayName("文件预览")]
|
[DisplayName("文件预览")]
|
||||||
public async Task<IActionResult> GetPreview([FromRoute] long Id)
|
public async Task<IActionResult> GetPreview([FromRoute] long Id)
|
||||||
{
|
{
|
||||||
var file = await GetFile(new FileInput { Id = Id });
|
var file = await GetFile(new SysFile { Id = Id });
|
||||||
//var fileName = HttpUtility.UrlEncode(file.FileName, Encoding.GetEncoding("UTF-8"));
|
//var fileName = HttpUtility.UrlEncode(file.FileName, Encoding.GetEncoding("UTF-8"));
|
||||||
var filePath = Path.Combine(file.FilePath, file.Id.ToString() + file.Suffix);
|
var filePath = Path.Combine(file.FilePath, file.Id.ToString() + file.Suffix);
|
||||||
|
|
||||||
@ -269,7 +271,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[ApiDescriptionSettings(Name = "Update"), HttpPost]
|
[ApiDescriptionSettings(Name = "Update"), HttpPost]
|
||||||
[DisplayName("更新文件")]
|
[DisplayName("更新文件")]
|
||||||
public async Task UpdateFile(FileInput input)
|
public async Task UpdateFile(SysFile input)
|
||||||
{
|
{
|
||||||
var isExist = await _sysFileRep.IsAnyAsync(u => u.Id == input.Id);
|
var isExist = await _sysFileRep.IsAnyAsync(u => u.Id == input.Id);
|
||||||
if (!isExist) throw Oops.Oh(ErrorCodeEnum.D8000);
|
if (!isExist) throw Oops.Oh(ErrorCodeEnum.D8000);
|
||||||
@ -283,7 +285,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[DisplayName("获取文件")]
|
[DisplayName("获取文件")]
|
||||||
public async Task<SysFile> GetFile([FromQuery] FileInput input)
|
public async Task<SysFile> GetFile([FromQuery] SysFile input)
|
||||||
{
|
{
|
||||||
var file = await _sysFileRep.CopyNew().GetByIdAsync(input.Id);
|
var file = await _sysFileRep.CopyNew().GetByIdAsync(input.Id);
|
||||||
return file ?? throw Oops.Oh(ErrorCodeEnum.D8000);
|
return file ?? throw Oops.Oh(ErrorCodeEnum.D8000);
|
||||||
@ -292,48 +294,39 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上传文件
|
/// 上传文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="file">文件</param>
|
/// <param name="input"></param>
|
||||||
/// <param name="savePath">路径</param>
|
|
||||||
/// <param name="allowSuffix">允许格式:.jpg.png.gif.tif.bmp</param>
|
|
||||||
/// <param name="fileType">类型</param>
|
|
||||||
/// <param name="isPublic">是否公开</param>
|
|
||||||
/// <param name="belongId">所属实体的ID</param>
|
|
||||||
/// <param name="relationName"></param>
|
|
||||||
/// <param name="relationId"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<SysFile> HandleUploadFile(IFormFile file, string savePath, string allowSuffix = "", string fileType = "", bool isPublic = false, long belongId = 0, string relationName = "", long relationId = 0)
|
private async Task<SysFile> HandleUploadFile(UploadFileInput input)
|
||||||
{
|
{
|
||||||
if (file == null) throw Oops.Oh(ErrorCodeEnum.D8000);
|
if (input.File == null) throw Oops.Oh(ErrorCodeEnum.D8000);
|
||||||
|
|
||||||
// 判断是否重复上传的文件
|
// 判断是否重复上传的文件
|
||||||
var sizeKb = file.Length / 1024; // 大小KB
|
var sizeKb = input.File.Length / 1024; // 大小KB
|
||||||
var fileMd5 = string.Empty;
|
var fileMd5 = string.Empty;
|
||||||
if (_uploadOptions.EnableMd5)
|
if (_uploadOptions.EnableMd5)
|
||||||
{
|
{
|
||||||
using (var fileStream = file.OpenReadStream())
|
using (var fileStream = input.File.OpenReadStream())
|
||||||
{
|
{
|
||||||
fileMd5 = OssUtils.ComputeContentMd5(fileStream, fileStream.Length);
|
fileMd5 = OssUtils.ComputeContentMd5(fileStream, fileStream.Length);
|
||||||
}
|
}
|
||||||
/*
|
// Mysql8 中如果使用了 utf8mb4_general_ci 之外的编码会出错,尽量避免在条件里使用.ToString()
|
||||||
* Mysql8 中如果使用了 utf8mb4_general_ci 之外的编码会出错,尽量避免在条件里使用.ToString()
|
// 因为 Squsugar 并不是把变量转换为字符串来构造SQL语句,而是构造了CAST(123 AS CHAR)这样的语句,这样这个返回值是utf8mb4_general_ci,所以容易出错。
|
||||||
* 因为 Squsugar 并不是把变量转换为字符串来构造SQL语句,而是构造了CAST(123 AS CHAR)这样的语句,这样这个返回值是utf8mb4_general_ci,所以容易出错。
|
|
||||||
*/
|
|
||||||
var sysFile = await _sysFileRep.GetFirstAsync(u => u.FileMd5 == fileMd5 && u.SizeKb == sizeKb);
|
var sysFile = await _sysFileRep.GetFirstAsync(u => u.FileMd5 == fileMd5 && u.SizeKb == sizeKb);
|
||||||
if (sysFile != null) return sysFile;
|
if (sysFile != null) return sysFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证文件类型
|
// 验证文件类型
|
||||||
if (!_uploadOptions.ContentType.Contains(file.ContentType))
|
if (!_uploadOptions.ContentType.Contains(input.File.ContentType))
|
||||||
throw Oops.Oh($"{ErrorCodeEnum.D8001}:{file.ContentType}");
|
throw Oops.Oh($"{ErrorCodeEnum.D8001}:{input.File.ContentType}");
|
||||||
|
|
||||||
// 验证文件大小
|
// 验证文件大小
|
||||||
if (sizeKb > _uploadOptions.MaxSize)
|
if (sizeKb > _uploadOptions.MaxSize)
|
||||||
throw Oops.Oh($"{ErrorCodeEnum.D8002},允许最大:{_uploadOptions.MaxSize}KB");
|
throw Oops.Oh($"{ErrorCodeEnum.D8002},允许最大:{_uploadOptions.MaxSize}KB");
|
||||||
|
|
||||||
// 获取文件后缀
|
// 获取文件后缀
|
||||||
var suffix = Path.GetExtension(file.FileName).ToLower(); // 后缀
|
var suffix = Path.GetExtension(input.File.FileName).ToLower(); // 后缀
|
||||||
if (string.IsNullOrWhiteSpace(suffix))
|
if (string.IsNullOrWhiteSpace(suffix))
|
||||||
suffix = string.Concat(".", file.ContentType.AsSpan(file.ContentType.LastIndexOf('/') + 1));
|
suffix = string.Concat(".", input.File.ContentType.AsSpan(input.File.ContentType.LastIndexOf('/') + 1));
|
||||||
if (!string.IsNullOrWhiteSpace(suffix))
|
if (!string.IsNullOrWhiteSpace(suffix))
|
||||||
{
|
{
|
||||||
//var contentTypeProvider = FS.GetFileExtensionContentTypeProvider();
|
//var contentTypeProvider = FS.GetFileExtensionContentTypeProvider();
|
||||||
@ -346,38 +339,30 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
throw Oops.Oh(ErrorCodeEnum.D8003);
|
throw Oops.Oh(ErrorCodeEnum.D8003);
|
||||||
|
|
||||||
// 防止客户端伪造文件类型
|
// 防止客户端伪造文件类型
|
||||||
if (!string.IsNullOrWhiteSpace(allowSuffix) && !allowSuffix.Contains(suffix))
|
if (!string.IsNullOrWhiteSpace(input.AllowSuffix) && !input.AllowSuffix.Contains(suffix))
|
||||||
throw Oops.Oh(ErrorCodeEnum.D8003);
|
throw Oops.Oh(ErrorCodeEnum.D8003);
|
||||||
//if (!VerifyFileExtensionName.IsSameType(file.OpenReadStream(), suffix))
|
//if (!VerifyFileExtensionName.IsSameType(file.OpenReadStream(), suffix))
|
||||||
// throw Oops.Oh(ErrorCodeEnum.D8001);
|
// throw Oops.Oh(ErrorCodeEnum.D8001);
|
||||||
|
|
||||||
var path = string.IsNullOrWhiteSpace(savePath) ? _uploadOptions.Path : savePath;
|
// 文件存储位置
|
||||||
|
var path = string.IsNullOrWhiteSpace(input.SavePath) ? _uploadOptions.Path : input.SavePath;
|
||||||
path = path.ParseToDateTimeForRep();
|
path = path.ParseToDateTimeForRep();
|
||||||
var newFile = new SysFile
|
|
||||||
{
|
var newFile = input.Adapt<SysFile>();
|
||||||
Id = YitIdHelper.NextId(),
|
newFile.Id = YitIdHelper.NextId();
|
||||||
// BucketName = _OSSProviderOptions.Enabled ? _OSSProviderOptions.Provider.ToString() : "Local",
|
newFile.BucketName = _OSSProviderOptions.Enabled ? _OSSProviderOptions.Bucket : "Local"; // 阿里云对bucket名称有要求,1.只能包括小写字母,数字,短横线(-)2.必须以小写字母或者数字开头 3.长度必须在3-63字节之间
|
||||||
// 阿里云对bucket名称有要求,1.只能包括小写字母,数字,短横线(-)2.必须以小写字母或者数字开头 3.长度必须在3-63字节之间
|
newFile.FileName = Path.GetFileNameWithoutExtension(input.File.FileName);
|
||||||
// 无法使用Provider
|
newFile.Suffix = suffix;
|
||||||
BucketName = _OSSProviderOptions.Enabled ? _OSSProviderOptions.Bucket : "Local",
|
newFile.SizeKb = sizeKb;
|
||||||
FileName = Path.GetFileNameWithoutExtension(file.FileName),
|
newFile.FilePath = path;
|
||||||
Suffix = suffix,
|
newFile.FileMd5 = fileMd5;
|
||||||
SizeKb = sizeKb,
|
|
||||||
FilePath = path,
|
|
||||||
FileMd5 = fileMd5,
|
|
||||||
FileType = fileType,
|
|
||||||
IsPublic = isPublic,
|
|
||||||
BelongId = belongId,
|
|
||||||
RelationId = relationId,
|
|
||||||
RelationName = relationName,
|
|
||||||
};
|
|
||||||
|
|
||||||
var finalName = newFile.Id + suffix; // 文件最终名称
|
var finalName = newFile.Id + suffix; // 文件最终名称
|
||||||
if (_OSSProviderOptions.Enabled)
|
if (_OSSProviderOptions.Enabled)
|
||||||
{
|
{
|
||||||
newFile.Provider = Enum.GetName(_OSSProviderOptions.Provider);
|
newFile.Provider = Enum.GetName(_OSSProviderOptions.Provider);
|
||||||
var filePath = string.Concat(path, "/", finalName);
|
var filePath = string.Concat(path, "/", finalName);
|
||||||
await _OSSService.PutObjectAsync(newFile.BucketName, filePath, file.OpenReadStream());
|
await _OSSService.PutObjectAsync(newFile.BucketName, filePath, input.File.OpenReadStream());
|
||||||
// http://<你的bucket名字>.oss.aliyuncs.com/<你的object名字>
|
// http://<你的bucket名字>.oss.aliyuncs.com/<你的object名字>
|
||||||
// 生成外链地址 方便前端预览
|
// 生成外链地址 方便前端预览
|
||||||
switch (_OSSProviderOptions.Provider)
|
switch (_OSSProviderOptions.Provider)
|
||||||
@ -407,7 +392,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
||||||
App.Configuration["SSHProvider:Port"].ToInt(), App.Configuration["SSHProvider:Username"], App.Configuration["SSHProvider:Password"]))
|
App.Configuration["SSHProvider:Port"].ToInt(), App.Configuration["SSHProvider:Username"], App.Configuration["SSHProvider:Password"]))
|
||||||
{
|
{
|
||||||
helper.UploadFile(file.OpenReadStream(), fullPath);
|
helper.UploadFile(input.File.OpenReadStream(), fullPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -420,7 +405,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
var realFile = Path.Combine(filePath, finalName);
|
var realFile = Path.Combine(filePath, finalName);
|
||||||
using (var stream = File.Create(realFile))
|
using (var stream = File.Create(realFile))
|
||||||
{
|
{
|
||||||
await file.CopyToAsync(stream);
|
await input.File.CopyToAsync(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
newFile.Url = $"{newFile.FilePath}/{newFile.Id + newFile.Suffix}";
|
newFile.Url = $"{newFile.FilePath}/{newFile.Id + newFile.Suffix}";
|
||||||
@ -437,7 +422,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
[DisplayName("上传头像")]
|
[DisplayName("上传头像")]
|
||||||
public async Task<SysFile> UploadAvatar([Required] IFormFile file)
|
public async Task<SysFile> UploadAvatar([Required] IFormFile file)
|
||||||
{
|
{
|
||||||
var sysFile = await HandleUploadFile(file, "upload/avatar", _imageType);
|
var sysFile = await HandleUploadFile(new UploadFileInput { File = file, AllowSuffix = _imageType, SavePath = "upload/avatar" });
|
||||||
|
|
||||||
var sysUserRep = _sysFileRep.ChangeRepository<SqlSugarRepository<SysUser>>();
|
var sysUserRep = _sysFileRep.ChangeRepository<SqlSugarRepository<SysUser>>();
|
||||||
var user = await sysUserRep.GetByIdAsync(_userManager.UserId);
|
var user = await sysUserRep.GetByIdAsync(_userManager.UserId);
|
||||||
@ -459,7 +444,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
[DisplayName("上传电子签名")]
|
[DisplayName("上传电子签名")]
|
||||||
public async Task<SysFile> UploadSignature([Required] IFormFile file)
|
public async Task<SysFile> UploadSignature([Required] IFormFile file)
|
||||||
{
|
{
|
||||||
var sysFile = await HandleUploadFile(file, "upload/signature", _imageType);
|
var sysFile = await HandleUploadFile(new UploadFileInput { File = file, AllowSuffix = _imageType, SavePath = "upload/signature" });
|
||||||
|
|
||||||
var sysUserRep = _sysFileRep.ChangeRepository<SqlSugarRepository<SysUser>>();
|
var sysUserRep = _sysFileRep.ChangeRepository<SqlSugarRepository<SysUser>>();
|
||||||
var user = await sysUserRep.GetByIdAsync(_userManager.UserId);
|
var user = await sysUserRep.GetByIdAsync(_userManager.UserId);
|
||||||
@ -501,28 +486,17 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
[DisplayName("根据关联查询附件")]
|
[DisplayName("根据关联查询附件")]
|
||||||
public async Task<List<FileOutput>> GetRelationFiles([FromQuery] RelationQueryInput input)
|
public async Task<List<SysFile>> GetRelationFiles([FromQuery] RelationQueryInput input)
|
||||||
{
|
{
|
||||||
return await _sysFileRep.AsQueryable()
|
return await _sysFileRep.AsQueryable()
|
||||||
.WhereIF(input.RelationId.HasValue && input.RelationId > 0, u => u.RelationId == input.RelationId)
|
.WhereIF(input.RelationId.HasValue && input.RelationId > 0, u => u.RelationId == input.RelationId)
|
||||||
.WhereIF(input.BelongId.HasValue && input.BelongId > 0, u => u.BelongId == input.BelongId.Value)
|
.WhereIF(input.BelongId.HasValue && input.BelongId > 0, u => u.BelongId == input.BelongId.Value)
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.RelationName), u => u.RelationName == input.RelationName)
|
.WhereIF(!string.IsNullOrWhiteSpace(input.RelationName), u => u.RelationName == input.RelationName)
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.FileTypes), u => input.GetFileTypeBS().Contains(u.FileType))
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FileTypes), u => input.GetFileTypeBS().Contains(u.FileType))
|
||||||
.Select(u => new FileOutput
|
.Select(u => new SysFile
|
||||||
{
|
{
|
||||||
Id = u.Id,
|
|
||||||
FileType = u.FileType,
|
|
||||||
Name = u.FileName,
|
|
||||||
RelationId = u.RelationId,
|
|
||||||
BelongId = u.BelongId,
|
|
||||||
FilePath = u.FilePath,
|
|
||||||
SizeKb = u.SizeKb,
|
|
||||||
Suffix = u.Suffix,
|
|
||||||
RelationName = u.RelationName,
|
|
||||||
Url = SqlFunc.MergeString("/api/sysFile/Preview/", u.Id.ToString()),
|
Url = SqlFunc.MergeString("/api/sysFile/Preview/", u.Id.ToString()),
|
||||||
CreateUserName = u.CreateUserName,
|
}, true)
|
||||||
CreateTime = u.CreateTime,
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ public class SysWxOpenService : IDynamicApiController, ITransient
|
|||||||
if (wxUser == null)
|
if (wxUser == null)
|
||||||
throw Oops.Oh("未找到用户上传失败");
|
throw Oops.Oh("未找到用户上传失败");
|
||||||
|
|
||||||
var res = await _sysFileService.UploadFile(new FileUploadInput { File = input.File, FileType = input.FileType, Path = input.Path });
|
var res = await _sysFileService.UploadFile(new UploadFileInput { File = input.File, FileType = input.FileType, Path = input.Path });
|
||||||
wxUser.Avatar = res.Url;
|
wxUser.Avatar = res.Url;
|
||||||
await _sysOAuthUserRep.AsUpdateable(wxUser).IgnoreColumns(true).ExecuteCommandAsync();
|
await _sysOAuthUserRep.AsUpdateable(wxUser).IgnoreColumns(true).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1,71 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Admin.NET 通用权限开发平台
|
|
||||||
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { FileOutput } from './file-output';
|
|
||||||
/**
|
|
||||||
* 全局返回结果
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @interface AdminResultListFileOutput
|
|
||||||
*/
|
|
||||||
export interface AdminResultListFileOutput {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态码
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof AdminResultListFileOutput
|
|
||||||
*/
|
|
||||||
code?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 类型success、warning、error
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof AdminResultListFileOutput
|
|
||||||
*/
|
|
||||||
type?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 错误信息
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof AdminResultListFileOutput
|
|
||||||
*/
|
|
||||||
message?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据
|
|
||||||
*
|
|
||||||
* @type {Array<FileOutput>}
|
|
||||||
* @memberof AdminResultListFileOutput
|
|
||||||
*/
|
|
||||||
result?: Array<FileOutput> | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 附加数据
|
|
||||||
*
|
|
||||||
* @type {any}
|
|
||||||
* @memberof AdminResultListFileOutput
|
|
||||||
*/
|
|
||||||
extras?: any | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时间
|
|
||||||
*
|
|
||||||
* @type {Date}
|
|
||||||
* @memberof AdminResultListFileOutput
|
|
||||||
*/
|
|
||||||
time?: Date;
|
|
||||||
}
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Admin.NET 通用权限开发平台
|
|
||||||
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @interface FileInput
|
|
||||||
*/
|
|
||||||
export interface FileInput {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键Id
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof FileInput
|
|
||||||
*/
|
|
||||||
id: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件名称
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof FileInput
|
|
||||||
*/
|
|
||||||
fileName?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件类型
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof FileInput
|
|
||||||
*/
|
|
||||||
fileType?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否公开 若为true则所有人都可以查看,默认只有自己或有权限的可以查看
|
|
||||||
*
|
|
||||||
* @type {boolean}
|
|
||||||
* @memberof FileInput
|
|
||||||
*/
|
|
||||||
isPublic?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件Url
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof FileInput
|
|
||||||
*/
|
|
||||||
url?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属实体ID
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof FileInput
|
|
||||||
*/
|
|
||||||
belongId?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关联对象Id
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof FileInput
|
|
||||||
*/
|
|
||||||
relationId?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关联对象名称
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof FileInput
|
|
||||||
*/
|
|
||||||
relationName?: string | null;
|
|
||||||
}
|
|
||||||
@ -1,126 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
/**
|
|
||||||
* Admin.NET 通用权限开发平台
|
|
||||||
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
|
||||||
*
|
|
||||||
* OpenAPI spec version: 1.0.0
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by the swagger code generator program.
|
|
||||||
* https://github.com/swagger-api/swagger-codegen.git
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @export
|
|
||||||
* @interface FileOutput
|
|
||||||
*/
|
|
||||||
export interface FileOutput {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Id
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
id?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
name?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* URL
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
url?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 大小
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
sizeKb?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 后缀
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
suffix?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 路径
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
filePath?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件类别
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
fileType?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否公开 若为true则所有人都可以查看,默认只有自己或有权限的可以查看
|
|
||||||
*
|
|
||||||
* @type {boolean}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
isPublic?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传人
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
createUserName?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传时间
|
|
||||||
*
|
|
||||||
* @type {Date}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
createTime?: Date | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关联对象名称
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
relationName?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关联对象Id
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
relationId?: number | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属Id
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof FileOutput
|
|
||||||
*/
|
|
||||||
belongId?: number | null;
|
|
||||||
}
|
|
||||||
@ -44,7 +44,6 @@ export * from './admin-result-list-db-column-output';
|
|||||||
export * from './admin-result-list-db-table-info';
|
export * from './admin-result-list-db-table-info';
|
||||||
export * from './admin-result-list-enum-entity';
|
export * from './admin-result-list-enum-entity';
|
||||||
export * from './admin-result-list-enum-type-output';
|
export * from './admin-result-list-enum-type-output';
|
||||||
export * from './admin-result-list-file-output';
|
|
||||||
export * from './admin-result-list-int64';
|
export * from './admin-result-list-int64';
|
||||||
export * from './admin-result-list-list-string';
|
export * from './admin-result-list-list-string';
|
||||||
export * from './admin-result-list-log-vis-output';
|
export * from './admin-result-list-log-vis-output';
|
||||||
@ -199,8 +198,6 @@ export * from './export-proc-by-tmpinput';
|
|||||||
export * from './export-proc-input';
|
export * from './export-proc-input';
|
||||||
export * from './field-attributes';
|
export * from './field-attributes';
|
||||||
export * from './field-info';
|
export * from './field-info';
|
||||||
export * from './file-input';
|
|
||||||
export * from './file-output';
|
|
||||||
export * from './filter';
|
export * from './filter';
|
||||||
export * from './filter-logic-enum';
|
export * from './filter-logic-enum';
|
||||||
export * from './filter-operator-enum';
|
export * from './filter-operator-enum';
|
||||||
|
|||||||
@ -82,6 +82,30 @@ export interface PageCodeGenInput {
|
|||||||
*/
|
*/
|
||||||
descStr?: string | null;
|
descStr?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库表名
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof PageCodeGenInput
|
||||||
|
*/
|
||||||
|
tableName?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务名(业务代码包名称)
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof PageCodeGenInput
|
||||||
|
*/
|
||||||
|
busName?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof PageCodeGenInput
|
||||||
|
*/
|
||||||
|
nameSpace?: string | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作者姓名
|
* 作者姓名
|
||||||
*
|
*
|
||||||
@ -90,6 +114,30 @@ export interface PageCodeGenInput {
|
|||||||
*/
|
*/
|
||||||
authorName?: string | null;
|
authorName?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成方式
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof PageCodeGenInput
|
||||||
|
*/
|
||||||
|
generateType?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否生成菜单
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof PageCodeGenInput
|
||||||
|
*/
|
||||||
|
generateMenu?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否使用 Api Service
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof PageCodeGenInput
|
||||||
|
*/
|
||||||
|
isApiService?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类名
|
* 类名
|
||||||
*
|
*
|
||||||
@ -138,38 +186,6 @@ export interface PageCodeGenInput {
|
|||||||
*/
|
*/
|
||||||
connectionString?: string | null;
|
connectionString?: string | null;
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成方式
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof PageCodeGenInput
|
|
||||||
*/
|
|
||||||
generateType?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 数据库表名
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof PageCodeGenInput
|
|
||||||
*/
|
|
||||||
tableName?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 命名空间
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof PageCodeGenInput
|
|
||||||
*/
|
|
||||||
nameSpace?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 业务名(业务代码包名称)
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof PageCodeGenInput
|
|
||||||
*/
|
|
||||||
busName?: string | null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能名(数据库表名称)
|
* 功能名(数据库表名称)
|
||||||
*
|
*
|
||||||
@ -186,14 +202,6 @@ export interface PageCodeGenInput {
|
|||||||
*/
|
*/
|
||||||
menuApplication?: string | null;
|
menuApplication?: string | null;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否生成菜单
|
|
||||||
*
|
|
||||||
* @type {boolean}
|
|
||||||
* @memberof PageCodeGenInput
|
|
||||||
*/
|
|
||||||
generateMenu?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单父级
|
* 菜单父级
|
||||||
*
|
*
|
||||||
@ -233,12 +241,4 @@ export interface PageCodeGenInput {
|
|||||||
* @memberof PageCodeGenInput
|
* @memberof PageCodeGenInput
|
||||||
*/
|
*/
|
||||||
printName?: string | null;
|
printName?: string | null;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否使用 Api Service
|
|
||||||
*
|
|
||||||
* @type {boolean}
|
|
||||||
* @memberof PageCodeGenInput
|
|
||||||
*/
|
|
||||||
isApiService?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
import { Filter } from './filter';
|
import { Filter } from './filter';
|
||||||
import { Search } from './search';
|
import { Search } from './search';
|
||||||
/**
|
/**
|
||||||
*
|
* 文件分页查询
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface PageFileInput
|
* @interface PageFileInput
|
||||||
@ -90,6 +90,14 @@ export interface PageFileInput {
|
|||||||
*/
|
*/
|
||||||
fileName?: string | null;
|
fileName?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件后缀
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof PageFileInput
|
||||||
|
*/
|
||||||
|
suffix?: string | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始时间
|
* 开始时间
|
||||||
*
|
*
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -85,14 +85,6 @@ export interface SysOAuthUser {
|
|||||||
*/
|
*/
|
||||||
isDelete?: boolean;
|
isDelete?: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* 邮箱
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof SysOAuthUser
|
|
||||||
*/
|
|
||||||
email?: string | null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统用户Id
|
* 系统用户Id
|
||||||
*
|
*
|
||||||
@ -155,6 +147,14 @@ export interface SysOAuthUser {
|
|||||||
*/
|
*/
|
||||||
avatar?: string | null;
|
avatar?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof SysOAuthUser
|
||||||
|
*/
|
||||||
|
email?: string | null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号码
|
* 手机号码
|
||||||
*
|
*
|
||||||
|
|||||||
@ -29,14 +29,6 @@ export interface SysRegion {
|
|||||||
*/
|
*/
|
||||||
id?: number;
|
id?: number;
|
||||||
|
|
||||||
/**
|
|
||||||
* 父Id
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof SysRegion
|
|
||||||
*/
|
|
||||||
pid?: number;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
*
|
*
|
||||||
@ -45,6 +37,14 @@ export interface SysRegion {
|
|||||||
*/
|
*/
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父Id
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof SysRegion
|
||||||
|
*/
|
||||||
|
pid?: number;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 简称
|
* 简称
|
||||||
*
|
*
|
||||||
|
|||||||
@ -93,6 +93,14 @@ export interface SysSchedule {
|
|||||||
*/
|
*/
|
||||||
tenantId?: number | null;
|
tenantId?: number | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日程内容
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof SysSchedule
|
||||||
|
*/
|
||||||
|
content: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户Id
|
* 用户Id
|
||||||
*
|
*
|
||||||
@ -125,14 +133,6 @@ export interface SysSchedule {
|
|||||||
*/
|
*/
|
||||||
endTime?: string | null;
|
endTime?: string | null;
|
||||||
|
|
||||||
/**
|
|
||||||
* 日程内容
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof SysSchedule
|
|
||||||
*/
|
|
||||||
content: string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {FinishStatusEnum}
|
* @type {FinishStatusEnum}
|
||||||
* @memberof SysSchedule
|
* @memberof SysSchedule
|
||||||
|
|||||||
@ -13,13 +13,213 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 上传文件Base64
|
||||||
*
|
*
|
||||||
* @export
|
* @export
|
||||||
* @interface UploadFileFromBase64Input
|
* @interface UploadFileFromBase64Input
|
||||||
*/
|
*/
|
||||||
export interface UploadFileFromBase64Input {
|
export interface UploadFileFromBase64Input {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 雪花Id
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
id?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*
|
||||||
|
* @type {Date}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
createTime?: Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*
|
||||||
|
* @type {Date}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
updateTime?: Date | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建者Id
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
createUserId?: number | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建者姓名
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
createUserName?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改者Id
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
updateUserId?: number | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改者姓名
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
updateUserName?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 软删除
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
isDelete?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建者部门Id
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
createOrgId?: number | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建者部门名称
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
createOrgName?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户Id
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
tenantId?: number | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提供者
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
provider?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓储名称
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
bucketName?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件名称(源文件名)
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
fileName?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件后缀
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
suffix?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储路径
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
filePath?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件大小KB
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
sizeKb?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件大小信息-计算后的
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
sizeInfo?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外链地址-OSS上传后生成外链地址方便前端预览
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
url?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件MD5
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
fileMd5?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联对象名称(如子对象)
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
relationName?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联对象Id
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
relationId?: number | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 所属Id(如主对象)
|
||||||
|
*
|
||||||
|
* @type {number}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
belongId?: number | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类别
|
||||||
|
*
|
||||||
|
* @type {string}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
fileType?: string | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否公开 若为true则所有人都可以查看,默认只有自己或有权限的可以查看
|
||||||
|
*
|
||||||
|
* @type {boolean}
|
||||||
|
* @memberof UploadFileFromBase64Input
|
||||||
|
*/
|
||||||
|
isPublic?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件内容
|
* 文件内容
|
||||||
*
|
*
|
||||||
@ -36,14 +236,6 @@ export interface UploadFileFromBase64Input {
|
|||||||
*/
|
*/
|
||||||
contentType?: string | null;
|
contentType?: string | null;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件名称
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof UploadFileFromBase64Input
|
|
||||||
*/
|
|
||||||
fileName?: string | null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存路径
|
* 保存路径
|
||||||
*
|
*
|
||||||
@ -51,44 +243,4 @@ export interface UploadFileFromBase64Input {
|
|||||||
* @memberof UploadFileFromBase64Input
|
* @memberof UploadFileFromBase64Input
|
||||||
*/
|
*/
|
||||||
path?: string | null;
|
path?: string | null;
|
||||||
|
|
||||||
/**
|
|
||||||
* 文件类型
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof UploadFileFromBase64Input
|
|
||||||
*/
|
|
||||||
fileType?: string | null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否公开 若为true则所有人都可以查看,默认只有自己或有权限的可以查看
|
|
||||||
*
|
|
||||||
* @type {boolean}
|
|
||||||
* @memberof UploadFileFromBase64Input
|
|
||||||
*/
|
|
||||||
isPublic?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 所属实体ID
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof UploadFileFromBase64Input
|
|
||||||
*/
|
|
||||||
belongId?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关联对象Id
|
|
||||||
*
|
|
||||||
* @type {number}
|
|
||||||
* @memberof UploadFileFromBase64Input
|
|
||||||
*/
|
|
||||||
relationId?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 关联对象名称
|
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
* @memberof UploadFileFromBase64Input
|
|
||||||
*/
|
|
||||||
relationName?: string | null;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user