From f68f496197ff37fb37caf982f8868d52c01c551e Mon Sep 17 00:00:00 2001 From: DK Date: Tue, 29 Mar 2022 10:04:32 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/DTO/FrontAuditConfigViewModel.cs | 22 ++++++- .../Service/Common/FrontAuditConfigService.cs | 60 +++++++++++++++---- IRaCIS.Core.Domain/Common/FrontAuditConfig.cs | 11 ++-- 3 files changed, 75 insertions(+), 18 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs index f786582c7..db7358011 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs @@ -26,7 +26,20 @@ namespace IRaCIS.Core.Application.ViewModel 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 @@ -69,7 +82,12 @@ namespace IRaCIS.Core.Application.ViewModel 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; } + + } } diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs index 86f74fc99..10df3993e 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.Value, + 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(); } @@ -62,6 +96,10 @@ namespace IRaCIS.Core.Application.Service // 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.Domain/Common/FrontAuditConfig.cs b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs index 8e90ba493..c23d3091c 100644 --- a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs +++ b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs @@ -15,9 +15,6 @@ namespace IRaCIS.Core.Domain.Models [Table("FrontAuditConfig")] public class FrontAuditConfig : Entity, IAuditUpdate, IAuditAdd { - - - /// /// Value /// @@ -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; } + + } } From aa303a12636837a526737010c63e9433c7280e88 Mon Sep 17 00:00:00 2001 From: DK Date: Tue, 29 Mar 2022 10:29:04 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/DTO/FrontAuditConfigViewModel.cs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs index db7358011..2b2ac1611 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs @@ -45,24 +45,24 @@ namespace IRaCIS.Core.Application.ViewModel 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 @@ -75,17 +75,17 @@ namespace IRaCIS.Core.Application.ViewModel 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; } + public string ConfigType { get; set; } = string.Empty; - public bool? IsShowParent { get; set; } + public bool? IsShowParent { get; set; } } From 93a7345ddd741ff99c49280261b0a593b81bb8c0 Mon Sep 17 00:00:00 2001 From: DK Date: Tue, 29 Mar 2022 11:07:46 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/DTO/FrontAuditConfigViewModel.cs | 24 +++++++++---------- .../Service/Common/FrontAuditConfigService.cs | 2 +- .../Service/Common/_MapConfig.cs | 3 ++- IRaCIS.Core.Domain/Common/FrontAuditConfig.cs | 24 +++++++++---------- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs index 2b2ac1611..703f91773 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/FrontAuditConfigViewModel.cs @@ -21,8 +21,8 @@ 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; } @@ -67,25 +67,25 @@ namespace IRaCIS.Core.Application.ViewModel /// 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; } = string.Empty; - public Guid? ParentId { get; set; } + public Guid? ParentId { get; set; } public bool IsEnable { get; set; } public bool IsConfig { get; set; } - public string ModuleTypeId { get; set; } = string.Empty; + public string ModuleTypeId { get; set; } = string.Empty; public string OptTypeId { get; set; } = string.Empty; - public string ChildrenTypeId { get; set; } = string.Empty; + public string ChildrenTypeId { get; set; } = string.Empty; - public string ConfigType { get; set; } = string.Empty; + public string ConfigType { get; set; } = string.Empty; - public bool? IsShowParent { get; set; } + public bool? IsShowParent { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs index 10df3993e..8c754c6b8 100644 --- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs @@ -95,7 +95,7 @@ namespace IRaCIS.Core.Application.Service //CreateMap(); // CreateMap< FrontAuditConfig,FrontAuditConfigAddOrEdit>().ReverseMap(); - + addOrEditFrontAuditConfig.CreateTime= DateTime.Now; addOrEditFrontAuditConfig.UpdateTime= DateTime.Now; addOrEditFrontAuditConfig.CreateUserId = _userInfo.Id; 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 c23d3091c..0fa6fd641 100644 --- a/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs +++ b/IRaCIS.Core.Domain/Common/FrontAuditConfig.cs @@ -18,49 +18,49 @@ namespace IRaCIS.Core.Domain.Models /// /// 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; } /// @@ -71,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 From 10da69c6d41e1f12b16a19f06a1fcdcba758acac Mon Sep 17 00:00:00 2001 From: DK Date: Tue, 29 Mar 2022 11:25:48 +0800 Subject: [PATCH 4/4] --- .../Service/Common/FrontAuditConfigService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs index 8c754c6b8..8ddfb92f5 100644 --- a/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs +++ b/IRaCIS.Core.Application/Service/Common/FrontAuditConfigService.cs @@ -63,7 +63,7 @@ namespace IRaCIS.Core.Application.Service ChildrenTypeValueCN = leftchildrenType.ValueCN, ModuleTypeValue = leftModuleType.Value, ModuleTypeValueCN = leftModuleType.ValueCN, - OptTypeId = data.Value, + OptTypeId = data.OptTypeId, OptTypeValue = leftOptTypeId.Value, OptTypeValueCN = leftOptTypeId.ValueCN, UpdateUserId = data.UpdateUserId,