版本历史功能增加
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-06-24 10:13:03 +08:00
parent 8521b0c28c
commit 1f9d29e005
4 changed files with 62 additions and 29 deletions
@@ -26,6 +26,8 @@ namespace IRaCIS.Core.Application.ViewModel
public string? UpdateContent { get; set; }
public int? State { get; set; }
}
///<summary> PublishLogAddOrEdit 列表查询参数模型</summary>
@@ -33,9 +35,24 @@ namespace IRaCIS.Core.Application.ViewModel
{
public Guid? Id { get; set; }
public string Version { get; set; }
public DateTime PublishTime { get; set; }
public DateTime? PublishTime { get; set; }
public string UpdateContent { get; set; }
//0 开发中 ,已发布
public int State { get; set; }
public bool IsCurrentVersion { get; set; }
}
public class PublishVersionSelect
{
public Guid Id { get; set; }
public string Version { get; set; }
public int State { get; set; }
public DateTime? PublishTime { get; set; }
public bool IsCurrentVersion { get; set; }
}
@@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Interfaces;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Application.Contracts;
using Microsoft.AspNetCore.Authorization;
namespace IRaCIS.Core.Application.Service
{
@@ -31,8 +32,9 @@ namespace IRaCIS.Core.Application.Service
{
var publishLogQueryable = _publishLogRepository
.WhereIf(!string.IsNullOrEmpty(inQuery.Version) , t => t.Version.Contains(inQuery.Version))
.WhereIf(!string.IsNullOrEmpty(inQuery.Version), t => t.Version.Contains(inQuery.Version))
.WhereIf(!string.IsNullOrEmpty(inQuery.UpdateContent), t => t.UpdateContent.Contains(inQuery.UpdateContent))
.WhereIf(inQuery.State != null, t => t.State == inQuery.State)
.ProjectTo<PublishLogView>(_mapper.ConfigurationProvider);
var pageList = await publishLogQueryable
@@ -50,11 +52,11 @@ namespace IRaCIS.Core.Application.Service
{
return ResponseOutput.NotOk("版本号不符合要求");
}
var verifyExp1 = new EntityVerifyExp<PublishLog>()
{
VerifyExp = u => u.Version == addOrEditPublishLog.Version ,
VerifyExp = u => u.Version == addOrEditPublishLog.Version,
VerifyMsg = "发布编号不能重复"
};
@@ -74,6 +76,25 @@ namespace IRaCIS.Core.Application.Service
return ResponseOutput.Ok();
}
[AllowAnonymous]
public async Task<PublishLogView> GetCurrentPublishInfo()
{
var result = await _publishLogRepository.Where(t => t.IsCurrentVersion == true).ProjectTo<PublishLogView>(_mapper.ConfigurationProvider).FirstOrDefaultAsync();
if (result == null)
{
//系统当前版本未标记,请联系维护人员
throw new QueryBusinessObjectNotExistException("系统当前版本未标记,请联系维护人员");
}
return result;
}
public async Task<List<PublishVersionSelect>> GetPublishVersionSelect()
{
return await _publishLogRepository.ProjectTo<PublishVersionSelect>(_mapper.ConfigurationProvider).OrderByDescending(t => t.State).ToListAsync();
}
}
}
@@ -78,6 +78,9 @@ namespace IRaCIS.Core.Application.Service
CreateMap<PublishLog, PublishLogView>();
CreateMap<PublishLog, PublishLogAddOrEdit>().ReverseMap();
CreateMap<PublishLog, PublishVersionSelect>();
}
}