From 01f06a0c5e6a3a33510ed9916a8786fb51eca549 Mon Sep 17 00:00:00 2001 From: lingling <kety1122@163.com> Date: 星期三, 19 三月 2025 13:18:47 +0800 Subject: [PATCH] 添加过滤 --- LifePayment/LifePayment.Domain/Common/ChannelHelper.cs | 47 +++++++++++++++++++++++ LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs | 25 ++++++++++++ LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml | 2 LifePayment/LifePayment.Domain/Common/ChannelFilter.cs | 21 ++++++++++ 4 files changed, 94 insertions(+), 1 deletions(-) diff --git a/LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs b/LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs new file mode 100644 index 0000000..ce5c054 --- /dev/null +++ b/LifePayment/LifePayment.Domain/Common/AbstractChannelFilter.cs @@ -0,0 +1,25 @@ +锘縰sing LifePayment.Domain.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Auditing; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Users; + +namespace LifePayment.Domain.Common +{ + public abstract class AbstractChannelFilter + { + public abstract Task<IQueryable<TEntity>> GetPolicyFilter<TEntity, TKey>(IQueryable<TEntity> query) + where TEntity : class, IChannelData, IMayHaveCreator, IEntity<TKey>; + + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService<ICurrentUser>(); + + protected IRepository<User> UserDepartmentRepository => LazyServiceProvider.LazyGetRequiredService<IRepository<User>>(); + } +} diff --git a/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs b/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs new file mode 100644 index 0000000..91ae58b --- /dev/null +++ b/LifePayment/LifePayment.Domain/Common/ChannelFilter.cs @@ -0,0 +1,21 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LifePayment.Domain.Common +{ + //public class ChannelFilter : AbstractChannelFilter + //{ + // public async Task<IQueryable<ChannelsBase>> GetPolicyFilter<ChannelsBase, TKey>(IQueryable<ChannelsBase> query) + // { + // throw new NotImplementedException(); + // } + //} + + //public class ChannelsBase:IChannelFilter + //{ + // // public Guid ChannelId { get; set; } + //} +} diff --git a/LifePayment/LifePayment.Domain/Common/ChannelHelper.cs b/LifePayment/LifePayment.Domain/Common/ChannelHelper.cs new file mode 100644 index 0000000..bb7107a --- /dev/null +++ b/LifePayment/LifePayment.Domain/Common/ChannelHelper.cs @@ -0,0 +1,47 @@ +锘縰sing DynamicQuery.Net.Dto.Input; +using DynamicQuery.Net; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZeroD.Application.Services.Dto; +using Volo.Abp.Users; +using Volo.Abp.Auditing; +using Volo.Abp.Domain.Entities; + +namespace LifePayment.Domain +{ + public interface IChannelFilter + { + + public Task<IQueryable<TEntity>> GetChannelFilter<TEntity, TKey>(IQueryable<TEntity> query) + where TEntity : class, IChannelData, IMayHaveCreator, IEntity<TKey>; + //public static IQueryable<T> GetChannleQuery<T>(this IQueryable<T> query, ChannelFilterInput input) where T : class, IChannelData + //{ + // if (query == null) + // { + // return query; + // } + // if (input.Channels != null && input.Channels.Any()) + // { + // query = query.Where(r => input.Channels.Contains(r.ChannelId)); + // } + // return query; + //} + + } + + + + public interface IChannelData + { + Guid ChannelId { get; set; } + } + + public class ChannelFilterInput + { + public List<Guid> Channels { get; set; } = new List<Guid>(); + } + +} diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml index ce9d47f..c612514 100644 --- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml +++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml @@ -88,7 +88,7 @@ </member> <member name="M:LifePayment.HttpApi.LifePayController.AddLogger(LifePayment.Domain.Shared.LogErrorInput)"> <summary> - 鑾峰彇鐕冩皵鏀寔鍟嗘埛 + 娣诲姞鏃ュ織 </summary> <returns></returns> </member> -- Gitblit v1.9.1