diff --git a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs index f786582c7..703f91773 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs @@ -21,55 +21,73 @@ namespace IRaCIS.Core.Application.ViewModel public Guid UpdateUserId { get; set; } public string Code { get; set; } public Guid? ParentId { get; set; } - public bool IsEnable { get; set; } - public bool IsConfig { get; set; } + public bool? IsEnable { get; set; } + public bool? IsConfig { get; set; } public string ModuleTypeId { get; set; } public string OptTypeId { get; set; } public string ChildrenTypeId { get; set; } - } + + public string ConfigType { get; set; } + + public bool? IsShowParent { get; set; } + + public string ChildrenTypeValue { get; set; } + public string ChildrenTypeValueCN { get; set; } + + public string ModuleTypeValue { get; set; } + public string ModuleTypeValueCN { get; set; } + + public string OptTypeValue { get; set; } + public string OptTypeValueCN { get; set; } + } ///FrontAuditConfigQuery 列表查询参数模型 public class FrontAuditConfigQuery { /// Value - public string Value { get; set; } + public string Value { get; set; }=string.Empty; /// ValueCN - public string ValueCN { get; set; } + public string ValueCN { get; set; } = string.Empty; - /// Description - public string Description { get; set; } + /// Description + public string Description { get; set; } = string.Empty; - /// Code - public string Code { get; set; } + /// Code + public string Code { get; set; } = string.Empty; - /// OptTypeId - public string OptTypeId { get; set; } + /// OptTypeId + public string OptTypeId { get; set; } = string.Empty; - /// ChildrenTypeId - public string ChildrenTypeId { get; set; } + /// ChildrenTypeId + public string ChildrenTypeId { get; set; } = string.Empty; - } + } /// FrontAuditConfigAddOrEdit 列表查询参数模型 public class FrontAuditConfigAddOrEdit { - public Guid Id { get; set; } - public string Value { get; set; } - public string ValueCN { get; set; } - public string Description { get; set; } - public DateTime CreateTime { get; set; } + public Guid? Id { get; set; } + public string Value { get; set; } = string.Empty; + public string ValueCN { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public DateTime CreateTime { get; set; } public Guid CreateUserId { get; set; } public DateTime UpdateTime { get; set; } public Guid UpdateUserId { get; set; } - public string Code { get; set; } - public Guid? ParentId { get; set; } + public string Code { get; set; } = string.Empty; + public Guid? ParentId { get; set; } public bool IsEnable { get; set; } public bool IsConfig { get; set; } - public string ModuleTypeId { get; set; } - public string OptTypeId { get; set; } - public string ChildrenTypeId { get; set; } - } + public string ModuleTypeId { get; set; } = string.Empty; + public string OptTypeId { get; set; } = string.Empty; + public string ChildrenTypeId { get; set; } = string.Empty; + + public string ConfigType { get; set; } = string.Empty; + + public bool? IsShowParent { get; set; } + + } } diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs index 86f74fc99..8ddfb92f5 100644 --- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs @@ -31,21 +31,55 @@ namespace IRaCIS.Core.Application.Service /// /// /// + [HttpPost] public async Task> GetFrontAuditConfigList(FrontAuditConfigQuery iq) { - var query = _repository.GetQueryable() + + + var query = from data in _repository.GetQueryable() + join childrenType in _repository.GetQueryable() on data.ChildrenTypeId equals childrenType.Id.ToString() into childrenTypetemp + from leftchildrenType in childrenTypetemp.DefaultIfEmpty() + join ModuleType in _repository.GetQueryable() on data.ModuleTypeId equals ModuleType.Id.ToString() into ModuleTypetemp + from leftModuleType in ModuleTypetemp.DefaultIfEmpty() + join OptTypeId in _repository.GetQueryable() on data.OptTypeId equals OptTypeId.Id.ToString() into OptTypeIdtemp + from leftOptTypeId in OptTypeIdtemp.DefaultIfEmpty() + select new FrontAuditConfigView() + { + + IsShowParent = data.IsShowParent, + ChildrenTypeId = data.ChildrenTypeId, + Code = data.Code, + ConfigType = data.ConfigType, + CreateTime = data.CreateTime, + CreateUserId = data.CreateUserId, + Description = data.Description, + IsConfig = data.IsConfig, + IsEnable = data.IsEnable, + ModuleTypeId = data.ModuleTypeId, + Id = data.Id, + ParentId = data.ParentId, + UpdateTime = data.UpdateTime, + Value = data.Value, + ChildrenTypeValueCN = leftchildrenType.ValueCN, + ModuleTypeValue = leftModuleType.Value, + ModuleTypeValueCN = leftModuleType.ValueCN, + OptTypeId = data.OptTypeId, + OptTypeValue = leftOptTypeId.Value, + OptTypeValueCN = leftOptTypeId.ValueCN, + UpdateUserId = data.UpdateUserId, + ValueCN = data.ValueCN, + ChildrenTypeValue = leftchildrenType.Value, + }; + + query = query .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Value == iq.Value) - .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.ValueCN == iq.ValueCN) - .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Description == iq.Description) - .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.OptTypeId == iq.OptTypeId) - .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Code == iq.Code) - .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.ChildrenTypeId == iq.ChildrenTypeId); + .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.ValueCN == iq.ValueCN) + .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Description == iq.Description) + .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.OptTypeId == iq.OptTypeId) + .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.Code == iq.Code) + .WhereIf(!iq.Value.IsNullOrEmpty(), x => x.ChildrenTypeId == iq.ChildrenTypeId); - - var frontAuditConfigQueryable = query - .ProjectTo(_mapper.ConfigurationProvider); - - return await frontAuditConfigQueryable.ToListAsync(); + return await query.ToListAsync(); } @@ -61,7 +95,11 @@ namespace IRaCIS.Core.Application.Service //CreateMap(); // CreateMap< FrontAuditConfig,FrontAuditConfigAddOrEdit>().ReverseMap(); - + + addOrEditFrontAuditConfig.CreateTime= DateTime.Now; + addOrEditFrontAuditConfig.UpdateTime= DateTime.Now; + addOrEditFrontAuditConfig.CreateUserId = _userInfo.Id; + addOrEditFrontAuditConfig.UpdateUserId= _userInfo.Id; var entity = await _repository.InsertOrUpdateAsync(addOrEditFrontAuditConfig, true); diff --git a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs index 60ce75661..7df030f85 100644 --- a/IRaCIS.Core.Application/Service/Common/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Common/_MapConfig.cs @@ -1,6 +1,7 @@ using AutoMapper; using IRaCIS.Application.Contracts; using IRaCIS.Core.Application.Contracts; +using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Domain.Models; namespace IRaCIS.Core.Application.Service @@ -16,7 +17,7 @@ namespace IRaCIS.Core.Application.Service CreateMap(); - + CreateMap().ReverseMap(); CreateMap().ReverseMap(); CreateMap(); diff --git a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs index 8e90ba493..0fa6fd641 100644 --- a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs +++ b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs @@ -15,55 +15,52 @@ namespace IRaCIS.Core.Domain.Models [Table("FrontAuditConfig")] public class FrontAuditConfig : Entity, IAuditUpdate, IAuditAdd { - - - /// /// Value /// - [Required] + public string Value { get; set; } /// /// ValueCN /// - [Required] + public string ValueCN { get; set; } /// /// Description /// - [Required] + public string Description { get; set; } /// /// CreateTime /// - [Required] + public DateTime CreateTime { get; set; } /// /// CreateUserId /// - [Required] + public Guid CreateUserId { get; set; } /// /// UpdateTime /// - [Required] + public DateTime UpdateTime { get; set; } /// /// UpdateUserId /// - [Required] + public Guid UpdateUserId { get; set; } /// /// Code /// - [Required] + public string Code { get; set; } /// @@ -74,14 +71,14 @@ namespace IRaCIS.Core.Domain.Models /// /// IsEnable /// - [Required] - public bool IsEnable { get; set; } + + public bool? IsEnable { get; set; } /// /// IsConfig /// - [Required] - public bool IsConfig { get; set; } + + public bool? IsConfig { get; set; } /// /// ModuleTypeId @@ -97,7 +94,11 @@ namespace IRaCIS.Core.Domain.Models /// ChildrenTypeId /// public string ChildrenTypeId { get; set; } - - } + + public bool? IsShowParent { get; set; } + + public string ConfigType { get; set; } + + } }