diff --git a/IRaCIS.Core.Application/Service/Common/DTO/PublishLogViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/PublishLogViewModel.cs index b76607051..5cd098251 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/PublishLogViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/PublishLogViewModel.cs @@ -26,6 +26,8 @@ namespace IRaCIS.Core.Application.ViewModel public string? UpdateContent { get; set; } + public int? State { get; set; } + } /// PublishLogAddOrEdit 列表查询参数模型 @@ -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; } } diff --git a/IRaCIS.Core.Application/Service/Common/PublishLogService.cs b/IRaCIS.Core.Application/Service/Common/PublishLogService.cs index 5afb3aaf8..213c0b90a 100644 --- a/IRaCIS.Core.Application/Service/Common/PublishLogService.cs +++ b/IRaCIS.Core.Application/Service/Common/PublishLogService.cs @@ -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(_mapper.ConfigurationProvider); var pageList = await publishLogQueryable @@ -50,11 +52,11 @@ namespace IRaCIS.Core.Application.Service { return ResponseOutput.NotOk("版本号不符合要求"); } - + var verifyExp1 = new EntityVerifyExp() { - 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 GetCurrentPublishInfo() + { + var result = await _publishLogRepository.Where(t => t.IsCurrentVersion == true).ProjectTo(_mapper.ConfigurationProvider).FirstOrDefaultAsync(); + + if (result == null) + { + //系统当前版本未标记,请联系维护人员 + throw new QueryBusinessObjectNotExistException("系统当前版本未标记,请联系维护人员"); + } + + return result; + } + + + public async Task> GetPublishVersionSelect() + { + return await _publishLogRepository.ProjectTo(_mapper.ConfigurationProvider).OrderByDescending(t => t.State).ToListAsync(); + } } } diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index 18058ee40..743955f1a 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -78,6 +78,9 @@ namespace IRaCIS.Core.Application.Service CreateMap(); CreateMap().ReverseMap(); + CreateMap(); + + } } diff --git a/IRaCIS.Core.Domain/Common/PublishLog.cs b/IRaCIS.Core.Domain/Common/PublishLog.cs index 082edaef3..0a58ed3a3 100644 --- a/IRaCIS.Core.Domain/Common/PublishLog.cs +++ b/IRaCIS.Core.Domain/Common/PublishLog.cs @@ -17,48 +17,40 @@ namespace IRaCIS.Core.Domain.Models { - /// - /// Version - /// + [Required] public string Version { get; set; } - /// - /// PublishTime - /// + [Required] - public DateTime PublishTime { get; set; } + public DateTime? PublishTime { get; set; } - /// - /// UpdateContent - /// + [Required] public string UpdateContent { get; set; } - /// - /// CreateTime - /// + [Required] public DateTime CreateTime { get; set; } - /// - /// CreateUserId - /// + [Required] public Guid CreateUserId { get; set; } - /// - /// UpdateUserId - /// + [Required] public Guid UpdateUserId { get; set; } - /// - /// UpdateTime - /// + [Required] public DateTime UpdateTime { get; set; } - - } + + //0 开发中 ,已发布 + public int State { get; set; } + + public bool IsCurrentVersion { get; set; } + + + } }