From f68f496197ff37fb37caf982f8868d52c01c551e Mon Sep 17 00:00:00 2001 From: DK Date: Tue, 29 Mar 2022 10:04:32 +0800 Subject: [PATCH] =?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; } + + } }