fix: 字典类型项数统计按 trim 后 DictType 分组汇总
避免类型编码首尾空格导致左侧菜单 itemCount 匹配失败。
This commit is contained in:
parent
5a2d56986a
commit
dd2abab42b
@ -55,7 +55,11 @@ public class DictService : ApplicationService
|
||||
var kw = keyword?.Trim();
|
||||
var metaRows = await DictTypeRepository.GetListAsync();
|
||||
var countRows = await DictRepository.GetItemCountByTypeAsync();
|
||||
var countMap = countRows.ToDictionary(x => x.DictType, x => x.ItemCount, StringComparer.OrdinalIgnoreCase);
|
||||
var countMap = countRows
|
||||
.Select(x => (Type: x.DictType.Trim(), x.ItemCount))
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x.Type))
|
||||
.GroupBy(x => x.Type, StringComparer.OrdinalIgnoreCase)
|
||||
.ToDictionary(g => g.Key, g => g.Sum(x => x.ItemCount), StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var merged = new Dictionary<string, DictTypeOutput>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var meta in metaRows)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user