This commit is contained in:
2024-05-17 15:24:28 +08:00
parent 5debdf1a07
commit 929b5378bc
6 changed files with 170 additions and 2 deletions

View File

@@ -10,5 +10,8 @@ namespace Tnb.EquipMgr.Entities.Dto
public string? equip_id { get; set; }
public string? equip_id_id { get; set; }
public string? file_name { get; set; }
public string file_type { get; set; }
public string file_ext { get; set; }
}
}

View File

@@ -28,6 +28,16 @@ public partial class EqpEquipFile : BaseEntity<string>
/// 文件名
/// </summary>
public string file_name { get; set; } = string.Empty;
/// <summary>
/// 文件后缀
/// </summary>
public string file_ext { get; set; } = string.Empty;
/// <summary>
/// 文件类型
/// </summary>
public string file_type { get; set; } = string.Empty;
/// <summary>
/// 创建用户

View File

@@ -38,12 +38,12 @@ namespace Tnb.EquipMgr
}
[HttpPost]
public async Task<string> Upload([FromForm] string equip_id, [FromForm] ChunkModel input)
public async Task<string> Upload([FromForm] string equip_id,[FromForm] string file_type, [FromForm] ChunkModel input)
{
string msg;
try
{
dynamic attachment = await _fileService.Uploader("annexpic", input);
FileControlsModel attachment = await _fileService.Uploader("annexpic", input);
EqpEquipFile eqpEquipFile = new()
{
@@ -52,6 +52,8 @@ namespace Tnb.EquipMgr
create_id = _userManager.UserId,
create_time = DateTime.Now,
attachment = JsonConvert.SerializeObject(attachment),
file_ext = attachment.fileExtension,
file_type = file_type,
org_id = _userManager.GetUserInfo().Result.organizeId,
};
@@ -82,6 +84,7 @@ namespace Tnb.EquipMgr
.LeftJoin<EqpEquipment>((a, b, c, d) => a.equip_id == d.id)
.Where((a, b, c, d) => a.equip_id == input.equip_id)
.WhereIF(queryJson != null && queryJson.ContainsKey("file_name"), (a, b, c, d) => a.file_name.Contains(queryJson!["file_name"]))
.WhereIF(queryJson != null && queryJson.ContainsKey("file_type"), (a, b, c, d) => a.file_type==queryJson!["file_type"])
.Select((a, b, c, d) => new EquipFileQueryOutput
{
id = a.id,
@@ -91,6 +94,8 @@ namespace Tnb.EquipMgr
create_time = a.create_time == null ? null : a.create_time.Value.ToString("yyyy-MM-dd"),
equip_id = d.name,
equip_id_id = a.equip_id,
file_ext = a.file_ext,
file_type = a.file_type,
file_name = a.file_name,
}).ToPagedListAsync(input.currentPage, input.pageSize);