C# List集合Group by查询
//根据企业ID、类型、配置ID进行分组; var groupList = chRCheckConfirmList .GroupBy(x => new {x.CompanyId, x.Type, x.ChRCheckItemConfigId}) .Select(group => new { Keys = group.Key, TotalScore = group.Sum(p => p.Score) }).ToList();
GroupBy 添加分组条件,多个条件时用逗号“,”隔开
.GroupBy(x => new {x.CompanyId, x.Type, x.ChRCheckItemConfigId})
Select 用于分组之后输出的结果集,可以new 出一个实体,或者直接new 个对象