From 2035feb51aa7832090d874c499f224c551a72c71 Mon Sep 17 00:00:00 2001 From: “wangming” <“wangming@antissoft.com”> Date: Mon, 29 Dec 2025 15:30:31 +0800 Subject: [PATCH] fix: 修复GET请求中List类型门店筛选参数绑定问题 --- netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdDeductinfo/LqKdDeductinfoListQueryInput.cs | 4 ++-- netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/BillingItemDetailListQueryInput.cs | 4 ++-- netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXhPxmx/ConsumeItemDetailListQueryInput.cs | 4 ++-- netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs | 26 ++++++++++++++++++++++---- netcore/src/Modularity/Extend/NCC.Extend/LqXhHyhkService.cs | 8 ++++++-- 5 files changed, 34 insertions(+), 12 deletions(-) diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdDeductinfo/LqKdDeductinfoListQueryInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdDeductinfo/LqKdDeductinfoListQueryInput.cs index 6b5e867..a0f9db4 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdDeductinfo/LqKdDeductinfoListQueryInput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdDeductinfo/LqKdDeductinfoListQueryInput.cs @@ -75,9 +75,9 @@ namespace NCC.Extend.Entitys.Dto.LqKdDeductinfo public string StoreId { get; set; } /// - /// 门店ID列表(支持多门店筛选) + /// 门店ID列表(支持多门店筛选,逗号分隔的字符串,如:id1,id2,id3) /// - public List StoreIds { get; set; } + public string StoreIds { get; set; } /// /// 开始时间(开单时间筛选) diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/BillingItemDetailListQueryInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/BillingItemDetailListQueryInput.cs index c4334a8..6f0fa89 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/BillingItemDetailListQueryInput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/BillingItemDetailListQueryInput.cs @@ -84,9 +84,9 @@ namespace NCC.Extend.Entitys.Dto.LqKdKdjlb public string StoreId { get; set; } /// - /// 门店ID列表(多门店筛选) + /// 门店ID列表(多门店筛选,逗号分隔的字符串,如:id1,id2,id3) /// - public List StoreIds { get; set; } + public string StoreIds { get; set; } } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXhPxmx/ConsumeItemDetailListQueryInput.cs b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXhPxmx/ConsumeItemDetailListQueryInput.cs index 818a9ac..c32fe14 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXhPxmx/ConsumeItemDetailListQueryInput.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXhPxmx/ConsumeItemDetailListQueryInput.cs @@ -79,9 +79,9 @@ namespace NCC.Extend.Entitys.Dto.LqXhPxmx public string StoreId { get; set; } /// - /// 门店ID列表(多门店筛选) + /// 门店ID列表(多门店筛选,逗号分隔的字符串,如:id1,id2,id3) /// - public List StoreIds { get; set; } + public string StoreIds { get; set; } } } diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs index d5032a1..9854a4c 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs @@ -3856,9 +3856,13 @@ namespace NCC.Extend.LqKdKdjlb // 2. 通过 EXISTS 子查询筛选关联字段(在分页前筛选,确保分页准确) // 处理多门店筛选:优先使用StoreIds,如果没有则使用StoreId var filterStoreIds = new List(); - if (input.StoreIds != null && input.StoreIds.Any()) + if (!string.IsNullOrEmpty(input.StoreIds)) { - filterStoreIds = input.StoreIds.Where(x => !string.IsNullOrEmpty(x)).ToList(); + // 解析逗号分隔的门店ID字符串 + filterStoreIds = input.StoreIds.Split(',') + .Where(x => !string.IsNullOrWhiteSpace(x)) + .Select(x => x.Trim()) + .ToList(); } else if (!string.IsNullOrEmpty(input.StoreId)) { @@ -4063,6 +4067,21 @@ namespace NCC.Extend.LqKdKdjlb { var sidx = string.IsNullOrEmpty(input.sidx) ? "CreateTime" : input.sidx; + // 处理多门店筛选:优先使用StoreIds,如果没有则使用StoreId + var filterStoreIds = new List(); + if (!string.IsNullOrEmpty(input.StoreIds)) + { + // 解析逗号分隔的门店ID字符串 + filterStoreIds = input.StoreIds.Split(',') + .Where(x => !string.IsNullOrWhiteSpace(x)) + .Select(x => x.Trim()) + .ToList(); + } + else if (!string.IsNullOrEmpty(input.StoreId)) + { + filterStoreIds = new List { input.StoreId }; + } + // 构建基础查询:储扣信息 LEFT JOIN 开单记录 LEFT JOIN 客户信息 LEFT JOIN 门店信息 var baseQuery = _db.Queryable( (deduct, billing, member, store) => new JoinQueryInfos( @@ -4082,8 +4101,7 @@ namespace NCC.Extend.LqKdKdjlb .WhereIF(input.MaxUnitPrice.HasValue, (deduct, billing, member, store) => deduct.UnitPrice <= input.MaxUnitPrice.Value) .WhereIF(input.StartCreateTime.HasValue, (deduct, billing, member, store) => deduct.CreateTime >= input.StartCreateTime.Value) .WhereIF(input.EndCreateTime.HasValue, (deduct, billing, member, store) => deduct.CreateTime <= input.EndCreateTime.Value) - .WhereIF(!string.IsNullOrEmpty(input.StoreId), (deduct, billing, member, store) => billing.Djmd == input.StoreId) - .WhereIF(input.StoreIds != null && input.StoreIds.Any(), (deduct, billing, member, store) => input.StoreIds.Contains(billing.Djmd)) + .WhereIF(filterStoreIds.Any(), (deduct, billing, member, store) => filterStoreIds.Contains(billing.Djmd)) .WhereIF(input.StartTime.HasValue, (deduct, billing, member, store) => (deduct.BillingTime ?? billing.Kdrq) >= input.StartTime.Value) .WhereIF(input.EndTime.HasValue, (deduct, billing, member, store) => (deduct.BillingTime ?? billing.Kdrq) <= input.EndTime.Value) .WhereIF(!string.IsNullOrEmpty(input.ItemCategory), (deduct, billing, member, store) => deduct.ItemCategory == input.ItemCategory) diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqXhHyhkService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqXhHyhkService.cs index 5c86c91..502f9ee 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqXhHyhkService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqXhHyhkService.cs @@ -2038,9 +2038,13 @@ namespace NCC.Extend.LqXhHyhk // 2. 通过 EXISTS 子查询筛选关联字段(在分页前筛选,确保分页准确) // 处理多门店筛选:优先使用StoreIds,如果没有则使用StoreId var filterStoreIds = new List(); - if (input.StoreIds != null && input.StoreIds.Any()) + if (!string.IsNullOrEmpty(input.StoreIds)) { - filterStoreIds = input.StoreIds.Where(x => !string.IsNullOrEmpty(x)).ToList(); + // 解析逗号分隔的门店ID字符串 + filterStoreIds = input.StoreIds.Split(',') + .Where(x => !string.IsNullOrWhiteSpace(x)) + .Select(x => x.Trim()) + .ToList(); } else if (!string.IsNullOrEmpty(input.StoreId)) { -- libgit2 0.21.4