Lamda将集合按某个字段分组后组成新的分组集合
本篇介绍如何使⽤SSIS和作业完成⾃动更新⽬标数据任务。
** 温馨提⽰:如需转载本⽂,请注明内容出处。**
本⽂链接:
实体类:
public class CarModelResponse
{
///<summary>
///年款
///</summary>
public int fldYearCotyName { get; set; }
public List<CarModel> models { get; set; }
}
///<summary>
///车型
///</summary>
public class CarModel
{
///<summary>
///车型ID
///</summary>
public int fldModelID { get; set; }
/
//<summary>
///车型名称
///</summary>
public string fldModelName { get; set; }///<summary>
///年款
///</summary>
public int fldYearCotyName { get; set; } ///<summary>
///状态 0:启⽤ 1:禁⽤
///</summary>
public int fldDisabled { get; set; }
}
表达式:
public List<CarModelResponse> GetCarModel(int SeriesID)
lua字符串转数组{
var model = SqlHelper.GetCarModel(SeriesID);
CarModelResponse response = new CarModelResponse();
var grouplist = model.GroupBy(x => x.fldYearCotyName).Select(x => new CarModelResponse { fldYearCotyName = x.Key, models = x.Where(g => g.fldYearCotyName == x.Key).ToList() }); return grouplist.ToList();
}
结果:
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论