Commit 2035feb51aa7832090d874c499f224c551a72c71

Authored by “wangming”
1 parent 04a81ceb

fix: 修复GET请求中List<string>类型门店筛选参数绑定问题

- 将开单明细、耗卡明细、储扣列表三个接口的StoreIds参数从List<string>改为string类型(逗号分隔)
- 修改后端解析逻辑,支持解析逗号分隔的门店ID字符串
- 解决GET请求中List<string>类型参数无法正确绑定的问题
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdDeductinfo/LqKdDeductinfoListQueryInput.cs
@@ -75,9 +75,9 @@ namespace NCC.Extend.Entitys.Dto.LqKdDeductinfo @@ -75,9 +75,9 @@ namespace NCC.Extend.Entitys.Dto.LqKdDeductinfo
75 public string StoreId { get; set; } 75 public string StoreId { get; set; }
76 76
77 /// <summary> 77 /// <summary>
78 - /// 门店ID列表(支持多门店筛选 78 + /// 门店ID列表(支持多门店筛选,逗号分隔的字符串,如:id1,id2,id3
79 /// </summary> 79 /// </summary>
80 - public List<string> StoreIds { get; set; } 80 + public string StoreIds { get; set; }
81 81
82 /// <summary> 82 /// <summary>
83 /// 开始时间(开单时间筛选) 83 /// 开始时间(开单时间筛选)
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqKdKdjlb/BillingItemDetailListQueryInput.cs
@@ -84,9 +84,9 @@ namespace NCC.Extend.Entitys.Dto.LqKdKdjlb @@ -84,9 +84,9 @@ namespace NCC.Extend.Entitys.Dto.LqKdKdjlb
84 public string StoreId { get; set; } 84 public string StoreId { get; set; }
85 85
86 /// <summary> 86 /// <summary>
87 - /// 门店ID列表(多门店筛选 87 + /// 门店ID列表(多门店筛选,逗号分隔的字符串,如:id1,id2,id3
88 /// </summary> 88 /// </summary>
89 - public List<string> StoreIds { get; set; } 89 + public string StoreIds { get; set; }
90 } 90 }
91 } 91 }
92 92
netcore/src/Modularity/Extend/NCC.Extend.Entitys/Dto/LqXhPxmx/ConsumeItemDetailListQueryInput.cs
@@ -79,9 +79,9 @@ namespace NCC.Extend.Entitys.Dto.LqXhPxmx @@ -79,9 +79,9 @@ namespace NCC.Extend.Entitys.Dto.LqXhPxmx
79 public string StoreId { get; set; } 79 public string StoreId { get; set; }
80 80
81 /// <summary> 81 /// <summary>
82 - /// 门店ID列表(多门店筛选 82 + /// 门店ID列表(多门店筛选,逗号分隔的字符串,如:id1,id2,id3
83 /// </summary> 83 /// </summary>
84 - public List<string> StoreIds { get; set; } 84 + public string StoreIds { get; set; }
85 } 85 }
86 } 86 }
87 87
netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs
@@ -3856,9 +3856,13 @@ namespace NCC.Extend.LqKdKdjlb @@ -3856,9 +3856,13 @@ namespace NCC.Extend.LqKdKdjlb
3856 // 2. 通过 EXISTS 子查询筛选关联字段(在分页前筛选,确保分页准确) 3856 // 2. 通过 EXISTS 子查询筛选关联字段(在分页前筛选,确保分页准确)
3857 // 处理多门店筛选:优先使用StoreIds,如果没有则使用StoreId 3857 // 处理多门店筛选:优先使用StoreIds,如果没有则使用StoreId
3858 var filterStoreIds = new List<string>(); 3858 var filterStoreIds = new List<string>();
3859 - if (input.StoreIds != null && input.StoreIds.Any()) 3859 + if (!string.IsNullOrEmpty(input.StoreIds))
3860 { 3860 {
3861 - filterStoreIds = input.StoreIds.Where(x => !string.IsNullOrEmpty(x)).ToList(); 3861 + // 解析逗号分隔的门店ID字符串
  3862 + filterStoreIds = input.StoreIds.Split(',')
  3863 + .Where(x => !string.IsNullOrWhiteSpace(x))
  3864 + .Select(x => x.Trim())
  3865 + .ToList();
3862 } 3866 }
3863 else if (!string.IsNullOrEmpty(input.StoreId)) 3867 else if (!string.IsNullOrEmpty(input.StoreId))
3864 { 3868 {
@@ -4063,6 +4067,21 @@ namespace NCC.Extend.LqKdKdjlb @@ -4063,6 +4067,21 @@ namespace NCC.Extend.LqKdKdjlb
4063 { 4067 {
4064 var sidx = string.IsNullOrEmpty(input.sidx) ? "CreateTime" : input.sidx; 4068 var sidx = string.IsNullOrEmpty(input.sidx) ? "CreateTime" : input.sidx;
4065 4069
  4070 + // 处理多门店筛选:优先使用StoreIds,如果没有则使用StoreId
  4071 + var filterStoreIds = new List<string>();
  4072 + if (!string.IsNullOrEmpty(input.StoreIds))
  4073 + {
  4074 + // 解析逗号分隔的门店ID字符串
  4075 + filterStoreIds = input.StoreIds.Split(',')
  4076 + .Where(x => !string.IsNullOrWhiteSpace(x))
  4077 + .Select(x => x.Trim())
  4078 + .ToList();
  4079 + }
  4080 + else if (!string.IsNullOrEmpty(input.StoreId))
  4081 + {
  4082 + filterStoreIds = new List<string> { input.StoreId };
  4083 + }
  4084 +
4066 // 构建基础查询:储扣信息 LEFT JOIN 开单记录 LEFT JOIN 客户信息 LEFT JOIN 门店信息 4085 // 构建基础查询:储扣信息 LEFT JOIN 开单记录 LEFT JOIN 客户信息 LEFT JOIN 门店信息
4067 var baseQuery = _db.Queryable<LqKdDeductinfoEntity, LqKdKdjlbEntity, LqKhxxEntity, LqMdxxEntity>( 4086 var baseQuery = _db.Queryable<LqKdDeductinfoEntity, LqKdKdjlbEntity, LqKhxxEntity, LqMdxxEntity>(
4068 (deduct, billing, member, store) => new JoinQueryInfos( 4087 (deduct, billing, member, store) => new JoinQueryInfos(
@@ -4082,8 +4101,7 @@ namespace NCC.Extend.LqKdKdjlb @@ -4082,8 +4101,7 @@ namespace NCC.Extend.LqKdKdjlb
4082 .WhereIF(input.MaxUnitPrice.HasValue, (deduct, billing, member, store) => deduct.UnitPrice <= input.MaxUnitPrice.Value) 4101 .WhereIF(input.MaxUnitPrice.HasValue, (deduct, billing, member, store) => deduct.UnitPrice <= input.MaxUnitPrice.Value)
4083 .WhereIF(input.StartCreateTime.HasValue, (deduct, billing, member, store) => deduct.CreateTime >= input.StartCreateTime.Value) 4102 .WhereIF(input.StartCreateTime.HasValue, (deduct, billing, member, store) => deduct.CreateTime >= input.StartCreateTime.Value)
4084 .WhereIF(input.EndCreateTime.HasValue, (deduct, billing, member, store) => deduct.CreateTime <= input.EndCreateTime.Value) 4103 .WhereIF(input.EndCreateTime.HasValue, (deduct, billing, member, store) => deduct.CreateTime <= input.EndCreateTime.Value)
4085 - .WhereIF(!string.IsNullOrEmpty(input.StoreId), (deduct, billing, member, store) => billing.Djmd == input.StoreId)  
4086 - .WhereIF(input.StoreIds != null && input.StoreIds.Any(), (deduct, billing, member, store) => input.StoreIds.Contains(billing.Djmd)) 4104 + .WhereIF(filterStoreIds.Any(), (deduct, billing, member, store) => filterStoreIds.Contains(billing.Djmd))
4087 .WhereIF(input.StartTime.HasValue, (deduct, billing, member, store) => (deduct.BillingTime ?? billing.Kdrq) >= input.StartTime.Value) 4105 .WhereIF(input.StartTime.HasValue, (deduct, billing, member, store) => (deduct.BillingTime ?? billing.Kdrq) >= input.StartTime.Value)
4088 .WhereIF(input.EndTime.HasValue, (deduct, billing, member, store) => (deduct.BillingTime ?? billing.Kdrq) <= input.EndTime.Value) 4106 .WhereIF(input.EndTime.HasValue, (deduct, billing, member, store) => (deduct.BillingTime ?? billing.Kdrq) <= input.EndTime.Value)
4089 .WhereIF(!string.IsNullOrEmpty(input.ItemCategory), (deduct, billing, member, store) => deduct.ItemCategory == input.ItemCategory) 4107 .WhereIF(!string.IsNullOrEmpty(input.ItemCategory), (deduct, billing, member, store) => deduct.ItemCategory == input.ItemCategory)
netcore/src/Modularity/Extend/NCC.Extend/LqXhHyhkService.cs
@@ -2038,9 +2038,13 @@ namespace NCC.Extend.LqXhHyhk @@ -2038,9 +2038,13 @@ namespace NCC.Extend.LqXhHyhk
2038 // 2. 通过 EXISTS 子查询筛选关联字段(在分页前筛选,确保分页准确) 2038 // 2. 通过 EXISTS 子查询筛选关联字段(在分页前筛选,确保分页准确)
2039 // 处理多门店筛选:优先使用StoreIds,如果没有则使用StoreId 2039 // 处理多门店筛选:优先使用StoreIds,如果没有则使用StoreId
2040 var filterStoreIds = new List<string>(); 2040 var filterStoreIds = new List<string>();
2041 - if (input.StoreIds != null && input.StoreIds.Any()) 2041 + if (!string.IsNullOrEmpty(input.StoreIds))
2042 { 2042 {
2043 - filterStoreIds = input.StoreIds.Where(x => !string.IsNullOrEmpty(x)).ToList(); 2043 + // 解析逗号分隔的门店ID字符串
  2044 + filterStoreIds = input.StoreIds.Split(',')
  2045 + .Where(x => !string.IsNullOrWhiteSpace(x))
  2046 + .Select(x => x.Trim())
  2047 + .ToList();
2044 } 2048 }
2045 else if (!string.IsNullOrEmpty(input.StoreId)) 2049 else if (!string.IsNullOrEmpty(input.StoreId))
2046 { 2050 {